[antlr-interest] Inheritance of parsers not working quite right

Jon Schewe jpschewe at mtu.net
Mon May 27 16:03:36 PDT 2002


I'm not building a tree parser, just a basic parser.  No errors when 
compiling, just when running the generated parser.  Even tried building 
from scratch.

Terence Parr wrote:

> Hi Jon.  The first thing to check is that when you add a token, which 
> changes the token type numbers of everything below its introduction in 
> the grammar, that you have rebuilt the tree grammar.  In other words, 
> when I added "assert" to my Java parser and then compiled and ran 
> things, it bitched in the tree grammar.  ooops...forgot to regenerate 
> from java.tree.g so that the new token types can get pushed thru to the 
> JavaTreeParser.java :)
> 
> Ter
> 
> On Monday, May 27, 2002, at 12:28  PM, Jon Schewe wrote:
> 
> 
>>I'm using antlr 2.7.1 and working with a modified Java grammar.  I
>>recently decided to addd 1.4 support, which means two grammars.  I have
>>them inheriting from each other and something's not right.  The only
>>change I have is one rule, statement, has an extra match rule at the end
>>for the assert keyword.  So I put the full grammar in the supergrammar
>>and just the statement rule in the sub grammar.
>>
>>Now if the rule in the supergrammar has the or condition for the assert
>>keyword and the subgrammar doesn't, then things work ok.  However if the
>>supergrammar is missing support for the assert keyword and the
>>subgrammar has support for the assert keyword, then calling the parser
>>generated from the subgrammar doesn't recognize the assert keyword
>>properly.  It's almost as if it was using the rules from the
>>supergrammar and ignoring the subgrammar rules.  I put a print statement
>>in the initialization for the statement rule and the right rules are
>>getting called, just not working correctly.
>>
>>Anyone have any ideas what's going on here?
>>--
>>Jon Schewe | http://mtu.net/~jpschewe | jpschewe at mtu.net
>>For I am convinced that neither death nor life, neither angels
>>nor demons, neither the present nor the future, nor any
>>powers, neither height nor depth, nor anything else in all
>>creation, will be able to separate us from the love of God that
>>is in Christ Jesus our Lord. - Romans 8:38-39
>>
>>
>>
>>
>>Your use of Yahoo! Groups is subject to 
>>http://docs.yahoo.com/info/terms/
>>
>>
>>
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 



-- 
Jon Schewe | http://mtu.net/~jpschewe | jpschewe at mtu.net
For I am convinced that neither death nor life, neither angels
nor demons, neither the present nor the future, nor any
powers, neither height nor depth, nor anything else in all
creation, will be able to separate us from the love of God that
is in Christ Jesus our Lord. - Romans 8:38-39


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list