1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Experimental Lehit language frontend and embeddable Cranelift JIT runtime.
//!
//! # Quick start
//!
//! Checked execution is the recommended host-facing mode because instrumented
//! runtime failures are returned as structured errors instead of backend traps.
//!
//! ```
//! use lehit::runtime::{ExecutionMode, RuntimeBuilder};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut runtime = RuntimeBuilder::new()
//! .with_execution_mode(ExecutionMode::Checked)
//! .build()?;
//!
//! runtime.load_script(
//! "app://entry.lt",
//! "as fn(argument: usize) -> i32
//! let values: [i32; 2] = [11, 22] return values[argument]",
//! )?;
//! let function = runtime.function("app://entry.lt", "")?.abi_function()?;
//! let mut call = function.abi_call_builder();
//! call.push_rust_value_argument(1usize)?;
//! assert_eq!(call.call()?.into_rust_value::<i32>()?, 22);
//!
//! let mut call = function.abi_call_builder();
//! call.push_rust_value_argument(3usize)?;
//! assert!(matches!(
//! call.call(),
//! Err(lehit::runtime::AbiCallError::Execution(status))
//! if status == lehit::runtime::AbiCallStatus::BOUNDS_VIOLATION
//! ));
//! # Ok(())
//! # }
//! ```
//!
//! # Choosing an API
//!
//! - [`runtime`] is the supported embedding and execution facade.
//! - [`rust_lib`] and [`LehitRegistration`] register trusted native Rust code.
//! - [`parsing::parse_file`] is the source-level frontend entry point.
//! - [`semantic`] exposes the experimental compiler passes and typed IR.
//! - [`core_lib`] exposes the embedded `core://` source modules.
//! - [`guides`] contains the long-form documentation rendered on docs.rs.
//!
//! # Status and trust model
//!
//! The project is pre-release and is not a sandbox. Checked execution only
//! covers failures explicitly instrumented by codegen; native pointers, custom
//! layouts, allocator callbacks, and aggregate byte validity remain trusted-host
//! responsibilities. Read [`guides::safety`] before using native integration.
extern crate self as lehit;
pub use LehitRegistration;
// These pre-release compiler/runtime surfaces still contain low-level data
// models. Their curated entry points are documented while item-by-item coverage
// is completed alongside the planned API narrowing.
/// Long-form guides rendered directly in docs.rs navigation.
/// Common imports for host applications using the high-level runtime API.