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 thi
I've started a video tutorial on writing an ANTLR 3.x compiler - check out
http://javadude.com/articles/antlr3xtut
I'll be adding more to it soon! -- Scott
In my former IT school, we had to develop a compiler in C++, but not from scratch : there were steps, learning curve etc..
The concept of the TIGER Compiler and projet assignments
All documents are available, but the code itself isn't, so you'd have to do it all by yourself.
There's a lot of understandable and usable informations, it could be a good start for learning to code a compiler.
Google UCSD Pascal. It was a ground-breaker in the 70s. Maybe it's more than you want, but it was easily ported to lot of "micro" chips back then.
LISPes (Scheme, etc) are the simplest actual languages. You can look how to build a primitive Scheme interpreter in perl with this book (paper version here on Lulu). Parsing, type checking are similar in interpreters and compilers. Then, here is a more hardcore book on the compiler design subject (also available as dead tree on Lulu).
Jack Crenshaw, a Ph.D. who has written extensively about practical numerical methods, was scared of compilers for a long time. He finally got tired of being scared, and wrote a multi-part tutorial on compiler construction, based on what he learned as he was teaching himself about the subject.
See "Let's Build a Compiler" for more information. Note that it isn't complete; he ran out of steam before he finished it, but there is a lot of easily-digestible information in there.
The standard Stack Overflow resource for resources on compiler writing is Learning to write a compiler