Subject Re: [Firebird-Architect] Gpre & the SQL parser
Author Jim Starkey
Stephen Boyd wrote:
> I have been wondering recently about the possibility of having a
> common SQL parser for the Firebird engine and GPRE. Over time the SQL
> supported by the engine and that supported by GPRE have been
> diverging. I have made a few small efforts to hack support for the
> features that I need into GPRE but GPRE is difficult to maintain (at
> least for me) and it seems silly to have two distinctly different SQL
> parsers for the same product anyway.
>
> Has anyone else given this any thought? What would be involved in
> doing something like this?
>
> It would be nice if keeping GPRE in sync with the rest of the product
> were made easier.
>
>
>
That's an idea that has come up over and over and over again. It's a
bad idea, a very bad idea.

Both parse SQL, and there the similarity ends. The dialects are
necessarily different. The GPRE parser has to deal with host language
expressions that the DSQL parser doesn't. They have different error
handling. They generate different data structures. The GPRE parser
also handles GDML, which the DSQL parser does not.

GPRE uses a hard coded, recursive descent parse. DSQL uses yacc/bison.
It would be better, far better, if DSQL also used a hard coded recursive
descent parser, but that's a different issue.

Parsing is a trivial operation. It is far better to have a parser well
integrated into the environment that it serves than to try and force a
single parser into radically different environments.


--
James Starkey, Senior Software Architect
MySQL Inc., Manchester, MA, USA, www.mysql.com
Office: 978 526-1376