Skip to main content

Module parse

Module parse 

Source
Expand description

The Praxis parser.

Recursive descent over statements and structure, with a Pratt (precedence climbing) loop for arithmetic and the other binary operators (ADR-004). It consumes the lexer’s Token stream and emits a rowan green tree (ADR-003) via GreenNodeBuilder, retaining trivia so the tree is lossless (§13.1). On an unexpected token it emits a P0xx diagnostic, wraps the stray token in a SyntaxKind::PARSE_ERROR node, advances to a synchronization point, and keeps going — that is the LSP-grade recovery required by §15.2.

The grammar is §19: fn/struct/enum items, var bindings and assignment, blocks, if/while/for/loop/match, and expressions — literals, calls, closures, ranges, record and collection literals, patterns, and read’s parser expressions (§7.1).

Structs§

ParseOutput
The result of parsing one source file: the lossless tree, the lexed tokens, and any diagnostics (lex + parse merged).

Constants§

TYPE_CONSTRUCTOR_NAMES
The compiler-owned type constructors, the only names that take an explicit type-argument list in expression position (§3.3’s Counter[(Int, Int)]()).

Functions§

parse
Lex then parse text belonging to file.