[antlr-interest] infinite recursion causing my head to spin

M.A.Bell mabell at wi.rr.com
Wed Apr 16 14:37:06 PDT 2003


My apologies in advance for my ignorance, obviously I'm new at this.
I have 2 questions.
1. Is there a more concise way to state ruleA? That is, another way to 
code optional paired parentheses?
2. As you can see, I've got a serious infinite recursion problem here, 
and can't seem to come up with a solution. Can someone give me a pointer 
or two to nudge me in the right direction?
ruleA:
    (ruleB)
  | (LPAREN ruleB RPAREN)
  | (ruleC)
  | (LPAREN ruleC RPAREN)
;
ruleB:
  (ruleW | ruleA)
  (RESERV_1 RESERV_2)
  (ruleW | ruleA)
;
ruleC:
  (ruleW | ruleA)
  (RESERV_3)?
  (ruleX)?
  (RESERV_2)
  (ruleW | ruleA)
  (ruleD)?
;
ruleD:
    (RESERV_4 ruleY)
  | (RESERV_5 LPAREN ruleZ RPAREN)
;
-- 
Michael Bell
<mailto:mabell at wi.rr..com>



 

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




More information about the antlr-interest mailing list