Terry wrote:
> Are at least some of the implementation methods similar enough that they
> could use the same AST? It is, after all, a *semantic* translation into 
> another
> language, and that need not depend on subsequent transforation and
> compilation to the ultimate target. A multiple-implementation AST could still
> be x.y dependent.

For IronPython we have our own AST which is closely tied to the DLR ASTs (our
AST nodes are actually subclasses of the core DLR Expression node which then
"reduce" to the core DLR nodes on-demand).  We already do a huge amount of
manipulation of those ASTs from optimizations (constant folding being the 
primary
one) to re-writing them completely for things like generators or sys.settrace 
support and 
other optimizations like runtime optimized fast exception support.  But our 
ASTs are 
probably sufficiently different and sufficiently tied to the DLR that we 
couldn't 
share the exact same optimizations  on the ASTs but it would probably make it 
easier to steal ideas from CPython if you did them at the AST level as well.

They also have other differences such as the fact that they're effectively 
immutable.
Likely when we implement the _ast module it'll just transform our ASTs into the 
shared
ASTs via some additional attributes we attach to our ASTs rather than making 
them the
core AST implementation.



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to