Re: LL to LALR conversion

Pete Jinks <>
12 Feb 2003 12:48:44 -0500

          From comp.compilers

Related articles
LL to LALR conversion (Klaas-Jan Stol) (2003-02-11)
Re: LL to LALR conversion (Pete Jinks) (2003-02-12)
| List of all articles for this month |

From: Pete Jinks <>
Newsgroups: comp.compilers
Date: 12 Feb 2003 12:48:44 -0500
Organization: Computer Science Dept, University of Manchester
References: 03-02-064
Keywords: parse, LL(1)
Posted-Date: 12 Feb 2003 12:48:44 EST

Klaas-Jan Stol wrote:
> I'm trying to convert some grammar (I think LL(1)) into LALR format.

Any genuine LL(1) grammar is automatically LALR(1).

Unfortunately, your grammar is fundamentally ambiguous
i.e. not LL(1) to begin with. For example, an input of:
a ( (b) (c) )
can be understood in terms of your grammar as:
a functioncall of a with args ( explist ),
where the explist has 2 exps, (b) followed by (c)
a functioncall of a with args ( explist ),
where the explist has 1 exp,
which is itself a functioncall of (b) with arg (c)

I think you have incorrectly copied the grammar for Lua, which
uses "," between the expressions in an explist. This resolves
the ambiguity above.

Peter J. Jinks, Room 2.99, Department of Computer Science,
University of Manchester, Oxford Road, Manchester, M13 9PL, U.K.
(+44/0)161-275 6186

Post a followup to this message

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