Re: [Python-Dev] AST Optimization: Branch Elimination in Generator Functions

2008-05-06 Thread Jeremy Hylton
I'm not sure I understand the problem exactly. If we have one pass converting the concrete syntax to the AST, we can mark functions as generators as part of that pass. In a later pass, you can remove the unreachable code. Jeremy On Sat, May 3, 2008 at 12:51 AM, Thomas Lee <[EMAIL PROTECTED]> wr

[Python-Dev] AST Optimization: Branch Elimination in Generator Functions

2008-05-02 Thread Thomas Lee
The next problem that cropped up during the implementation of the AST code optimizer is related to branch elimination and the elimination of any code after a return. Within a FunctionDef node, we would (ideally) like to blow away If nodes with a constant - but false - test expression. e.g.:

[Python-Dev] AST Optimization: Branch Elimination in Generator Functions

2008-05-02 Thread Thomas Lee
The next problem that cropped up during the implementation of the AST code optimizer is related to branch elimination and the elimination of any code after a return. Within a FunctionDef node, we would (ideally) like to blow away If nodes with a constant - but false - test expression. e.g.: