[Docstring-develop] RE: [Python-Dev] AST mining (was Re: Direction of PyChecker)

Tony J Ibbs (Tibs) tony@lsl.co.uk
Tue, 14 Aug 2001 16:56:12 +0100


Jeremy Hylton wrote:
> I wouldn't wait for people to argue about the right AST either.  Use
> the one Greg and Bill came up with for p2c.  It's in Tools/compiler in
> the Python distribution.  It's much simpler than the parse tree
> produced by the parser module.  And, as far as I know, no one is
> advocating a different AST.

Indeed, it was the one I used for my stpy.py "testbed" earlier this year
(this had code that trivially found docstrings for a module and its
classes and functions/methods, and presented them (albeit not very
prettily) in HTML as such. The code to use compiler was *very* simple,
at this level.

It even works under 1.5.2 (with, I think, two lines commented out). As I
remember, it wasn't terribly fast, but who cares...

It also lacked documentation, but that just means some more staring at
code (and maybe the parser documentation) to work out what to expect.

> It doesn't have a query language, but neither does tokenize.py <wink>.

Hmm - for the purposes we're after, any "query" is purely theoretical, I
think (i.e., in the sense that *everything* done on a datastructure
might be considered a query). At least for the moment.

Tibs

--
Tony J Ibbs (Tibs)      http://www.tibsnjoan.co.uk/
"How fleeting are all human passions compared with the massive
continuity of ducks." - Dorothy L. Sayers, "Gaudy Night"
My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.)