This series is one of the best introductions to compiler construction. It doesn't cover everything and it's 25 years old now, but it is the only guide I know of that will hold your hand as you build a working compiler from scratch. If you have never built a compiler before, I cannot think of a better place to start. Afterward, if you're curious about theory and advanced topics, I recommend heading to Compilers: Princ…
I just looked at the chapters, and it's kind of funny that it gets these accolades despite being written as a 80-char-width text-only file. Edit: I don't say that to disparage it; I actually think that's an impressive accomplishment.
Let’s Build a Compiler (1995)
41–50 of 58 posts
Re: Let’s Build a Compiler (1995)
#42If you're looking for a modern compilers class -- including the theory of why this stuff works -- I highly recommend Matt Might's [0]. All of the notes, slides, and code are online. I audited Might's "Compilers" this spring. He live-coded a parser that parsed with derivatives, returning all possible parse trees whenever there were ambiguities in the grammar. [1] (Try getting that from yacc, or basically any other too…
Re: Let’s Build a Compiler (1995)
#43I followed this in the early 90s and had a lovely time. It helped that Turbo Pascal was my language of choice though and might not be quite so helpful now although Pascal is a pretty good pseudocode.. It's not the same but Vidar Hokstad has been writing a series for several years now in Ruby: http://www.hokstad.com/compiler/ .. and other resources aplenty: http://stackoverflow.com/a/1672/3951
Pascal is pretty much directly derived from early dialects of Algol, which is where most modern programming language syntaxes derive; it's the original block-structured syntax, as opposed to line-structured assembly and early FORTRAN and the fully-bracketed Lisp syntax (which is also block-structured if you indent it sanely).
Re: Let’s Build a Compiler (1995)
#44Re: Let’s Build a Compiler (1995)
#45If you're looking for a modern compilers class -- including the theory of why this stuff works -- I highly recommend Matt Might's [0]. All of the notes, slides, and code are online. I audited Might's "Compilers" this spring. He live-coded a parser that parsed with derivatives, returning all possible parse trees whenever there were ambiguities in the grammar. [1] (Try getting that from yacc, or basically any other too…
Including generator functions? That would be impressive. Well, one could solve it by putting all locals into an heap allocated object and use the "switch over the whole function body"-trick to continue execution at the correct position.
Re: Let’s Build a Compiler (1995)
#46http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf
Easy to read, concise, and good for beginners.
Re: Let’s Build a Compiler (1995)
#47If you're looking for a modern compilers class -- including the theory of why this stuff works -- I highly recommend Matt Might's [0]. All of the notes, slides, and code are online. I audited Might's "Compilers" this spring. He live-coded a parser that parsed with derivatives, returning all possible parse trees whenever there were ambiguities in the grammar. [1] (Try getting that from yacc, or basically any other too…
http://www.cs.cmu.edu/afs/cs/project/fox/mosaic/people/fp/co...
Re: Let’s Build a Compiler (1995)
#48I went through this on my own back in a HS programming class! Glad to see it here. While the teacher was walking students through how to do loops, I got permission to hack away in the back of the room on this. I ended up building a BASIC-like interpreter with a decent graphics API. By the end of the class, my project was a multi-level breakout game I'd written in the interpreter I'd written. TLDR; two years later, I…
congrats. This has been on my list to read and experiment with. I was hoping my 15-year old could get into this as well.
Re: Let’s Build a Compiler (1995)
#49Email me if you'd like an HTML version of this. I have converted most of it for my own personal use (through part 11, IIRC) but don't want to distribute it publicly since I'm unclear on the copyright status.
Isn't contacting the author the natural thing to do? Some googling found a user profile for him: http://www.embedded.com/user/JackCrens
Re: Let’s Build a Compiler (1995)
#50If you're looking for a modern compilers class -- including the theory of why this stuff works -- I highly recommend Matt Might's [0]. All of the notes, slides, and code are online. I audited Might's "Compilers" this spring. He live-coded a parser that parsed with derivatives, returning all possible parse trees whenever there were ambiguities in the grammar. [1] (Try getting that from yacc, or basically any other too…
http://en.wikipedia.org/wiki/Parser_combinator
http://www.cs.nott.ac.uk/~gmh/monparsing.pdf
Actually, when using such approach you have to fight the power of resulting parser. You have to restrict it or your parser will retain data for too long.