Re: Why LL(1) Parsers do not support left recursion?

"SLK Parsers" <parsersinc@earthlink.net>
31 Jul 2006 23:34:28 -0400

          From comp.compilers

Related articles
[25 earlier articles]
Re: Why LL(1) Parsers do not support left recursion? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-07-28)
Re: Why LL(1) Parsers do not support left recursion? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-07-28)
Re: Why LL(1) Parsers do not support left recursion? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-07-28)
Re: Why LL(1) Parsers do not support left recursion? wyrmwif@tsoft.org (SM Ryan) (2006-07-29)
Re: Why LL(1) Parsers do not support left recursion? ajo@andrew.cmu.edu (Arthur J. O'Dwyer) (2006-07-29)
Re: Why LL(1) Parsers do not support left recursion? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-07-29)
Re: Why LL(1) Parsers do not support left recursion? parsersinc@earthlink.net (SLK Parsers) (2006-07-31)
Re: Why LL(1) Parsers do not support left recursion? wyrmwif@tsoft.org (SM Ryan) (2006-08-01)
Re: Why LL(1) Parsers do not support left recursion? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-08-03)
Re: Why LL(1) Parsers do not support left recursion? parsersinc@earthlink.net (SLK Parsers) (2006-08-03)
Re: Why LL(1) Parsers do not support left recursion? parsersinc@earthlink.net (SLK Parsers) (2006-08-04)
| List of all articles for this month |

From: "SLK Parsers" <parsersinc@earthlink.net>
Newsgroups: comp.compilers
Date: 31 Jul 2006 23:34:28 -0400
Organization: Parsers Inc.
Keywords: parse
Posted-Date: 31 Jul 2006 23:34:28 EDT

>As already mentioned with regards to the Java grammar, I think that a
>grammar with unrolled implied rules is a maintenance nightmare. How
>should any new kind of statement be added correctly, if the reason and
>the criteria for the splitting into open and closed statements is not
>documented explicitly, but instead is only built into an existing grammar?


This grammar solution is just an exercise of theoretical
interest. Yacc and most other tools can handle the ambiguous grammar
correctly.


>That's why I would prefer an explicit syntactical termination of an
>if-statement, by e.g. an "endif" or "fi" terminal, over your solution.
>This would IMO eliminate the dangling else problem, without the risk of
>collissions with other rules, in the current or any future extended
>grammar.


There is no need to modify the ambiguous grammar in any way to get a
correct parser. All that is needed is to choose one or the other of
the two possible parses. Yacc does this by preferring the shift over
the reduce. SLK does this by using the first production of the two
alternates as the parse table entry.


Post a followup to this message

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