2 Jun 03:49
Re: Jython internals : AST?
Frank Wierzbicki <fwierzbicki <at> gmail.com>
2008-06-02 01:49:10 GMT
2008-06-02 01:49:10 GMT
On Fri, May 30, 2008 at 7:11 PM, rahul garg <whycode <at> gmail.com> wrote: > Hi. > I am not sure whether this message belongs here or in jython-dev but anyway > here it goes : > > I am writing a Python-to-C compiler. The project is called unpython and is > located here http://www.cs.ualberta.ca/~garg1/unpython/ > I am writing it in Java. For the frontend, I am currently using CPython's > compiler module, dumping the AST into a file, then reading it back in Java. > I was recommended to see if I can reuse portions of Jython instead. So my > questions are : > a) Where should I look in Jython ? The asm branch uses this parser: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm > b) I believe an ANTLR based frontend was being worked upon. Is it working > and in Jython already? You can find the grammars here: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm/grammar > c) What kind of data structure is returned by Jython "frontend"? How > similar/dissimilar are these to the ASTs returned by compiler module of > cpython 2.5? The Jython frontend produces nodes that are generated from a version of the Python asdl mechanism. See here for that stuff: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm/ast or see the generated files here: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm/src/org/python/antlr/ast(Continue reading)
RSS Feed