[Python-Dev] Python syntax checker ?

Michael Hudson mwh21@cam.ac.uk
Tue, 26 Sep 2000 13:15:26 +0100 (BST)


On Tue, 26 Sep 2000, Greg Ewing wrote:

> Guido:
> 
> > MAL originally asked for a
> > parser that doesn't stop at the first error.  That's a real weakness
> > of the existing parser!!!
> 
> Is it really worth putting a lot of effort into this?

It might be if you were trying to develop an IDE that could syntactically
analyse what the user was typing even if he/she had left a half finished
expression further up in the buffer (I'd kind of assumed this was the
goal).  So you're not continuing after errors, exactly, more like
unfinishednesses (or some better word...).

I guess one approach to this would be to divided up the buffer according
to indentation and then parse each block as delimited by the indentation
individually.

Two random points:

1) Triple-quoted strings are going to be a problem.
2) Has anyone gotten flex to tokenize Python?  I was looking at the manual
   yesterday and it didn't look impossible, although a bit tricky.

Cheers,
M.