[antlr-interest] A postmortem of my use of antler

Andy Tripp antlr at jazillian.com
Tue Mar 11 11:18:12 PDT 2008


Benjamin Shropshire wrote:
> Oddly I was having a blast building and debugging my grammar. It was 
> when I started trying to put int actions that stuff got difficult.
>
That's not odd at all. When building a grammar, you're specifying what's 
valid input - fairly straightforward.
When you start putting in actions, you necessarily have to start 
understanding the structure of the
generated code, and you're mixing two types of processing: parsing of 
input and doing (something else
with actions).

I really don't like the book example of evaluating an expression with 
ANTLR. Better to build an AST
as one step, and then evaluate the expression by walking the AST as a 
distinct step. I realize the example
is probably "for illustrative purposes only", but there must be a better 
example than trying to do two things
(parse and evaulate) at once.


More information about the antlr-interest mailing list