[antlr-interest] Force nodes for grammar rules

Maik Merten maikmerten at gmx.net
Tue Dec 6 08:58:26 PST 2005


Bryan Ewbank wrote:
> There's no automatic way to do it.  You would have to make sure that
> every production has an action of the form
>      { ## = #( #PRODUCTION_ID,"production_name"], ## ); }
> Of course, the leaf nodes, such as identifier, etc, might need
> different processing...

Thank you for your proposal. We're already using that approach:

pr_BasicStatements :
	pr_Assignment | pr_LogStatement | pr_LoopConstruct |
pr_ConditionalConstruct |
	pr_SelectCaseConstruct
{
## = #([BasicStatements,"BasicStatements"], ##);
};


The "BasicStatements"-node isn't included in the AST in some cases, though.


Maik


More information about the antlr-interest mailing list