[antlr-interest] brief analysis of java.g's tree building
in 2.x vs proposed 3.0
John D. Mitchell
johnm-antlr at non.net
Thu Feb 3 19:07:52 PST 2005
>>>>> "Loring" == Loring Craymer <Loring.G.Craymer at jpl.nasa.gov> writes:
[...]
>> Heh, what if we used -> like this:
>> ifStat : (IF->IFEXPR) '('! expr ')'! stat ... ;
YUCK! I'd much prefer the verbose but very clear version.
>> Then it begs the question: can I allow a tree rewrite not just a token
>> type change on a single node? Nah...then I would really be getting
>> complicated. ;)
> This gets pretty ghastly. You need an attribute syntax, with nodes
> having default attributes "text" and "type". Then something like IF
> @IF.type = IFEXPR might make sense.
That looks pretty complicated, too, as (it seems like) you're driving
expressions with side-effects into the mix.
Take care,
John
More information about the antlr-interest
mailing list