[Python-Dev] Python syntax checker ?

Charles G Waldman cgw@fnal.gov
Mon, 25 Sep 2000 10:12:35 -0500 (CDT)

I think that as much as can be done with Python rather than using
external code like Antlr, the better.  Who cares if it is slow?  I
could imagine a 2-pass approach where the internal Python parser is
used to construct a parse tree which is then checked for certain
errors.  I wrote something like this to check for mismatched numbers
of '%' values and arguments in string-formatting operations (see
http://home.fnal.gov/~cgw/python/check_pct.html if you are

Only sections of code which cannot be parsed by Python's internal
parser would then need to be checked by the "stage 2" checker, which
could afford to give up speed for accuracy.  This is the part I think
should be done in Python... for all the reasons we like Python;
flexibility, maintainabilty, etc.