Re: LL(1) vs LALR(1) parsers

Terence John Parr <parrt@parr-research.com>
Mon, 20 Nov 1995 20:37:22 GMT

          From comp.compilers

Related articles
LL(1) vs LALR(1) parsers oaolsen@login.eunet.no (Odd Arild Olsen) (1995-11-04)
Re: LL(1) vs LALR(1) parsers krish@cs.purdue.edu (Saileshwar Krishnamurthy) (1995-11-09)
Re: LL(1) vs LALR(1) parsers sc@iaxp01.inf.uni-jena.de (Sebastian Schmidt) (1995-11-10)
Re: LL(1) vs LALR(1) parsers the_tick@access5.digex.net (1995-11-10)
Re: LL(1) vs LALR(1) parsers parrt@lonewolf.parr-research.com (1995-11-14)
Re: LL(1) vs LALR(1) parsers simmons@bnr.ca (steve (s.s.) simmons) (1995-11-15)
Re: LL(1) vs LALR(1) parsers parrt@parr-research.com (Terence John Parr) (1995-11-20)
Re: LL(1) vs LALR(1) parsers bill@amber.ssd.hcsc.com (1995-11-22)
Re: LL(1) vs LALR(1) parsers elliottc@logica.com (1995-11-24)
Re: LL(1) vs LALR(1) parsers jgj@ssd.hcsc.com (1995-11-28)
Re: LL(1) vs LALR(1) parsers will@ccs.neu.edu (1995-11-28)
Re: LL(1) vs LALR(1) parsers ddean@dynastar.cs.princeton.edu (1995-11-28)
Re: LL(1) vs LALR(1) parsers napi@ms.mimos.my (1995-11-28)
[15 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: Terence John Parr <parrt@parr-research.com>
Keywords: LL(1), LALR, parse
Organization: Compilers Central
References: 95-11-051 95-11-086 95-11-122
Date: Mon, 20 Nov 1995 20:37:22 GMT

[This is a corrected version of 95-11-122 -John]


Saileshwar Krishnamurthy (krish@cs.purdue.edu) wrote:
: They can be parsed perhaps, but the final LL(1) grammar that
: corresponds to the language will probably not be so intuitively
: obvious.


Just thought I'd throw in my 2 cents on LL(1). If I'm building
a recognizer only, LALR(1) clearly wins. The decision is not
so clear when you talk about the debugging, adding actions, etc...
LL(k>1) is actually a nice solution [LALR(k>1) would be nice too].
The syntactic predicates of PCCTS allow arbitrary lookahead
through selective backtracking. Kinda nice. The famous C++
expressions vs declaration ambiguity can be solved via:


stat : (decl)? // if it looks like a declaration, it is
          | expr // else it's an expression.
          ;


Note that we are smart about this: "a=3;" immediately jumps to
the expr alternative as it's obviously not a declaration.


Please see my upcoming paper with Russell Quong in SIGPLAN Notices
(Jan or Feb 96) called: ``LL and LR Translators Need k>1 Lookahead''.
PS can be had of it now at


ftp://ftp.parr-research.com/pub/pccts/papers/needlook.ps


Best regards,
Terence Parr
http://www.parr-research.com/~parrt/
--


Post a followup to this message

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