[Python-Dev] A Hygienic Macro System in Python?

Neil Schemenauer nas@python.ca
Mon, 18 Mar 2002 14:21:02 -0800


Samuele Pedroni wrote:
> Maybe an approach with an higher entry cost, such as opening up for
> extension the parser-compiler would be more pythonic.

I'm hoping that when Jeremy redesigns the compiler we will have
something better to work with.  I'm thinking on the fly here so
hopefully this makes some sense.  The parser module should return a nice
AST data structure.  We should be able to hook into that parser and make
it parse certain things specially.  This parser module would be similar
to the readtable in Common Lisp.  Alternately, we should be able to have
different parsers that return a same type of AST.  Next, we should able
to optionally perform transforms on the AST before it is feed to the
code generator.  These transforms could be implemented in pure Python.
This would be analogous to macros in CL.

  Neil