Related articles |
---|
Help needed on LALR(1) ambiguity philip.k.chow@gmail.com (2008-11-14) |
Re: Help needed on LALR(1) ambiguity cdodd@acm.org (Chris Dodd) (2008-11-17) |
Re: Help needed on LALR(1) ambiguity armelasselin@hotmail.com (Armel) (2008-11-17) |
Re: Help needed on LALR(1) ambiguity svenolof.nystrom-nospam@bredband.net (Sven-Olof Nystrom) (2008-11-18) |
Re: Help needed on LALR(1) ambiguity philip.k.chow@gmail.com (2008-11-18) |
Re: Help needed on LALR(1) ambiguity Danny.Dube@ift.ulaval.ca (2008-12-01) |
From: | philip.k.chow@gmail.com |
Newsgroups: | comp.compilers |
Date: | Tue, 18 Nov 2008 16:46:02 -0800 (PST) |
Organization: | Compilers Central |
References: | 08-11-055 08-11-083 |
Keywords: | parse, LALR |
Posted-Date: | 19 Nov 2008 19:50:24 EST |
Hi everybody, thank you for your comments.
Chris Dodd wrote:
> So the problem is that you need to be able to look
> ahead to the end of the input to see how many |-suffixes
> there are in order to figure out how to parse the beginning
> of the expression. This makes it pretty much impossible
> to parse without unbounded lookahead, or backtracking,
> or something else.
Yes I believe you're right.
Sven-Olof Nystrom wrote:
> In your example, making the second production of "Names" left-recursive
> makes the grammar LALR(1). Yacc detects no conflicts for the following
> grammar:
>
> names : ID COLON
> names : names COMMA ID
Unfortunately this is not the same language.
My names match the following:
a:
a,b:
a,b,c:
Your names unfortunately match the following:
a:
a:,b
a:,b,c
I understand now that there is probably no way to solve my problem
without unlimited lookahead. Thank you everyone for your help.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.