[Python-Dev] SoC AST generation question
parlar at gmail.com
Tue Mar 20 15:35:43 CET 2007
On 3/20/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Notice that there are really two separate AST projects listed: one
> is to improve usage of the AST compiler, by, say, adding more passes
> to it, or allowing round-tripping from the Python representation.
> The other one is to generate ast.c, which currently is hand-written,
> but could probably be generated automatically. This would not improve
> any end-user features, but would improve the maintainability, as
> currently, changing the AST is tedious as you have to change so
> much other stuff as well.
Part of my desired PhD research goals are in the creation of tools
that aid in the development of correct software, so a tool that
improves maintainability fits perfectly.
> If you want to focus on the "automated code generation" aspect, pick
> the generation of ast.c. Generating C code from a "domain-specific
> model" is a must-know of the compiler engineer. If you want to focus
> on "embedded systems", manipulating on the ast level may be closer
> as you will see how "backend" processing works (which you often
> find important when generating code for a specific target system).
The code generator I mentioned in my first post created C code from a
DSL. I learned a good deal on that, but because I was generating code
for a platform I was already an "expert" in, I didn't really develop
many "general" code generation strategies or techniques. Because I'm
not an expert on Python's ast.c, my hope is that along the way to
creating the tool, I'll be able to learn or develop more general
strategies. But maybe that's a crazy thought :)
More information about the Python-Dev