|[Newbie] LL(1) and if-then-else email@example.com (1997-03-31)|
|Re: [Newbie] LL(1) and if-then-else firstname.lastname@example.org (1997-04-02)|
|Re: [Newbie] LL(1) and if-then-else email@example.com (Thomas W. Christopher) (1997-04-03)|
|From:||firstname.lastname@example.org (MORIN Bruno)|
|Date:||31 Mar 1997 15:27:42 -0500|
|Organization:||Universites Paris VI/Paris VII - France|
|Keywords:||LL(1), question, comment|
Currently studying compilers, we need for a project to resolve the 'if
- then - else' ambiguity. We are programming a mini-compiler based on
a LL(1) grammar and are unable to resolve the ambiguity raised by an
if a = 2 then
if b = 3 then print "hello";
else exit(); <-------- Is there any possible way to create a
LL(1) grammar which can decide that this
'else' is bound to the nearest 'if' ,
without using an 'endif' marker ??
Thanks in advance
[The usual approach is to have one rule for an un-elsed-if, and another
rule for everything else. Don't remember if that makes it LL(1), though.
Return to the
Search the comp.compilers archives again.