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 ;
let source = r#"
module Example
entity User {
name: String
email: Email
}
"#;
let module: Module = parse_file?;
assert_eq!;
assert_eq!;
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.)