|Problem with infinite left-recursion... firstname.lastname@example.org (1994-12-12)|
|Re: Problem with infinite left-recursion... email@example.com (1994-12-14)|
|Re: Problem with infinite left-recursion... firstname.lastname@example.org (1994-12-14)|
|Re: Problem with infinite left-recursion... davidm@Rational.COM (1994-12-19)|
|From:||email@example.com (Jon Mauney)|
|Organization:||Mauney Computer Consulting|
|Date:||Wed, 14 Dec 1994 21:38:28 GMT|
firstname.lastname@example.org (Casper B. Stoel) writes:
>I have a problem with left-recursion in my grammar. I am wondering if
>there is a 'standard' way of breaking the recursion? Is there an easy
>way of breaking up the rule into multiple rules?
Most left and right recursion in grammars follows a standard idiom.
To describe a list of A's left-recursively, we typically write
list ::= list A
To describe a list of A's right-recursively, we typically write
list ::= A more-A
more-A ::= A
Separators go in fairly obvious places, if needed.
Expressions are just lists of operands separated by operators.
If you have a lot of left-recursive rules it is tedious to
change them all, but not difficult.
Jon Mauney email@example.com
Mauney Computer Consulting (919) 828-8053
Return to the
Search the comp.compilers archives again.