[antlr-interest] Treeparser inheritance?

Terence Parr parrt at cs.usfca.edu
Mon Nov 14 12:06:04 PST 2005


Oh, sorry.  Now I remember.  Inheritance is an "include".  The  
implementation says it inherits from the tree parser, but you'll see  
all your overridden rules inside. :)

Ter
On Nov 14, 2005, at 11:49 AM, Jos Fries wrote:

> Hi Terrence,
>
> Could you point me to an example in which a tree parser in a  
> subgrammar inherits from the tree parser in the supergrammer? I  
> searched in vain for that use of inheritance in the reference  
> manual...
>
> Regards,
>
> Jos
>
>
>>
>> On Nov 14, 2005, at 8:37 AM, Jos Fries wrote:
>>
>>> Hi,
>>>
>>> Last weekend I experimented with grammar inheritance. I   
>>> successfully extended a lexer and a parser. Extending my tree   
>>> parser however failed. My statement "class BTreeWalker extends   
>>> ATreeWalker;" is accepted by ANTLR but compiled to the Java code   
>>> "public class BTreeWalker extends antlr.TreeParser".
>>>
>>> Excuse the newbie character of the question, but does the  
>>> concept  of grammar inheritance also apply to tree parsers? The   
>>> documentation doesn't state anything about this. I'm using antlr   
>>> 2.7.4.
>>
>> Hi Jos, it should work as you describe.  Are you sure you're doing  
>> it just like in the examples?
>>
>> Terence
>>
>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.362 / Virus Database: 267.13.0/167 - Release Date:  
>> 11-11-2005
>>
>



More information about the antlr-interest mailing list