[antlr-interest] Can't see the wood (@init and @after)
Paul Keir
paul at paulkeir.com
Thu Jul 19 07:40:06 PDT 2007
Hi Susan,
I tried it again just to be sure, and got the same result. If in the C.g
file of the C project from the java ANTLR examples, I augment line 354's
'expression' rule with two println calls, i.e.
expression
@init { System.out.println("a"); }
: { System.out.println(" b"); } assignment_expression (','
assignment_expression)*
;
And then build and run the generated parser on the 'input' data, I find
that I get a lot more letter 'a's output than letter 'b's. I don't
understand why that is, but at least I have this example to hopefully
learn from.
It's interesting that you can't repeat this. Perhaps someone else can,
or help me to an understanding.
Cheers,
Paul
More information about the antlr-interest
mailing list