On May 29, 2008, at 7:10 PM, rahul garg wrote:
> I was looking around inside Cython. I am not very clear what Cython  
> does internally. Some questions :
>
> a) Which parser is used? I use Python 2.5's compiler module and  
> then dump ASTs into a file which is then read back in Java.
>
It comes with its own custom parser.
> b) Cython does not construct ASTs Parse trees are used as the  
> internal representation and Cython appears to be generating code  
> directly from parse trees currently. Is this correct? I also see  
> that there are proposals to add ASTs , construct control flow graph  
> as well as for an explicit symbol table.
>
That is correct, though the resulting tree is not strictly the parse  
tree--the parser does some analysis, many of the leaf nodes (e.g.  
decelerator nodes) get recorded as node attributes, and there is the  
possibility of tree transformations.

> c) When is type checking done?

I am not sure what you mean by this. On conversion (e.g. from a  
Python object to a c int) code is emitted that does runtime type  
checking.

> d) Does Cython have well defined compiler passes?

Yes. See the extensive comments at the top of Nodes.py and ExprNodes.py.

- Robert

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

Reply via email to