On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote:
> A quick question about how python parses a file into compiled
> bytecode. Does it parse the whole file into AST first and then compile
> the AST, or does it build and compile the AST on the fly as it reads
> expressions? (If the former case, why can't functions be called before
> their definitions?)
>
> Thanks,
> Jordan

Python uses a highly optimized table based LL(1) parser to create a
syntax tree. In Python 2.5 it transforms the concrete syntax tree
( CST ) into an AST before compilation. Before that it compiled the
CST directly. I'm not sure what you are asking for ( in parentheses )?
Parser actions or preprocessing the tree? The latter is definitely
possible and you can build your own compilation machinery using the
parser module and the compile function.

Kay
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to