Re: Hand written parsers

From: Mark Butler <butlerm(at)middle(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hand written parsers
Date: 2001-04-12 04:37:56
Message-ID: 3AD53124.D0923FAC@middle.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:

> Interesting. What advantages would there be?

As any one who has ever attempted to build a C++ parser using Yacc or Bison
can attest, it is very difficult to get an LALR based parser to correctly
parse a sophisticated grammar. The advantages of using a hand written
recursive descent parser lie in four areas:

1) ease of implementing grammar changes
2) ease of debugging
3) ability to handle unusual cases
4) ability to support context sensitive grammars

Context sensitivity is useful for handling things like embedded programming
languages without having to escape whole procedures as string literals, for
example. We could support procedural language plugins without the current
limitations on syntax.

Another nice capability is the ability to enable and disable grammar rules at
run time - you could add run time options to disable all non SQL-92 grammar
rules for application portability testing or emulate Oracle's outer join
syntax, as a couple of examples.

- Mark Butler

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Lance Taylor 2001-04-12 05:44:59 Re: Re: Hand written parsers
Previous Message Bruce Momjian 2001-04-12 03:30:51 Re: Yacc / Bison difficulties