On 10/21/05, Neil Schemenauer <[EMAIL PROTECTED]> wrote:
> Also, the concrete syntax tree (CST) generated by Python's parser is
> not a convenient data structure to deal with. Anyone who's used the
> 'parser' module probably experienced the pain:
>
>     >>> parser.ast2list(parser.suite('a = 1'))
>     [257, [266, [267, [268, [269, [320, [298, [299, [300, [301,
>     [303, [304, [305, [306, [307, [308, [309, [310, [311, [1,
>     'a']]]]]]]]]]]]]]], [22, '='], [320, [298, [299, [300, [301, [303,
>     [304, [305, [306, [307, [308, [309, [310, [311, [2,
>     '1']]]]]]]]]]]]]]]]], [4, '']]], [0, '']]

That's the fault of the 'parser' extension module though, and this
affects tools using the parser module, not the bytecode compiler
itself. The CST exposed to C programmers is slightly higher level.
(But the new AST is higher level still, of course.)

BTW, Elemental is letting me open-source a reimplementation of pgen in
Python. This also includes a nifty way to generate ASTs. This should
become available within a few weeks.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to