Thomas Lockhart <lockhart@fourpalms.org> writes:
>> BTW, another thing in the back of my mind is that we should try to
>> figure out some way to unify ecpg's SQL grammar with the backend's.
>> Maintaining that thing is an even bigger headache than getting the
>> backend's own parser right.
> That would be nice. Unfortunately that would lead to the main parser
> having the same machinations used in ecpg, with separate subroutine
> calls for *every* production. Yuck.
The thing is that most of the actions in ecpg's grammar could easily be
generated mechanically. My half-baked idea here is some sort of script
that would take the backend grammar, strip out the backend's actions and
replace 'em with mechanically-generated actions that reconstruct the
query string, and finally merge with a small set of hand-maintained
rules that reflect ecpg's distinctive features.
You're quite right that nothing like this will reduce the amount that
maintainers have to know. But I think it could reduce the amount of
tedious, purely mechanical, and error-prone maintenance work that we
have to do to keep various files and lists in sync.
regards, tom lane