[Compiler-sig] changes to ast

Jeremy Hylton jeremy@alum.mit.edu
Wed, 1 Nov 2000 15:11:19 -0500 (EST)


I made several checkins last week (or the week before), when SF did
not seem to be sending email with the log messages.  I thought I'd
update briefly and do a little hand-wringing about making changes
without consulting anyone.

The key change was to replace the hand-edited ast.py module with an
automatically generated one.  The astgen module uses ast.txt -- both
inside the compiler package -- to generate ast.py, which is still
under CVS control.  I think that's a relatively safe change.

I'm a little concerned about the interface changes I made to ast
nodes.  I eliminated the _children tuple that each node had and
eliminated the support for sequence access (node[0] to get type,
node[1] to get first child node, etc) and updated all the code
elsewhere to reflect that change.  

I also updated transformer to instantiate Node subclasses directly
instead of going through the Node function to call the appropriate
method.

These changes made the code faster and, I hope, clearer, but I wonder
how many people depended on the old sequence-style access protocol.
If its eliminate causes problems for anyone, let me know soon; it can
be restored if it's a serious issue for anyone.

Jeremy