Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!olivea!mintaka!spdcc!esegue!compilers-sender From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.compilers Subject: Re: Re. Is PASCAL LL/LR Keywords: Pascal, parse, LL(1) Message-ID: <4134@ruuinf.cs.ruu.nl> Date: 29 Oct 90 14:47:25 GMT References: <1990Oct26.213044.28243@Neon.Stanford.EDU> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, Utrecht University, The Netherlands Lines: 25 Approved: compilers@esegue.segue.boston.ma.us In-Reply-To: sankar@Neon.Stanford.EDU (Sriram Sankar) >>>>> 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') -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.