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

Saileshwar Krishnamurthy <krish@cs.purdue.edu>
Thu, 9 Nov 1995 22:17:26 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)
[20 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: Saileshwar Krishnamurthy <krish@cs.purdue.edu>
Keywords: parse, LL(1), LALR
Organization: Compilers Central
References: 95-11-051
Date: Thu, 9 Nov 1995 22:17:26 GMT

Odd Arild Olsen <oaolsen@login.eunet.no> writes:


        Odd> grammars, but many languages can be described by LL(1)
        Odd> grammars. If LL(1) can yield faster, smaller and more
        Odd> understandable parsers with better error handling for
        Odd> many languages, why isn't this method more elaborated?


As I understand it:


A standard (easily understandable) grammar of a typical programming
language often isn't LL(1). However normally after eliminating
left-recursion and left-factoring (and other transformations) the
grammar can be converted to one that is LL(1). However these
transformtations make the new grammar pretty difficult to understand.
So while the parser may be reasonably easy to understand, it becomes
difficult to use that grammar and embed semantic routines in it -
'coz the original version will probably be what is most intuitive.
However most standard grammars will not need conversion to make them
LR.


Also parser-controlled semantic stacks mesh excellently with LR
parsers, and are pretty much a pain for LL parsers (In LL parsers,
the semantic stack cannot grow in parallel with the parse stack)


        Odd> the various Small-C compilers were recursive
        Odd> descending. Which common languages can not be parsed by
        Odd> LL(1) grammars?


They can be parsed perhaps, but the final LL(1) grammar that
corresponds to the language will probably not be so intuitively
obvious. Whoops, I find it difficult to convince myself whenever I
eliminate left-recursion for a toy grammar !
--


Post a followup to this message

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