From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Arcadiy Ivanov <arcadiy(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Parser extensions (maybe for 10?) |
Date: | 2016-04-12 07:13:55 |
Message-ID: | CAMsr+YFKBX+gJVSJc4+s+MMFfpWf4HW+-UPpPtk7ahFea3whzA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12 April 2016 at 13:51, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> > The other area where there's room for extension without throwing out the
> > whole thing and rebuilding is handling of new top-level statements. We
> can
> > probably dispatch the statement text to a sub-parser provided by an
> > extension that registers interest in that statement name when we attempt
> to
> > parse it and fail. Even then I'm pretty sure it won't be possible to do
> so
> > while still allowing multi-statements. I wish we didn't support
> > multi-statements, but we're fairly stuck with them.
>
> Well, as I said, I've been there and done that. Things get sticky
> when you notice that those "new top-level statements" would like to
> contain sub-clauses (e.g. arithmetic expressions) that should be defined
> by the core grammar. And maybe the extension would also like to
> define additions to the expression grammar, requiring a recursive
> callback into the extension. It gets very messy very fast.
>
Yuck. You'd ping-pong between two parsers, and have to try to exchange
sensible starting states. Point taken.
So even that seemingly not-that-bad restricted option turns out to be far
from it, which just goes to show what a pit of snakes parser extensibility
is...
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2016-04-12 07:19:46 | Re: Move PinBuffer and UnpinBuffer to atomics |
Previous Message | Amit Langote | 2016-04-12 07:03:41 | Update copyright in genericdesc.c |