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

Jon Schewe jpschewe at mtu.net
Mon May 27 12:28:27 PDT 2002


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/ 



More information about the antlr-interest mailing list