More jython progress.
Finn Bock <[email protected]> Thu, 23 May 2002 14:07:44 +0200
| Newsgroups | gmane.comp.python.compiler |
|---|---|
| Message-ID | <[email protected]> |
Hi, I now got a version of jythonc running with the new AST. As always jythonc (the java sourcecode generator) is about twice as complicated as the java bytecode generator. Sigh. In jythonc, Jim Hugunin had added an additional abstraction layer on top of the anonymous SimpleNode ast tree that jython have used so far. With the new AST we no longer need the abstraction layer. Without that layer the code in jythonc became (IMO) a lot simpler and easier to follow. The new AST also means that the codegen in our two generators are far more similar than before. A huge win because we always have to implement new language features in both generators. IOW I'm very happy with the new AST and with the use of asdl as a way of describing the AST. Good work Jeremy. Since jythonc is written in python I would like to work towards an agreement on what the public python API to the AST should be like. What package/module should contain the AST node classes? 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. Should the compiler package have a public API to such scope analyzer? Similar we have future analyzer. Should we define a public API to this? 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'). Each field in a constructor is obviously a class instance attribute. 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__). 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. Are these restrictions unacceptabe for the potential users of the AST tree? I would like to reach some type of agreement soon. regards, finn