3 ms·
Compiler design was one subject that I struggled with when I was an undergrad. I feel this has held me back from creating DSLs. I am looking for a gentle int
by manishsharan 10y ago
Compiler design was one subject that I struggled with when I was an undergrad. I feel this has held me back from creating DSLs. I am looking for a gentle introduction to ANTLR that can take me from newbie to mastery. Any books anyone can recommend would be helpful.
- fusiongyro 10y agoThe book "Language Implementation Patterns"[1] covers ANTLR 3, and the author (who is one of the implementors of ANTLR) walks you through successively more interesting DSLs until you're basically building a programming language, but does it in small steps. I didn't struggle with compilers as an undegrad at all, and I found this book too slow for me, so I'm optimistic that you will be pleased by the pacing. :) If you want to see a way older approach, I did really enjoy Jack Crenshaw's "Let's Build a Compiler"[2]—but it's so vintage it may be totally hipster by now. :) [1] https://www.amazon.com/Language-Implementation-Patterns-Domain-Specific-Programming/dp/193435645X/ref=sr_1_2?ie=UTF8&qid=1481865280&sr=8-2&keywords=antlr https://www.amazon.com/Language-Implementation-Patterns-Doma... [2] http://compilers.iecc.com/crenshaw/ http://compilers.iecc.com/crenshaw/
- breck 10y agoThe Antlr-4 book is terrific: https://pragprog.com/book/tpantlr2/the-definitive-antlr-4-reference https://pragprog.com/book/tpantlr2/the-definitive-antlr-4-re...
- kriro 10y agoIndeed. As someone with no real language background it allowed me to get to a state where I can create my own DSLs. An alternative would be to use something like Xtext (which also allows you to create langauge tools, not just the language itself). I played around with it and it's very nice (granted you'll kind of need to embrace Eclipse) but ultimately decided that ANTLR was "enough".
- heysunshine123 10y agoLook into "Pratt Parsers". It's reasonably easy to implement one based on some blog posts etc.