ll(1) and variable assignment...

weltraum@astrocat.de (Chris)
6 Nov 2004 15:03:19 -0500

          From comp.compilers

Related articles
ll(1) and variable assignment... weltraum@astrocat.de (2004-11-06)
Re: ll(1) and variable assignment... wyrmwif@tsoft.org (SM Ryan) (2004-11-07)
Re: ll(1) and variable assignment... vbdis@aol.com (2004-11-07)
Re: ll(1) and variable assignment... cfc@shell01.TheWorld.com (Chris F Clark) (2004-11-14)
| List of all articles for this month |

From: weltraum@astrocat.de (Chris)
Newsgroups: comp.compilers
Date: 6 Nov 2004 15:03:19 -0500
Organization: http://groups.google.com
Keywords: LL(1), parse, question
Posted-Date: 06 Nov 2004 15:03:18 EST

hi,


I want to write a recursive descent parser, and wonder if there is a
LL(1) grammar for "c-style" variable assignement
(i.e. "id=id=id+id" but not "id=id=id+id=2").


The following grammar is LL(2) I think:


A := ID = A
A := E


E := T E'
E':= + T E'
E':=


T := ID
T := ( A )




I tried to convert it to LL(1), then I got something like that:


A := ID A'
A := ( A )
A':= = A
A':= + T E'


E := T E'
E':= + T E'
E':=


T := ID
T := ( A )


But then I lose the context. I don't no if the "id" in rule one is a
left value or not.
Does an LL(1) grammar exist for this problem? Or am I absolutely wrong
with something?


bye
Chris



Post a followup to this message

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