is there a simple compiler for a small language

Ayoub M. picture Ayoub M. · Dec 16, 2009 · Viewed 15.9k times · Source

I am looking for a simple compiler that compiles a simple language, I need it to write a paper about it and to learn how compilers work, I am not looking for a sophisticated thing just a simple language (by simple I mean a small code because for example gcc is toooooo big). any help is appreciated.

Answer

Norman Ramsey picture Norman Ramsey · Dec 19, 2009

If you want to look at code, I'm very impressed with Eijiro Sumii's MinCaml compiler.

  • It's only 2000 lines long.

  • It compiles a pretty interesting source language.

  • It generates real machine code, none of this namby-pamby C or LLVM stuff :-)

  • Speed of compiled code is competetive with gcc and the native OCaml compilers.

  • The compiler is designed for teaching.

Did I mention I've been very impressed?