Martin C. Martin wrote:
> Ok, thanks a lot.
>
> My day job is programming Lisp, and since I started two years ago, 
> I've seen the light about a number of things, including macros.  It 
> would be cool to have access to the Abstract Syntax Tree of a Cython 
> expression/statement/function/etc., and be able to manipulate it at 
> compile time.  But it sounds like that's a whole other project.  :)
Hmm. I'm still not sure whether I've come across right :-)

Accessing the abstract syntax tree is exactly what this is about, and 
you can do that (however the syntax for doing would seem rather complex 
and messy compared to with LISP, though a lot better I believe than what 
has been going on until now).

The problem is that the code that accesses the syntax tree has to be 
written in Python and inserted into the compiler at launch time -- you 
cannot analyse yourself. In Python syntax, it is possible to do 
something remotely similar to:

part-of-project.py:
  def myfunc(...): ...

part-of-compiler.py:
  def modify_syntax_tree(tree):
    ...

  modify_syntax_tree(myfunc)


However, you can NOT do

modify_syntax_tree(modify_syntax_tree)

or anything like that, which is why I believe it doesn't compare with LISP.

Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to