There's also another way for more local debugging: print node.dump()
(see Node in Nodes.py). Practical for e.g. print self.dump() within node methods. Also the dumptree function in Main.py can be used in the same way as Stefan mentions but prints the tree in the dump()-format. this should probably be consolidated -- I implemented what Stefan talked about first, and then I found that I often wanted to simply print a small part of the tree and added another way... Dag Sverre Seljebotn -----Original Message----- From: "Stefan Behnel" <[email protected]> Date: Friday, Mar 6, 2009 11:55 am Subject: Re: [Cython] Best way to display parse tree To: [email protected]: [email protected] Hoyt Koepke wrote: > I'm trying to get into cython development > >You are very welcome. > > >> and I'm having difficulty > understanding the internals of the parse tree and how it works. Being > able to print or display the parse tree would really help in this > effort, as it's really tedious to work through the code trying to > figure this stuff out. What is the best way to see the parse tree of > a given pyx file / function / code block? Is there an easy way to do > it that I don't know about? > >Glad you asked. :) > >Yes, there is. Look into Main.py, there is a method called >create_pipeline(). It imports a class called PrintTree at the top and builds >the compiler pipeline at the end. If you throw an instance of that class into >the pipeline at any point, it will dump out the current tree for you. Note >that the output can be pretty long, so you may want to start with a short >example (such as one of the test cases). > >Stefan > >_______________________________________________ >Cython-dev mailing list >[email protected] >http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
