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

parrt@lonewolf.parr-research.com (Terence John Parr)
Tue, 14 Nov 1995 02:10:11 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)
[17 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: parrt@lonewolf.parr-research.com (Terence John Parr)
Keywords: LL(1), LALR, parse
Organization: Parr Research Corporation
References: 95-11-051 95-11-086
Date: Tue, 14 Nov 1995 02:10:11 GMT

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/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.