Why don't we store the syntax tree instead of the source code?
- by Calmarius
We have a lot of programming languages. Every language is parsed and syntax checked before translated into code so an abstract syntax tree is built.
We have this abstract syntax tree, why don't we store this syntax tree instead of the source code (or next to the source code)?
By using an AST instead of the source code. Every programmer in a team can serialize this tree to any language, they want (with the appropriate context free grammar) and parse back to AST when they finished. So this would eliminate the debate about the coding style questions (where to put the { and }, where to put whitespace, indentation, etc.)
What are the pros and cons of this approach?