[Python-ideas] Statements vs Expressions... why?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Sep 15 04:23:41 CEST 2008

Leonardo Santagada wrote:

> The only clean way to support DSL in python in my view would be to  
> support something like pyparsing or ANTLR and make it generate a  parser 
> and some simple form of compilation to python bytecodes. How  can we 
> support that? Is this even desired?

The way to go is probably to have the parser build an AST.
That way you get to reuse the compiler machinery for generating
bytecode, without having to worry about the messy details
of generating textual Python source.

If the DSL->AST transformation is sufficiently context-free,
it could probably be specified using some kind of declarative


More information about the Python-ideas mailing list