[Python-Dev] Python syntax checker ?

Greg Ward gward@mems-exchange.org
Mon, 25 Sep 2000 11:07:53 -0400


On 25 September 2000, Neil Schemenauer said:
> How different are PCCTS and ANTLR?  Perhaps we could use PCCTS for
> CPython and ANTLR for JPython.

I can't speak from experience; I've only looked briefly at ANTLR.  But
it looks like they are as different as two LL(k) parser generators
written by the same guy can be.  Ie. same general philosophy, but not
much similar apart from that.

Also, to be blunt, the C back-end PCCTS 1.x has a lot of serious
problems.  It's heavily dependent on global variables, so goodbye to a
thread-safe lexer/parser.  It uses boatloads of tricky macros, which
makes debugging the lexer a bear.  It's well-nigh impossible to remember
which macros are defined in which .c files, which functions are defined
in which .h files, and so forth.  (No really! it's like that!)

I think it would be much healthier to take the sound OO thinking that
went into the original C++ back-end for PCCTS 1.x, and that evolved
further with the Java and C++ back-ends for ANTLR 2.x, and do the same
sort of stuff in C.  Writing good solid code in C isn't impossible, it's
just tricky.  And the code generated by PCCTS 1.x is *not* good solid C
code (IMHO).

        Greg