Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good languages to write a compiler for

I'm thinking of writing a compiler in haskell, and just to gain some knowledge and experience, I will try to implement compilers for existing languages. Could someone give me a list of languages which are suitable for this?

Thanks in advance

like image 206
Ishihara Avatar asked Dec 19 '10 17:12

Ishihara


2 Answers

Pascal could be a good start - you can compile it in a single pass. A subset of Lisp might be useful in order to grasp the idea of the lambda lifting. ML or even a subset of Haskell might help you in understanding the type inference. Consider using LLVM as your back-end, it will save you some time on implementing boring stuff.

like image 159
SK-logic Avatar answered Oct 11 '22 18:10

SK-logic


Scheme is often used for this. There's even a tutorial called Write Yourself a Scheme in 48 hours for Haskell.

like image 42
Jörg W Mittag Avatar answered Oct 11 '22 19:10

Jörg W Mittag