15 Sep
2008
15 Sep
'08
2:23 a.m.
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 grammar. -- Greg