5 releases (breaking)
Uses new Rust 2024
| new 0.7.0-beta.1 | Mar 8, 2026 |
|---|---|
| 0.6.0-beta.1 | Mar 8, 2026 |
| 0.5.0-alpha.1 | Mar 7, 2026 |
| 0.4.0-alpha.1 | Mar 7, 2026 |
| 0.1.0 | Mar 7, 2026 |
#1449 in Programming languages
Used in 8 crates
79KB
1.5K
SLoC
intent-parser
PEG parser and typed AST for the IntentLang specification language.
Part of the IntentLang toolchain — a declarative specification language for human-AI collaboration.
What it does
Parses .intent files into a typed AST with source spans on every node. The grammar is defined as a PEG using pest.
Supports the full IntentLang syntax: modules, entities (with union and collection types), actions (requires/ensures/properties), invariants (with quantifiers), and edge cases.
Usage
use intent_parser::{parse_file, Module};
let source = r#"
module Example
entity User {
name: String
email: Email
}
"#;
let module: Module = parse_file(source)?;
assert_eq!(module.name, "Example");
assert_eq!(module.entities[0].name, "User");
Public API
| Export | Description |
|---|---|
parse_file(src) -> Result<Module> |
Parse .intent source into a typed AST |
Module, Entity, Action, Invariant, ... |
AST node types with source spans |
ParseError |
Error type with source location info |
Part of IntentLang
This crate is the parser layer. Other crates in the workspace:
- intent-check — Semantic analysis and type checking
- intent-render — Markdown and HTML rendering
- intent-ir — Agent IR lowering, verification, and audit
- intent-cli — CLI binary (
intent check,intent verify, etc.)
Dependencies
~9MB
~176K SLoC