[Python-Dev] Catching "return" and "return expr" at compile time

Fred L. Drake, Jr. Fred L. Drake, Jr." <fdrake@acm.org
Wed, 8 Sep 1999 11:09:11 -0400 (EDT)


Skip Montanaro writes:
 > thing?  Ideally, I'd like to see a framework that brings the parser module's
 > output up to a level where mere mortals like me can reason about Python

  This was exactly what I wanted to prevent when I created the parser
module!  ;-)
  I think a wrapper that simplifies the parse tree wouldn't be too
hard to do; you simply have to be sure that the simplified version can 
be re-elaborated to pass back to the byte-code compiler via
parser.sequence2ast(<seq>).compile().  Otherwise you can't modify the
tree without loosing line number information, which would be nice to
keep around!


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives