[antlr-interest] Default templates with output=template

John Ridgway john at jacelridge.com
Wed Dec 5 08:51:47 PST 2007


Friends -
I am attempting to use templates with a grammar and discovering some  
(to me) surprising behavior.  When I do:

w : x -> xyz2(x=x);
x : y;
y : z -> xyz(z=z);

I would anticipate that the template created by using xyz would be  
passed up through the intermediate rule to the rule for w; but this  
does not happen.  Instead x has a null template.  Is there a good  
reason for this, or could (should) ANTLR be changed so that, in a  
case where no template is specified, the obvious default is used.

I don't believe that I can even do:

x : y -> y;

Am I missing something?

Peace
- John



More information about the antlr-interest mailing list