[Chicago] AST constructure

Daniel Uber djuber at gmail.com
Sun May 5 16:45:32 CEST 2013

Having never looked too deeply into this my answer might be wrong, but
the line right after the define you found is
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
                          col_offset, PyArena *arena);

So it looks like it's just an expr_ty. The relevant parts of the 
generator are
                 struct {
                         expr_ty elt;
                         asdl_seq *generators;
                 } GeneratorExp;
which is buried inside _expr definition.

At the top of the file expr_ty is pointer to struct _expr, which is 
basically a union type of all the possible expressions, plus an 
expr_kind flag to identify the contents.
In my copy of the header, that definition starts around line 187.

FWIW, I was looking through a 3.3.1 copy of the source tree, but it may 
be similar in 2.x

Daniel Uber

On 5/5/13 7:35 AM, shangyu wrote:
> Hi dear all,
> I'm reading Python source code and know there is a transition from CST 
> to AST . Python will call some kind of function which convert the CST 
> node to a AST node , for example , in function ast_for_itercomp there 
> is a call to GeneratorExp . The latter is a macro point to 
> _Py_GeneratorExp
> #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, 
> a3, a4)
> I can't go further more because I can't find out the difinition of 
> _Py_GeneratorExp ,
> so , where is the _Py_GeneratorExp ? Thanks in advance !
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20130505/c58f76f5/attachment.html>

More information about the Chicago mailing list