Andrew Dunstan <andrew@dunslane.net> writes:
> On 2026-01-13 Tu 12:24 PM, Tom Lane wrote:
>> You'd have to throw out flex and bison and build some sort of
>> extensible parser. That has some attraction to me personally
>> (I worked on such systems decades ago at HP), but it's fairly
>> hard to justify the amount of effort that would be needed to
>> get there. It might well be slower than a flex/bison parser,
>> and/or have poorer detection of grammar inconsistencies, either
>> of which would be bad for our usage.
> Maybe, but maybe not. ISTR that gcc abandoned use of bison for their C
> compiler a long time ago, and that gnat's Ada compiler was hand cut from
> the get go.
> SQL is a different kettle of fish, of course - it dwarfs C and Ada in
> complexity.
Yeah. And we have additional problems besides the grammar being far
larger than it is for those projects:
* It's a moving target (to a much greater degree than C, anyway).
* A lot of our code is written by people who are not parser experts.
So it gives me great comfort that bison will complain if you hand it
an ambiguous or unsatisfiable grammar. If we went over to a
handwritten parser, I'd have next to no faith in it not being buggy.
There's good reasons why people put so much effort into parser
generators back in the day.
regards, tom lane