Repository navigation
Expand file tree
/
Copy pathintroduction.html
More file actions
163 lines (152 loc) · 8.69 KB
/
Copy pathintroduction.html
File metadata and controls
163 lines (152 loc) · 8.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<html>
<head>
<meta charset="UTF-8"/>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-79457306-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-79457306-2');
</script>
<link href="https://fonts.googleapis.com/css?family=Crimson+Text&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Crimson Text', serif;
}
blockquote {
padding-left: 10px;
border-left: #cdcdcd 3px solid;
margin-left: 0;
}
#sidebar {
position: absolute;
left: 2em;
font-weight: bold;
}
#pages a {
/*color: #133da2;*/
color: inherit;
}
#pages a:hover {
text-decoration: underline;
}
a {
color: #3467ff;
}
th:nth-of-type(2) {
text-align: left;
}
td,th{
border-left: 10px solid rgba(0,0,0,0);
}
tr td:first-child, tr th:first-child {
text-align: right;
border:0px;
}
i, b, em, a {
font-family: inherit;
}
abbr {
text-decoration: underline;
}
code {
font-family: monospace;
font-size: 14px;
background: #dcdcf9;
border-radius: 5px;
padding-left: 4px;
padding-right: 4px;
}
a {
text-decoration: none;
}
p, li {
font-size: 19px;
}
p {
margin-bottom: 0.5em;
}
ol {
margin-top: 0;
}
#toc div a span {
display: none;
}
pre {
font-family: monospace;
white-space: pre-line;
padding: 1em;
border-radius: 3px;
background-color: #dcdcf9;
}
body {
margin-left: 20em;
margin-top: 5%;
width: 60%;
padding-bottom: 5em;
}
.nav3 {padding-left: 1em;}
.nav4 {padding-left: 2em;}
.nav5 {padding-left: 3em;}
.nav6 {padding-left: 4em;}
body {counter-reset: h2}
h2, .nav2 {counter-reset: h3}
h3, .nav3 {counter-reset: h4}
h4, .nav4 {counter-reset: h5}
h5, .nav5 {counter-reset: h6}
h2:before, .nav2:before {counter-increment: h2; content: counter(h2) ". "}
h3:before, .nav3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "}
h4:before, .nav4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "}
h5:before, .nav5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
h6:before, .nav6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "; counter-increment: h4counter; }
#toc a, #toc-head, .nav2:before, .nav3:before, .nav4:before, .nav5:before, .nav6:before {
color: #404040;
}
#toc div a:hover {
color: #999;
}
#reset-counter {
counter-reset: h2;
}
</style>
</head>
<body style="background: #f6f6f6">
<div id="sidebar">
<div id="pages">
<a href="documentation.html">Documentation</a><br>
<br>
<a href="introduction.html">Introduction</a><br>
<a href="machine-code.html">Machine Code</a><br>
<a href="machine-code.html">Assembly</a><br>
<a href="machine-code.html">Stack Language</a><br>
<a href="machine-code.html">High-level Language</a><br>
<a href="ethernet.html">Ethernet</a><br>
<br>
</div>
<div id="toc-head">Introduction</div>
<div id="toc"><div class="nav2"><a href="#g2138">Goals</a></div><div class="nav2"><a href="#g2139">The Plan</a></div><div class="nav2"><a href="#g2140">Setting up our Software</a></div></div>
</div>
<span id="reset-counter"></span>
<p>[Analogy of some yogurt fermentation process where old yogurt is used to make new yogurt].</p><p>Fermentation is similar to building compilers. New languages are written with old languages.</p><ol><li>Algol 60 was <a href="http://foldoc.org/Automated%20Engineering%20Design">extended to create</a> the language AED.</li>
<li>AED was <a href="http://foldoc.org/Automated%20Engineering%20Design">used to write</a> the first BCPL compiler.</li>
<li>BCPL was used to write the first B compiler</li>
<li> B was used to re-implement the B compiler
<span></span></li>
<li>The B langauge/compiler was <a href="https://www.bell-labs.com/usr/dmr/www/chist.html">iteratively transformed</a> into the C language/compiler.</li></ol><p>The typical "hello world" operating system starts with the C language, the fancy yogurt. We plan to create our yogurt from scratch.</p><h2 id="g2138">Goals </h2><p>While asking for advice on how to write this tutorial, my sister provided me with a great analogy for what we're trying to do: build a ship.</p><p>Many tutorials walk through which nails to put into which board of woods, explaining what's being built as the ship comes together.</p><p>In this tutorial, I hope to teach not just how to build a ship, but how ships are built, similar to what nand2tetris does. I plan to describe what makes a ship float, how a particular ship design fulfils those requirements, and the necessary woodworking skills.</p><ul><li>continue the "expanding self-build toolset" feeling of nand2tetris</li>
<li>provide readers with plenty of documentation</li>
<li>create plenty of non-frustrating exercises for the reader</li>
<li>don't worry about accurately receating the historical path to contemporary OSes</li>
<li>don't worry about re-implementing existing languages</li></ul><h2 id="g2139">The Plan </h2><p>Earlier, we read that the B language/compiler was iteratively transformed into the C language/compiler. We plan on going through a similar process to elevate ourselves from machine code to a janky high-level language.</p><p>Once we implement a hacked-together high-level language, we'll rewrite the language's compiler in itself, adding features such as useful error reporting.</p><p>Once we have a non-painful language to work with, we'll begin implementing user-facing code, our end goal being to build a <a href="https://gopher.tildeverse.org/zaibatsu.circumlunar.space/1/~solderpunk/gemini">gemini client & server</a>.</p><p><b>Long-term Goals</b></p><ul><li>ethernet</li>
<li>netcat io <span></span></li>
<li>tls
<ul><li>v1.3</li>
<li>chacha20</li>
<li>poly1305</li>
<li>sha256</li></ul></li>
<li>gemini client</li>
<li>gemini server</li></ul><h2 id="g2140">Setting up our Software </h2><p>For the time being, this book is written for users of Linux and macOS. The Windows Subsystem for Linux should also work.</p><p>We'll use <a href="https://nixos.org/nix">Nix</a> to manage our software. Once Nix is installed, download the book's source code repo and run <code>nix-shell</code>.</p><pre>git clone <a href="https://github.com/aaronjanse/os-book">https://github.com/aaronjanse/os-book</a>
cd os-book
nix-shell</pre><p>You should be put in a bash shell with all the required software installed (in that shell only; none of the rest of your system is dirtied). This shell includes a patched version of qemu, and aliases <code>binify</code> & <code>emulate</code> to make your life easier.</p>
</body>
</html>