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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//! `kataan` — a high-performance JavaScript (ECMAScript) engine written
//! entirely in Rust, depending on no foreign code.
//!
//! Kataan is built bottom-up in layers, and is usable three ways — as a Rust
//! library, as a C library (the `ffi` feature), and as a standalone command-
//! line tool / REPL (the `cli` feature). See `ROADMAP.md` for the full design
//! and milestone plan.
//!
//! The pipeline:
//!
//! ```text
//! source ──[lexer]──▶ tokens ──[parser]──▶ AST ──[compiler]──▶ bytecode
//! │
//! [interpreter]
//! ```
//!
//! # `no_std`
//!
//! The language core is `#![no_std]` and needs only `alloc`. The `std` feature
//! (default, implies `alloc`) adds the host runtime — the event loop, timers,
//! file system, network (`fetch` over `rsurl`), and `crypto` (over
//! `purecrypto`). Build the bare core with `--no-default-features --features
//! alloc`.
// `missing_docs` / `unreachable_pub` are warned at the crate level (see
// `Cargo.toml [lints]`); module-level `#![allow(...)]` is used sparingly while
// a layer is still a scaffold.
extern crate alloc;
extern crate std;
/// The managed heap (generational handle table) that NaN-boxed handles index
/// into — groundwork for the object model & GC. Needs `alloc`.
/// Hidden classes ("shapes"): shared property-layout descriptors with a
/// transition tree — groundwork for the object model. Needs `alloc`.
/// The performance-era object: a [`shape::Shape`] paired with
/// [`nanbox::NanBox`] value slots — composes the object-model pillars. Needs
/// `alloc`.
/// Heap cells — the reference types (object / string / array / function) a heap
/// slot holds. Needs `alloc`.
/// Lexical environments (scope chains) for closures over the new model. Needs
/// `alloc`.
/// A mark-and-sweep tracing garbage collector over [`heap::Heap`] — reclaims
/// unreachable objects, including reference cycles. Needs `alloc`.
/// Inline caches for property access, keyed on [`shape::Shape`] identity — the
/// fast path that turns a repeated `obj.x` into a slot load. Needs `alloc`.
/// Interned strings ("atoms"): distinct identifiers/property keys mapped to
/// small `Copy` integers for O(1) comparison. Needs `alloc`.
/// Tunable resource limits (recursion depths, allocation sizes, regex/wasm
/// budgets) with safe defaults, overridable per [`realm::Realm`].
/// Rope strings: lazy O(1) concatenation so building a string piecewise is not
/// quadratic. Needs `alloc`.
/// The object-model context (`Realm`) bundling the heap, the shared root shape,
/// and the atom table behind the allocate/get/set/collect API a VM uses. Needs
/// `alloc`.
/// Shared, `alloc`-only `JSON.parse` / `JSON.stringify` over realm values.
/// Heap snapshots of the live `Cell` object graph — capture an initialized heap
/// and restore it into a fresh realm (Phase D′ heap-snapshot tier). Needs `alloc`.
/// The WebAssembly peer engine: lowers the numeric subset of JS functions to
/// WebAssembly text (WAT) — a second compilation target. Needs `alloc`.
/// The WebAssembly execution engine (Phase H): decodes and *runs* `.wasm`
/// binaries — the peer engine proper, distinct from `wasm` (JS→WASM). Needs
/// `alloc`.
/// A WebAssembly spec-test harness: typed `assert_return`/`assert_trap`/
/// `assert_invalid` commands run against the `wasm_rt` engine. Needs `alloc`.
/// A minimal register VM over the `Realm`/`NanBox` representation — the proof
/// that the performance object model executes code. Needs `alloc`.
/// Flat, fixed-record bytecode executed in place over a (possibly `mmap`'d) byte
/// buffer — the true zero-copy reload path (Phase D′). Needs `alloc`.
/// The baseline machine-code JIT (Phase G): an x86-64 assembler + W^X executable
/// memory (mapped via direct Linux syscalls, no libc) that lowers an arithmetic
/// IR to native code. Real on `linux`/`x86_64`; a no-op fallback elsewhere.
/// A portable `KTBC` serialization codec for the bytecode VM's compiled programs
/// (the code cache — `ROADMAP.md` Phase D′). Needs `alloc`.
/// A pure, `alloc`-only arbitrary-precision integer — the foundation for a
/// conformant `BigInt` (`ROADMAP.md`). Needs `alloc`.
/// Evaluates the real parser AST (the expression subset) over the
/// `Realm`/`NanBox` model — the front-end → new-representation bridge. Needs
/// `alloc`.
/// Executes real statements (variables, scope, control flow, assignment) over
/// the `Realm`/`NanBox` model — the imperative core on the new representation.
/// Needs `alloc`.
/// The in-house regular-expression engine (the `regex` feature). Pure Rust,
/// `no_std`-compatible (`alloc` only).
pub use ;
pub use ;
/// The crate version, from `Cargo.toml`.
pub const VERSION: &str = env!;