How JetBrains Cross-Validation works
mainThe project uses cross-validation to compare the tree-sitter-kotlin parse trees against the official JetBrains Kotlin compiler's PSI reference parser. This ensures the grammar accurately reproduces the official AST structure.
The process involves:
- Vendoring: Fetching JetBrains PSI test fixtures (
.ktsource +.txtexpected PSI tree) at a pinned commit. - Corpus Generation: Parsing these files with tree-sitter; files that parse cleanly (and aren't in
excluded.txt) become corpus tests. - Structural Comparison: Comparing tree-sitter output against JetBrains' expected PSI tree using 110+ node type mappings.
- Issue Tracking: Files that produce incorrect ASTs are tracked in
tools/cross-validation/excluded.txtand categorized intools/cross-validation/TODO.md.