Related articles |
---|
Re. Is PASCAL LL/LR sankar@Neon.Stanford.EDU (1990-10-26) |
Re: Re. Is PASCAL LL/LR piet@cs.ruu.nl (1990-10-29) |
Newsgroups: | comp.compilers |
From: | piet@cs.ruu.nl (Piet van Oostrum) |
In-Reply-To: | sankar@Neon.Stanford.EDU (Sriram Sankar) |
Keywords: | Pascal, parse, LL(1) |
Organization: | Dept of Computer Science, Utrecht University, The Netherlands |
References: | <1990Oct26.213044.28243@Neon.Stanford.EDU> |
Date: | 29 Oct 90 14:47:25 GMT |
>>>>> In article <1990Oct26.213044.28243@Neon.Stanford.EDU>, sankar@Neon.Stanford.EDU (Sriram Sankar) (SS) writes:
SS> Since PASCAL has a rule that dangling else's associate with the
SS> innermost 'if', it seems obvious to me that PASCAL (at least wrt to the
SS> if statement) is LR. If the dangling else was associated with the
SS> outermost 'if' you can still make the necessary S/R decisions, so I do
SS> think (not looked at it carefully enough though) that this too is LR.
It is even very easy to rewrite the grammar to be LR(1). Someone did that a
few postings ago. See also the dragon book [1], p. 175
The dragon book also states that it is impossible to change the
if-then-else grammar to an equivalent one that is LL(1) (page 192). I have
not seen a proof of this, so I accept this by faith.
[1] Aho, Sethi and Ullman, Compilers, Principles, Techniques and Tools,
Addison-Wesley.
--
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet
Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.