[Python-ideas] Enabling access to the AST for Python code

Guido van Rossum guido at python.org
Sat Jun 13 11:09:17 CEST 2015

On Sat, Jun 13, 2015 at 1:39 AM, Mark Lawrence <breamoreboy at yahoo.co.uk>

> You might find this interesting https://github.com/Psycojoker/baron
> The introduction states "Baron is a Full Syntax Tree (FST) library for
> Python. By opposition to an AST which drops some syntax information in the
> process of its creation (like empty lines, comments, formatting), a FST
> keeps everything and guarantees the operation
> fst_to_code(code_to_fst(source_code)) == source_code.".

There's one like this in the stdlib too! It's in lib2to3 and even preserves
comments and whitespace. It's used as the basis for the 2to3 fixers.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150613/d41d0ac1/attachment.html>

More information about the Python-ideas mailing list