Jamie's Space

JP

Playing With ANTLR

Today I started doing some research on ANTLR (http://www.antlr.org/), a very powerful parser generator. It compiles language grammars into source code for a number of languages (I am working with C# output mostly, but it primarily creates Java). I am currently learning about Abstract Syntax Trees (http://en.wikipedia.org/wiki/Abstract_syntax_tree) and how I could use one of those instead of a Parse Tree (http://en.wikipedia.org/wiki/Parse_tree), which is what I have previously been working with when parsing languages. The major difference is I need to modify whatever language grammar I am using so that it produces an AST. I am hoping this isn’t too difficult, but we will see how things go over the next few days after I get up to speed on ANTLR. So far it looks promising though. I am impressed with how powerful ANTLR is - because it produces source code, you can embed code in the language specification itself. It looks like it is going to be a bit of fun figuring this all out :-)