Hi, I believe the parser module <https://docs.python.org/3/library/parser.html> allows for generation of a CST, though the documentation is not specific about the type of syntax tree used. The old compiler module <https://docs.python.org/2/library/compiler.html> utilized it for this purpose and contains explicit documentation about getting a CST from the parser module.
-- EMV On Sat, Aug 26, 2017 at 1:53 AM, yang chen <shanchua...@gmail.com> wrote: > Hello, everyone. > > > I'm learning python source code, I used to print info when I debug code, > but it's not convenient. I want to print CST, AST, ByteCode with iPython, > wirte some code, then print it's CST、AST、 BYTECODE, and then to read the > source code. > > But, I can't dump the CST tree which will transform to AST, I know I can > print CST tree by modifying python source code, but how to dump the CST > tree in iPython just like dumping AST with ast package. > > 1. get AST with ast package2. get ByteCode with dis package > > 3. but how get cst?? > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ > emilyemorehouse%40gmail.com > >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com