brik64_bir/lib.rs
1//! # brik64-bir
2//!
3//! Embeddable BRIK-64 BIR (BRIK Intermediate Representation) bytecode runtime.
4//!
5//! BIR is the portable bytecode format produced by the `brikc` compiler.
6//! This crate lets you load and execute BIR programs from any Rust project
7//! without needing the full compiler toolchain.
8//!
9//! ## Format
10//!
11//! BIR is a line-based text format. Each line is one instruction:
12//!
13//! ```text
14//! FUNCTION fn::main [] -> i64
15//! CONST $0 42
16//! RETURN $0
17//! END
18//! ```
19//!
20//! ## Usage
21//!
22//! ```rust,no_run
23//! use brik64_bir::{BirModule, BirInterpreter};
24//!
25//! let bir_source = std::fs::read_to_string("program.bir").unwrap();
26//! let module = BirModule::parse(&bir_source).unwrap();
27//! let mut interp = BirInterpreter::new(module);
28//! let exit_code = interp.run("fn::main", &[]).unwrap();
29//! println!("Exit code: {}", exit_code);
30//! ```
31
32#![forbid(unsafe_code)]
33#![warn(missing_docs, clippy::all)]
34
35pub mod interpreter;
36pub mod module;
37pub mod value;
38
39pub use interpreter::BirInterpreter;
40pub use module::BirModule;
41pub use value::Value;