Inspired by Eric Sink's interview on the stackoverflow podcast I would like to build a full compiler in my spare time for the learning experience. My initial thought was to build a C compiler but I'm not sure whether it would take too much time.
I am wondering if there is a smaller general purpose language that would be more appropriate to implement as a first compiler effort? Or is a C implementation doable on a reasonable timescale (200 hrs)?
It is my intention to target the CLR.
You'll be happiest writing compilers for older, smaller languages. Pascal, for example, were designed as learning tools. The Pascal language is small and elegant; the compiler can be written fairly simply.
Even an Oberon or Modula-2 compiler is similar in complexity to Pascal; their design was driven by the same person, Niklaus Wirth.
Languages like C, which evolved organically, are too full of quirks to be good learning experiences.
Write a Scheme compiler.
See: An incremental approach to compiler construction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With