Add simple script to check for right recursion in Bison grammars.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 756a4ed5ad3e57c26a247234de371a6ca21806cd
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-10-27T17:50:57Z
Releases: 9.2.0
Add simple script to check for right recursion in Bison grammars.

We should generally use left-recursion not right-recursion to parse lists.
Bison hasn't got any built-in way to check for this type of inefficiency,
and I didn't find anything on the net in a quick search, so I wrote a
little Perl script to do it.  Add to src/tools/ so we don't have to
re-invent this wheel next time we wonder if we're doing anything stupid.

Currently, the only place that seems to need fixing is plpgsql's stmt_else
production, so the problem doesn't appear to be common enough to warrant
trying to include such a test in our standard build process.  If we did
want to do that, we'd need a way to ignore some false positives, such as
a_expr := '-' a_expr

Files

PathChange+/−
src/tools/check_bison_recursion.pl added +74 −0