Related articles |
---|
[Newbie] LL(1) and if-then-else morin@ufr-info-p7.ibp.fr (1997-03-31) |
Re: [Newbie] LL(1) and if-then-else salomon@nickel.cs.umanitoba.ca (1997-04-02) |
Re: [Newbie] LL(1) and if-then-else tc@charlie.cns.iit.edu (Thomas W. Christopher) (1997-04-03) |
From: | morin@ufr-info-p7.ibp.fr (MORIN Bruno) |
Newsgroups: | comp.compilers |
Date: | 31 Mar 1997 15:27:42 -0500 |
Organization: | Universites Paris VI/Paris VII - France |
Keywords: | LL(1), question, comment |
Hi !!
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
'else' statement.
For instance,
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.
-John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.