I am a chemistry grad student and will be attending a graduate course in CS at my university in the coming weeks. The course is called "Programming languages and compilers" and its goal is to teach students about compilers by making them write one.
As I have never ventured into the world of compilers, I'm a bit lost as to where to start. I'm familiar with C, Python, HTML, Mathematica, FORTRAN 77, all of which I've used at different times and for different purposes, but haven't mastered any of them.
We (teams of 2) have the choice of either adding functionality to an existing compiler (suggestions include Gambit-C, Pascal-S, Tiny C, Small C) or write our own for any language or a subset thereof. If we choose to write our own compiler, it has to be written in Scheme, unless it can compile itself, in which case we can write it in any language. Coincidentally, I have begun reading Practical Common Lisp [0] last month and enjoy it.
The suggested textbook is "A. Appel, Modern compiler implementation in Java/ML/C". Other suggested readings are by Paul Graham.
Now my questions are:
1) Should I write my own compiler or extend an existing one?
2) Should I write a self-compiling compiler?
3) What language should I try to compile?
4) What books/resources will be helpful?
I'm asking these questions because I want to get the most out of this class. I think it's a great opportunity but that I could easily get lost. Almost everything written in the course plan I had heard of or read somewhere, so I am not completely out of the game.
Thanks in advance.
[0]http://gigamonkeys.com/book/
If you decide to go with a non-Lisp language: are you allowed to use tools like bison/yacc and lex/flex (or analogs for non-C languages)? Those can cut down the amount of work by a lot. Making it self-hosting over the course of semester is still going to be challenging, I think, especially if you have no previous background in compilers and/or low-level code (there are a lot of other issues there, such as the need to write or otherwise obtain an I/O library).
If it were me, starting from ground zero, I'd either go with extending an existing compiler or writing something in Scheme.