shrew_ir/lib.rs
1//! # shrew-ir
2//!
3//! Parser, AST, and IR for the `.sw` (Shrew) declarative model format.
4//!
5//! This crate handles the full `.sw` pipeline:
6//
7// .sw source text ──► Lexer ──► Tokens ──► Parser ──► AST ──► Lowering ──► Graph IR
8//
9// The AST is a faithful, unvalidated representation of the .sw file.
10// The Graph IR is a validated DAG representation ready for optimization
11// and execution scheduling.
12//
13// USAGE:
14// // Parse and lower a .sw file:
15// let ast = shrew_ir::parse(source_text)?;
16// let ir = shrew_ir::lower(&ast)?;
17//
18// // Inspect the IR:
19// for graph in &ir.graphs {
20// println!("{}", graph.dump());
21// }
22
23pub mod ast;
24pub mod error;
25pub mod graph;
26pub mod lexer;
27pub mod lower;
28pub mod optimize;
29pub mod parser;
30pub mod shapes;
31pub mod token;
32pub mod validate;
33
34pub use ast::Program;
35pub use error::{Error, Result};
36pub use graph::IrProgram;
37pub use lower::lower;
38pub use optimize::optimize;
39pub use parser::parse;
40pub use shapes::infer_shapes;
41pub use validate::validate;