Related articles |
---|
Bottom-up versus Top-down jacko@post8.tele.dk (Jack Olsen) (1997-11-23) |
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-11-24) |
Re: Bottom-up versus Top-down gnb@itga.com.au (Gregory Bond) (1997-11-28) |
Re: Bottom-up versus Top-down gclind01@spd.louisville.edu (1997-11-29) |
Re: Bottom-up versus Top-down mkgardne@cs.uiuc.edu (1997-11-30) |
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-11-30) |
Re: Bottom-up versus Top-down rod.bates@wichita.boeing.com (Rodney M. Bates) (1997-12-02) |
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-12-02) |
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-12-02) |
Re: Bottom-up versus Top-down dwight@pentasoft.com (1997-12-02) |
Re: Bottom-up versus Top-down neitzel@gaertner.de (1997-12-05) |
[7 later articles] |
From: | mkgardne@cs.uiuc.edu (Mark K. Gardner) |
Newsgroups: | comp.compilers |
Date: | 30 Nov 1997 22:51:13 -0500 |
Organization: | University of Illinois at Urbana-Champaign |
References: | 97-11-123 97-11-155 |
Keywords: | parse |
On 29 Nov 1997 00:03:58 -0500, George C. Lindauer <gclind01@spd.louisville.edu> wrote:
>Top down parsing is much easier to implement, but,
>bottom-up parsing is more efficient. YACC and other code generators
>tend to generate the type of state tables required to do bottom-up
>parsing efficiently...
I have often heard the claim that bottom-up parsing is more efficient
than top-down parsing. One of the justifications often given is that
bottom-up parsers are table-driven while top-down parsers are usually
implemented as recursive-descent parsers. However (and as pointed out
in the Dragon book), top-down parsers can also be table-driven. Has
anyone seen any publications which support the claim that bottom-up
parsing is more efficient than top-down parsing and under what
circumstances? I have not. (I suspect that the claim also hinges upon
how you define "efficient".)
Note that I am fully aware LR and LALR can parse a larger class of
grammars than LL. What I am asking for is a head-to-head comparison
between the two techniques on the same (hopefully non-trival) grammar
conducted in a reasonably scientific manner. My hunch is that both
techniques are equally efficient if implemented in a reasonable and
comparable manner. Thus the only reason to prefer LR/LALR over LL is
because your grammar requires it.
[I did not witness the events first-hand, but it appears that LALR
grew strength from languages, like C, that were difficult if not
impossible to cast as LL grammars, while LL took root in the Pascal
languages for which LL was nearly ideal. (Or perhaps more correctly,
Wirth purposefully designed the language to make it amenable to LL
parsing.) I am sure someone with first-hand knowledge will correct me
if I am mistakened.]
Mark
--
Mark K. Gardner (mkgardne@cs.uiuc.edu)
University of Illinois at Urbana-Champaign
Real-Time Systems Laboratory
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.