maat_parser 0.12.2

Combinator-based parser for the Maat programming language
Documentation

maat_parser

Combinator-based parser for the Maat programming language.

Role

maat_parser transforms the token stream produced by maat_lexer into a typed Program AST. It uses winnow combinators for statement dispatch with two-token lookahead and a manual Pratt loop for operator-precedence expression parsing. Parse errors are collected rather than aborting, enabling multi-error reporting in a single pass.

Usage

use maat_lexer::MaatLexer;
use maat_parser::MaatParser;

let source = "fn add(a: i64, b: i64) -> i64 { a + b }";
let lexer  = MaatLexer::new(source);
let mut parser = MaatParser::new(lexer);
let program = parser.parse();

if parser.errors().is_empty() {
    println!("parsed {} statement(s)", program.statements.len());
} else {
    for err in parser.errors() {
        eprintln!("{err}");
    }
}

API Docs

docs.rs/maat_parser

Repository

github.com/maatlabs/maat. See the project README for an overview of the full compiler pipeline.