3 ms·
There is a great paper by Abdulaziz Ghuloum, An Incremental Approach to Compiler Construction, that is pretty much the cookbook you want: http://scheme2006.cs.u
by mepian 8y ago
There is a great paper by Abdulaziz Ghuloum, An Incremental Approach to Compiler Construction, that is pretty much the cookbook you want: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
"We show that building a compiler can be as easy as building an interpreter. The compiler we construct accepts a large subset of the Scheme programming language and produces assembly code for the Intel x86 architecture, the dominant architecture of personal computing. The development of the compiler is broken into many small incremental steps. Every step yields a fully working compiler for a progressively expanding subset of Scheme. Every compiler step produces real assembly code that can be assembled then executed directly by the hardware."
There is also a work-in-progress effort to write a more extensive textbook that follows the same approach to teaching compiler development, using Racket instead of R5RS Scheme: https://github.com/IUCompilerCourse/Essentials-of-Compilation https://github.com/IUCompilerCourse/Essentials-of-Compilatio...
- _hardwaregeek 8y agoI was recommended that paper by someone else. Just need to get around to reading it :) The main roadblock I'm having right now is typechecking. I've implemented Hindley Milner in Haskell and played around with Turnstile, but I still don't know enough theory to invent my own type rules for an imperative language. Something like "Type Theory for the Working Programmer" would be excellent. I just got a copy of TaPL, so maybe I'll just use that.