{"id":19743,"date":"2026-09-09T09:46:34","date_gmt":"2026-09-09T09:46:34","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=19743"},"modified":"2026-09-09T10:07:29","modified_gmt":"2026-09-09T10:07:29","slug":"compiler-bootstrapping","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=19743","title":{"rendered":"Bootstrapping a Compiler"},"content":{"rendered":"<p>It&#8217;s the technique used to create a compiler of a specific language written in the same language. (chicken or the egg dilemma)<\/p>\n<hr>\n<p><strong>What is given<\/strong><\/p>\n<ol>\n<li>CPU (understands machine code)<\/li>\n<li>Assembler (translates assembly language into machine code)<\/li>\n<\/ol>\n<pre>\r\nAssembly Language \u2192 Assembler \u2192 Machine Code \u2192 CPU\r\n<\/pre>\n<hr>\n<p><strong>How it&#8217;s solved<\/strong><\/p>\n<p>Let&#8217;s assume you have designed a new language called ABC.<\/p>\n<ol>\n<li>The first ABC compiler (v1) has to be written in assembly language (or machine code).<\/li>\n<li>Now you can use this ABC compiler (v1) to compile an ABC compiler (v2) written in ABC.<\/li>\n<li>Finally, you can use the ABC compiler (v2) to compile its own source code. (self-compiled)<\/li>\n<\/ol>\n<pre>\r\nABC Compiler v1 (written in Assembly)\r\n        \u2502\r\n        \u2502 compiles\r\n        \u25bc\r\nABC Compiler v2 (written in ABC)\r\n        \u2502\r\n        \u2502 compiles itself\r\n        \u25bc\r\nABC Compiler v3 (self-compiled)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s the technique used to create a compiler of a specific language written in the same language. (chicken or the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[39],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19743"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19743"}],"version-history":[{"count":16,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19743\/revisions"}],"predecessor-version":[{"id":19759,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19743\/revisions\/19759"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19743"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}