<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 13, 2015 at 1:39 AM, Mark Lawrence <span dir="ltr"><<a href="mailto:breamoreboy@yahoo.co.uk" target="_blank">breamoreboy@yahoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
You might find this interesting <a href="https://github.com/Psycojoker/baron" rel="noreferrer" target="_blank">https://github.com/Psycojoker/baron</a><br>
<br>
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.".<span class="HOEnZb"><font color="#888888"></font></span><br></blockquote></div><br></div><div class="gmail_extra">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.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>