7 releases (4 breaking)

Uses new Rust 2024

new 0.5.2 Mar 25, 2026
0.5.1 Mar 17, 2026
0.5.0 Dec 4, 2025
0.4.0 Nov 24, 2025
0.1.0 Nov 8, 2025

#1920 in Parser implementations

Download history 6/week @ 2025-12-04 70/week @ 2026-01-22 23/week @ 2026-01-29 55/week @ 2026-02-05 2/week @ 2026-02-26 29/week @ 2026-03-05 23/week @ 2026-03-12

54 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

320KB
8K SLoC

Mortar Compiler

license Crates.io Documentation codecov

mortar_logo

Mortar Compiler is the core compilation library for the Mortar language. It provides lexing, parsing, and code generation functionality for Mortar files.

Features

  • High-performance Lexer: Tokenization using the logos crate
  • Robust Parser: Complete token parsing with chumsky
  • AST Generation: Complete Abstract Syntax Tree definition
  • Error Reporting: Friendly error messages using ariadne
  • JSON Output: Standardized compilation output format

Usage as Library

use mortar_compiler::{compile, CompileOptions};

let source = r#"
node Start {
    text: "Hello, world!"
} -> End
"#;

let result = compile(source, CompileOptions::default())?;
println!("{}", result.json);

Architecture

  • Lexical analysis with logos
  • Parsing with chumsky parser combinators
  • Error handling with ariadne
  • JSON serialization with serde

Dependencies

Crate Version Description
ariadne * Diagnostic error reporting
chumsky * Parser combinators
logos * High-performance lexer
owo-colors * Terminal color output
serde * Serialization framework
serde_json * JSON serialization/deserialization
chrono * Date and time utilities

Dev Dependencies

Crate Version Description
tempfile 3.25 Temporary file management for tests
proptest 1.6 Property-based / fuzz testing
arbitrary 1.4 Structured fuzzing data generation

License

Mortar Compiler uses a dual-license model:

  • MIT License: Allows free use, modification, and distribution
  • Apache License 2.0: Distributed under Apache 2.0

You can choose either license according to your needs.

Dependencies

~5–17MB
~164K SLoC