how to eliminate this left recursion

"Mike" <hammeron56@yahoo.com>
22 Jul 2005 20:17:06 -0400

          From comp.compilers

Related articles
how to eliminate this left recursion hammeron56@yahoo.com (Mike) (2005-07-22)
Re: how to eliminate this left recursion codeworker@free.fr (=?iso-8859-1?q?C=E9dric_LEMAIRE?=) (2005-07-26)
Re: how to eliminate this left recursion cfc@shell01.TheWorld.com (Chris F Clark) (2005-07-26)
Re: how to eliminate this left recursion owong@castortech.com (Oliver Wong) (2005-07-26)
| List of all articles for this month |

From: "Mike" <hammeron56@yahoo.com>
Newsgroups: comp.compilers
Date: 22 Jul 2005 20:17:06 -0400
Organization: http://groups.google.com
Keywords: parse, question
Posted-Date: 22 Jul 2005 20:17:06 EDT

Hi,


I understand how to eliminate left-recursion when a grammar rule
looks like this: a->ab | c


but how do you do it when it looks only like this: a->ab


Such a grammar rule exists in the following regular expressions grammar
(see rule ERE_expression)


Thanks in advance,
Mike


/* --------------------------------------------
      Extended Regular Expression
      --------------------------------------------
*/
extended_reg_exp : ERE_branch
                                      | extended_reg_exp '|' ERE_branch
                                      ;
ERE_branch : ERE_expression
                                      | ERE_branch ERE_expression
                                      ;
ERE_expression : one_character_ERE
                                      | '^'
                                      | '$'
                                      | '(' extended_reg_exp ')'
                                      | ERE_expression ERE_dupl_symbol
                                      ;
one_character_ERE : ORD_CHAR
                                      | QUOTED_CHAR
                                      | '.'
                                      | bracket_expression
                                      ;
ERE_dupl_symbol : '*'
                                      | '+'
                                      | '?'
                                      | '{' DUP_COUNT '}'
                                      | '{' DUP_COUNT ',' '}'
                                      | '{' DUP_COUNT ',' DUP_COUNT '}'
                                      ;


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.