Re: LL(1) problem

"SLK Parsers" <slk15@earthlink.net>
6 May 2003 19:14:16 -0400

          From comp.compilers

Related articles
LL(1) problem albert@shqiperia.com (Albert) (2003-04-27)
Re: LL(1) problem cdc25@it.canterbury.ac.nz (Carl Cerecke) (2003-05-05)
Re: LL(1) problem vbdis@aol.com (2003-05-05)
Re: LL(1) problem slk15@earthlink.net (SLK Parsers) (2003-05-06)
| List of all articles for this month |

From: "SLK Parsers" <slk15@earthlink.net>
Newsgroups: comp.compilers
Date: 6 May 2003 19:14:16 -0400
Organization: Parsers Inc.
References: 03-04-091
Keywords: parse, LL(1)
Posted-Date: 06 May 2003 19:14:15 EDT

> PackageName = ident ":" ident { ":" ident }.


Looks like you made this production to avoid yet another ident.ident
problem. Seems like ident should be a valid PackageName.


> ClassName = [PackageName] "." ident .


This apparently incorrect production should have solved the problem.


This is a good example of the extreme weakness of LL(1). That is why LL(k)
is more commonly used now, even though it is not all that much stronger. At
least it does avoid simple, not uncommon problems like this one.


Substitution and left-factoring could probably fix the problem, but the
grammar will get messy. You need a MemberAccess_or_ident production with
ClassName substituted out. Then all of the idents can be factored.


http://parsers.org


Post a followup to this message

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