Do you mean instead of an AST? I find the syntax tree better for non-compiler applications like translators.
Do you mean instead of an AST? I find the syntax tree better for non-compiler applications like translators.
http://www.oilshell.org/blog/2017/02/11.html
I researched "production" implementations, and found that they use something like a Lossless Syntax Tree (not an AST or CST):
https://github.com/oilshell/oil/wiki/Lossless-Syntax-Tree-Pa...
Examples: Clang, Microsoft's Roslyn platforms, RedBaron/lib2to3 for Python, scalameta, and Go. The defining property of the LST is that it can be round-tripped back to the source. This is called out in this C# design doc, along with some conventions for associating whitespace with syntax tree nodes:
https://github.com/dotnet/roslyn/wiki/Roslyn-Overview
What do you think of that claim? (If you prefer not to use this deep comment thread, feel free to contact me by e-mail instead at andychup@gmail.com.)