Re: Parser extensions (maybe for 10?) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Parser extensions (maybe for 10?)
Date
Msg-id 5688.1460437831@sss.pgh.pa.us
Whole thread Raw
In response to Parser extensions (maybe for 10?)  (Arcadiy Ivanov <arcadiy@gmail.com>)
Responses Re: Parser extensions (maybe for 10?)  (Craig Ringer <craig@2ndquadrant.com>)
Re: Parser extensions (maybe for 10?)  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Arcadiy Ivanov <arcadiy@gmail.com> writes:
> Is there any interest and/or tips to allow a pluggable parser or at 
> least allow some syntactical pluggability by extensions?

There is a fair amount of discussion of this in the archives.  The short
answer is that bison can't do it, and "let's replace bison" is a proposal
with a steep hill in front of it --- the pain-to-gain ratio is just not
very favorable.

Forty years ago, I worked on systems with extensible parsers at HP,
wherein plug-in extensions could add clauses very similarly to what
you suggest.  Those designs worked, more or less, but they had a lot
of deficiencies; the most fundamental problem being that any parsing
inconsistencies would only appear through misbehavior at runtime,
which you would only discover if you happened to test a case that behaved
oddly *and* notice that it was not giving the result you expected.
Bison is far from perfect on this angle, because %prec declarations can
produce results you weren't expecting ... but it's at least one order of
magnitude better than any extensible-parser solution I've ever seen.
Usually bison will give you a shift/reduce error if you write something
that has more than one possible interpretation.

I'm interested in possible solutions to this problem, but it's far
harder than it looks.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [COMMITTERS] pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.
Next
From: Craig Ringer
Date:
Subject: Re: Parser extensions (maybe for 10?)