I stumbled upon this looking for simple compilers for my verifiable builds concept. The concept is to bootstrap a real compiler for C apps in a tiny, likely-unoptimized compiler that average developer can understand. I looked at a lot of ideas from mini-C’s to Oberon to mini-ML to LISP’s. One thing I’m sure on for people from a C background is an interpreter or simple compiler will be easier to understand if it uses something like C’s syntax, semantics, data types and so on. This is a nice candidate for an initial compiler where the method would be getting it working, documenting it where users could understand every aspect of it, providing machine code directly mapping to source, a script to turn it into a binary, and then the source of a major compiler recoded in this sub-C to run through that binary. The bootstrapping phase would require understanding one tool followed by tedious, maybe even automated, checking of a compiler source ported to that language. Lowers the bar so almost any developer can verify the bootstrap.
Just one approach among many I’m considering. I like how it takes about 3 or 4 pages to cover much of it. The other components are an assembler, linker, and minimal subset of x86 to use to simplify things. Each one unnecessary if already present on system. I’m up for any free, online resource on each of those that are as straightforward to learn as an “Idiot’s Guide.” Other thoughts are doing the tools in Perl, Awk, or BASH since they tend to already be installed on the distro. Still need initial C compiler, assembler, and linker. Reverse engineer some out of PeachPy or similar tool maybe…
I stumbled upon this looking for simple compilers for my verifiable builds concept. The concept is to bootstrap a real compiler for C apps in a tiny, likely-unoptimized compiler that average developer can understand. I looked at a lot of ideas from mini-C’s to Oberon to mini-ML to LISP’s. One thing I’m sure on for people from a C background is an interpreter or simple compiler will be easier to understand if it uses something like C’s syntax, semantics, data types and so on. This is a nice candidate for an initial compiler where the method would be getting it working, documenting it where users could understand every aspect of it, providing machine code directly mapping to source, a script to turn it into a binary, and then the source of a major compiler recoded in this sub-C to run through that binary. The bootstrapping phase would require understanding one tool followed by tedious, maybe even automated, checking of a compiler source ported to that language. Lowers the bar so almost any developer can verify the bootstrap.
Just one approach among many I’m considering. I like how it takes about 3 or 4 pages to cover much of it. The other components are an assembler, linker, and minimal subset of x86 to use to simplify things. Each one unnecessary if already present on system. I’m up for any free, online resource on each of those that are as straightforward to learn as an “Idiot’s Guide.” Other thoughts are doing the tools in Perl, Awk, or BASH since they tend to already be installed on the distro. Still need initial C compiler, assembler, and linker. Reverse engineer some out of PeachPy or similar tool maybe…