Re: Why are LR parsers faster than using if conditions

torbenm@diku.dk (Torben Ęgidius Mogensen)
9 Jun 2004 00:29:44 -0400

          From comp.compilers

Related articles
Why are LR parsers faster than using if conditions shripal.meghani@philips.com (2004-06-06)
Re: Why are LR parsers faster than using if conditions torbenm@diku.dk (2004-06-09)
Re: Why are LR parsers faster than using if conditions alexc@std.com (Alex Colvin) (2004-06-11)
Re: Why are LR parsers faster than using if conditions cdc@maxnet.co.nz (Carl Cerecke) (2004-06-15)
Re: Why are LR parsers faster than using if conditions cdc@maxnet.co.nz (Carl Cerecke) (2004-06-21)
Re: Why are LR parsers faster than using if conditions t.zielonka@zodiac.mimuw.edu.pl (Tomasz Zielonka) (2004-06-25)
Re: Why are LR parsers faster than using if conditions haberg@matematik.su.se (Hans Aberg) (2004-06-26)
Re: Why are LR parsers faster than using if conditions haberg@matematik.su.se (Hans Aberg) (2004-06-28)
[6 later articles]
| List of all articles for this month |

From: torbenm@diku.dk (Torben Ęgidius Mogensen)
Newsgroups: comp.compilers
Date: 9 Jun 2004 00:29:44 -0400
Organization: Department of Computer Science, University of Copenhagen
References: 04-06-012
Keywords: parse, LALR
Posted-Date: 09 Jun 2004 00:29:44 EDT

shripal.meghani@philips.com writes:


> Well intuitively I know that LR parsers are fast, they SHOULD be
> faster than using if then conditions etc. But I was hoping to get
> some more solid academic reasons to convince a group of people here at
> my organization...


Just describing the alternative as "using if-then conditions" doesn't
give us much to work on. Well-written parsers using if-then-else can
well be faster than LR parsers, but they can also be worse. It all
depends on how they are written.


LR parsers are a bit slower than well-written recursive descent
parsers, which is the most common systematic way of writing parsers by
hand. The main advantage of LR parsers are that they don't require as
much mangling (left-recursion removal, left factoring, etc.) of the
grammars as LL(1) parser (including recursive descent) do.


But hand-written parsers written in a non-systematic way may well be
slower than LR parsers.


Torben


Post a followup to this message

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