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

Jeremy Hylton jeremy@zope.com
Tue, 14 Aug 2001 11:29:01 -0400 (EDT)


>>>>> "TP" == Tim Peters <tim.one@home.com> writes:

  TP> Let me suggest you don't really want an AST -- you want an
  TP> object model for Python source that answers the questions above
  TP> directly.

Agreed.

  TP> directly.  An AST may be an effective (under the covers)
  TP> implementation technique to get such info, but if you don't want
  TP> to wait for people to argue about "the right" AST and "the
  TP> right" tree-based query language to make it better than
  TP> completely useless <wink>, you can answer all the stuff above by
  TP> building on tokenize.py now.

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.

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

Jeremy