Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.compilers    |    Compiler construction, theory, etc. (Mod    |    2,753 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,762 of 2,753    |
|    Hans-Peter Diettrich to vincent Feng    |
|    Re: how to deal with left recursive?    |
|    07 Nov 09 00:25:44    |
   
   From: DrDiettrich1@aol.com   
      
   vincent Feng schrieb:   
      
   > I have found ansi c yacc grammar.   
   > A production of statement list like this   
   >   
   > statement_list   
   > : statement   
   > | statement_list statement   
   > ;   
   >   
   > is left recursive.   
   > How to elimilate left recursive in such case?   
      
    statement_list   
    : statement   
    | statement statement_list   
    ;   
      
   or shorter EBNF:   
      
    statement_list   
    : statement [ statement_list ]   
    ;   
   or   
      
    statement_list   
    : statement { statement }   
    ;   
      
   > Is there exist a solution for parsing such grammar using LL(k) ?   
      
   The C language is essentially LL(1), with one or two LL(2) cases.   
      
   DoDi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca