4 ms·
You can also bootstrap the way lisp did and write the fist compiler in the language and get a bunch of grad students to hand-compile it. But, yeah if you don't
by ByteJockey 4y ago
You can also bootstrap the way lisp did and write the fist compiler in the language and get a bunch of grad students to hand-compile it.
But, yeah if you don't have a bunch of grad students at the ready, an assembler hand-written in machine code is the only option if you want to trust the entire stack. Though I'm not sure what that would get you. I don't know of any higher language compilers that are written directly in assembly these days, so you'd never be able to compile your C/C++ compiler.
- chongli 4y agoThere was a C compiler written in assembly posted on HN 4 years ago [1]! So yeah, if you wanted to, you could bit-bang an assembler capable of assembling a simple C compiler, then in your simple subset of C you could implement a full C compiler, and from there you can do anything you want! The grad student approach also sounds interesting. A basic Lisp interpreter can easily fit on a single letter-sized sheet of paper. A single person could hand-compile that, it would just take longer. But, if you're living alone in a cabin in the woods with your own hand-built computer and a personal library of computer books in hard copy, that would be a totally feasible project. [1] https://news.ycombinator.com/item?id=17851311 https://news.ycombinator.com/item?id=17851311
- ByteJockey 4y agoI wasn't aware that there were any existing C compilers made in asm for modern architectures. I guess I shouldn't be too surprised. That's cool, thanks for showing me.