[Compiler-sig] More jython progress.

Eric C. Newton ecn@metaslash.com
Thu, 23 May 2002 09:25:51 -0400


> What package/module should contain the AST node classes?

> What should be the public names of the AST node classes? I have used
> the name of the Constructors directly but I had to change the name
> of the 'except' production (to 'excepthandler').

Doesn't matter to me.

> In jython we have a scope analyzer that analyze a module and return
> symboltables for module, class and function levels. I guess CPython must
> also have some such thing.

The python version of the compiler has such a pass: compiler.symbols

> Should the compiler package have a public API to such scope
> analyzer?

That would be helpful.

> Similar we have future analyzer. Should we define a public API to this?

What does the future analyzer do?

> Each asdl constructor becomes a java class. That means new
> attributes can't be added dynamicly. A strong limitation compared to
> a python class instance. It also means that the __XXX__ attributes
> can't be changed or depended on (such as __class__ and __name__).

As long as isinstance() works, I can live with that.  Right now the
__class__ name is used for the generic visit() implementation, but
that can be changed.

> The sequences in the asdl becomes java arrays. That means that the 
> elements in a sequence can be changed but the length of the sequence 
> can't. I think we should ban all attempts to modify the sequences.

I'm modifying the tree structure in only one case in PyChecker2, and I
think I can live without it.

I'm adding attributes to the tree _everywhere_.  As PyChecker2 grinds
over the tree, it adds discovered information to the tree (things like
type information and cross-references).  I can probably live without
it by tracking the information somewhere else.

-Eric