Skip to main content

Module parser

Module parser 

Source
Expand description

Tree-sitter CST parser integration.

Following LASTMERGE (Duarte, Borba, Cavalcanti — 2025), we parse source code into concrete syntax trees using Tree-sitter. Unlike abstract syntax trees, CSTs preserve all syntactic elements (whitespace, punctuation, comments), enabling faithful source reconstruction.

The parser maps Tree-sitter’s node representation into our CstNode types, classifying nodes as Leaf (terminal), Constructed (fixed-arity non-terminal), or List (variable-length non-terminal with ordering semantics).

Enums§

ParseError

Functions§

parse_to_cst
Parse source code into a CstNode tree using tree-sitter.
reset_ids
Reset the ID counter (for testing determinism).