Skip to main content

Crate airl_ir

Crate airl_ir 

Source
Expand description

AIRL IR - Core intermediate representation data structures.

This crate defines the typed IR used throughout the AIRL system. The IR is designed to be serialized to/from JSON, making it easy for AI agents to generate and manipulate.

§Example

use airl_ir::Module;

let json = r#"{
    "format_version":"0.1.0",
    "module":{"id":"m","name":"main",
        "metadata":{"version":"1","description":"","author":"","created_at":""},
        "imports":[],"exports":[],"types":[],
        "functions":[]}
}"#;
let module: Module = serde_json::from_str(json).unwrap();
assert_eq!(module.name(), "main");

§Module organization

  • node — expression and statement nodes (16 variants)
  • types — the type system
  • effects — the effect system
  • module — top-level module, function, and parameter definitions
  • ids — strongly-typed identifiers
  • version — content-addressable module versions
  • graph — high-level graph container with validation
  • display — pretty-printing for debugging
  • symbol — symbol interning helpers

Re-exports§

pub use effects::Effect;
pub use graph::IRGraph;
pub use graph::IRGraphError;
pub use ids::FuncId;
pub use ids::ModuleId;
pub use ids::NodeId;
pub use ids::Symbol;
pub use ids::TypeId;
pub use module::Export;
pub use module::FuncDef;
pub use module::Import;
pub use module::Module;
pub use module::ModuleInner;
pub use module::ModuleMetadata;
pub use module::ParamDef;
pub use module::TypeDef;
pub use node::BinOpKind;
pub use node::LiteralValue;
pub use node::MatchArm;
pub use node::Node;
pub use node::Pattern;
pub use node::UnaryOpKind;
pub use types::Type;
pub use types::Variant;
pub use version::VersionId;

Modules§

display
Pretty-printers and Display impls for IR nodes. Debug display implementations for key IR types.
effects
Effect system: Pure, IO, Fail, Read, Write, Allocate, Diverge.
graph
High-level IR graph container with JSON (de)serialization.
ids
Strongly-typed identifiers: NodeId, FuncId, ModuleId, TypeId, Symbol.
module
Top-level module structure: Module, FuncDef, ParamDef, imports, exports.
node
Core IR node types (expressions, statements, control flow, patterns).
symbol
Lightweight symbol (string) wrapper used for names and identifiers.
types
The AIRL type system: primitives, arrays, tuples, structs, enums, generics.
version
Content-addressable versioning for modules (SHA-256 based).