[antlr-interest] Composite Tree Grammars are things of beauty, but ...

Terence Parr parrt at cs.usfca.edu
Fri Mar 11 14:29:29 PST 2011


On Mar 9, 2011, at 7:15 PM, Gary Miller wrote:

> Hey Terrance,
>
> tree grammar T;
> a : some horrible mess of a RECURSIVE rule;
> b : B ;
>
> tree grammar U;
> import T;
> a : {pre action} T.a {post action}; // <-- wants to be able to refer
> to super rule
>
> It wouldn't be enough to just expose the super rule T.a.
> In the generated walker A_T the rule 'a' would need to call the  
> delegators.a().

hmm...crap. you're right. polymorphism wouldn't work. it would call  
T's 'a' not U's a.

>> ANTLR technically doesn't expose x.y syntax to the user and so I  
>> didn't recognize the fact that you invoked the super rule.  It  
>> extracted only those rules from your super grammar that it needed.  
>> It does this so that you can fill up libraries of grammars with  
>> rules and then pick out which ones you want without bloating your  
>> generated code.
>
> Thanks for raising the issue.
> Based on my bias ("Composite Tree Grammars are things of beauty") I
> would hope for more than a minor ;-)

I ignore most bug fields ;)

> How do I get a login the JIRA so that I can follow issues?

send me separate email with the username :)

>> That said, I am adding an improvement request for consideration.
>>
>> http://www.antlr.org/jira/browse/ANTLR-452
>
> Sorry, I can't parse this. Are you saying that you would like to
> removed imports from ANTLR?

fixed.

allow x.y syntax to refer to rule y in imported grammar x
>
>> I'd like to retract or how ANTLR it handles imports anyway.

"refactor"; voice recog error.

>
> Regards
> Gary
>
> P.S. is there any reason for ANTLR over Antlr | AntLR | AntLr |  
> antlr etc.

easier to type. :)

T


More information about the antlr-interest mailing list