Overview of different AST designs
TODO:
https://github.com/davidhalter/parso
ASTs
RustPython
- Line/column indices
- No means to navigate a tree upwards
- Only supports valid programs
- No access to trivia
TypeScript
- Successfully parses invalid programs
- synthesises missing nodes (
var a =
crates an empty identifier for the initializer)
- Gives access to leading/trailing node trivia → AST design influences the granularity at which trivia can be queried. There seems to be no way to query trivia in the middle of a node
- It seems that TypeScript creates an emit node in refactors that differs from a parsed node (e.g. comments are stored on the node)
- Stores (byte) ranges on the node
Oxc
GitHub - web-infra-dev/oxc: The JavaScript Oxidation Compiler
Swc
Dart