[antlr-interest] ANTLR3 AST construction with options and alternatives

Foolish Ewe foolishewe at hotmail.com
Sun Nov 12 18:27:05 PST 2006


Hello All:

I've not heard back on a previous question about how to generate AST's.

I have a construct in a grammar that looks something like:

// allows optional override of default version id
versionInfo: (id+=versionId)? (f1+=fieldType1 | f2+=fieldType2 | 
f3+=fieldType3)*
   ->^(VERSIONINFO $id+ $f1+ $f2+ $f3+);

but it doesn't work the way I would like, meaning that I run the debugger 
for a test case that
has well defined ASTs are constructed for some of the fields, but some some 
are not populated.
This debugger halts and won't proceed to construct the VERSIONINFO node, 
although
before I decorated the grammar with action annotations for AST construction, 
the grammar
created a well formed parse tree.   I looked at the wiki  for AST related 
stuff, and
I am still not sure how to fix this problem or if it is a bug in ANTLR3.

Regards:

Bill M.

_________________________________________________________________
Find a local pizza place, music store, museum and more…then map the best 
route!  http://local.live.com?FORM=MGA001



More information about the antlr-interest mailing list