A high-performance JavaScript-like scripting language with native code execution
Featuring a self-hosting compiler and Rust-inspired memory safety
This project is AI assisted, with some chunks of the code being generated by AI, marjority of the code still were generated by a Human, mainly the buggy part, and inconsistent functions. Most of the documentation were generate by AI , documentation will be properly addressed when the project gets more mature.
This project accepts and encourage AI to be used. If you're against AI please consider contributing to another project.
Oite (pronouce oy-tee) is a scripting language that combines JavaScript-like syntax with Rust-inspired memory safety and native code performance.
function fib(n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
console.log(fib(35)); // Compiled to native code!Status: pre-alpha. The list below is the design. Native code is the target: the JIT and AOT backends run the same language features as the VM (the debugging interpreter), modules included. Generators, regular expressions and tagged templates are compile errors on every backend, and the
require,fs,JSON,fetch,processandByteStreamglobals exist only in the VM. Type annotations are checked as warnings for now, and memory is never freed. See Development Status for what runs on which backend, and #136 for the roadmap.
- Native Execution — SSA-based IR compiled to native code via Cranelift/LLVM
- Link-Time Optimization — ThinLTO and Full LTO for maximum performance
- Standalone Binaries — Self-contained executables with runtime stubs in LLVM IR
- Memory Safety — Ownership model with compile-time borrow checking
- Self-Hosting — Bootstrap compiler written in Oite itself
- Type Inference — Flow-sensitive type analysis for optimization
- JavaScript Syntax — Familiar syntax with ES6+ features
- Classes & Inheritance — ES6 classes with extends, super(), and private fields
- Error Handling — try/catch/finally with exception propagation
Oite Core is like C without libc — a minimal, self-contained language that runs without dependencies. Everything else is optional.
┌─────────────────────────────────────────────────────────────────────────┐
│ User App Code │
└───────────────────────────────────┬─────────────────────────────────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌───────────────────────────────────┐ ┌──────────────────────────────────┐
│ OITE CORE │ │ ROLLS │
│ ✅ Always available │ │ ⚡ Optional system libraries │
│ │ │ │
│ • Compiler (oitec) │ │ • @rolls/http HTTP server │
│ • Runtime (NaN-boxing, heap) │ │ • @rolls/tls TLS encryption │
│ • Primitives (number, string...) │ │ • @rolls/fs File system │
│ • console.log │ │ • @rolls/db Databases │
│ │ │ • @rolls/async Event loop │
│ Like C without libc: │ │ │
│ Can run, can't do HTTP │ │ Batteries for real apps │
└───────────────────────────────────┘ └──────────────────────────────────┘
│ │
└───────────────┬───────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ UNROLL │
│ Build system & package manager │
│ │
│ • Resolves dependencies (Rolls + NPM → .nroll) │
│ • Produces single static binary │
│ • Lockfile for reproducible builds │
└───────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ ./myapp (Single Binary) │
│ ✅ No runtime required ✅ No node_modules ✅ Deploy: copy one file │
└─────────────────────────────────────────────────────────────────────────┘
See Platform architecture for how core, Rolls and Unroll fit together.
┌─────────────────────────────────────────────────────────────────┐
│ Oite Source │
└───────────────────────────┬─────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ Oite Compiler │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────────────┐ │
│ │ Parser │─▶│ Borrow Check │─▶│ SSA IR Generation │ │
│ │ (SWC AST) │ │ (Ownership) │ │ (Type Inference, Opts) │ │
│ └─────────────┘ └──────────────┘ └────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ Native Backend │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Cranelift JIT │ │ LLVM AOT │ │ VM (Debug) │ │
│ │ (Fast) │ │ (LTO, Native) │ │ (Interpreter) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
▼
CPU
Oite builds on macOS and Linux. Native Windows is not supported yet — use WSL2.
LLVM 18 is required to build Oite at all.
llvm-sysis a mandatory dependency, so LLVM 18 and its development libraries must be installed even if you only intend to use the Cranelift JIT backend.cargo buildfails without them.
macOS:
# Install LLVM 18 and zstd (required for linking)
brew install llvm@18 zstd
# Set LLVM environment variable (add to ~/.zshrc or ~/.bashrc for persistence)
export LLVM_SYS_180_PREFIX=$(brew --prefix llvm@18)Linux (Ubuntu 24.04 / Debian 13+):
# Install LLVM 18 development headers, Polly, and zstd
sudo apt update
sudo apt install -y llvm-18-dev libpolly-18-dev libzstd-dev
# Set LLVM environment variable (add to ~/.bashrc for persistence)
export LLVM_SYS_180_PREFIX=/usr/lib/llvm-18If your distribution has no llvm-18-dev package (e.g. Debian 12 "bookworm"), install LLVM 18
from apt.llvm.org. Prefer its llvm-18-dev package over the llvm.sh
script — on distros that already ship LLVM 18, llvm.sh upgrades libllvm18 to a snapshot
build that conflicts with llvm-18-dev.
Windows (WSL2):
Oite cannot currently be built natively on Windows, for two reasons:
llvm-sysrequiresllvm-config, which the official LLVM Windows installer and thewingetpackage do not ship (nor the static libs and headers it reports). AddingC:\Program Files\LLVM\bintoPATHtherefore cannot work — the needed files are not there. Those installers also track the newest LLVM, while Oite needs 18.x.- Oite's async reactor imports
std::os::unix::io::RawFdunconditionally, which does not exist on Windows targets.
Use WSL2 and follow the Linux instructions inside it:
# In PowerShell (as Administrator)
wsl --install -d Ubuntu-24.04Keep the repo in the Linux filesystem (e.g. ~/oite), not under /mnt/c/, for much faster
builds.
# Build
cargo build --release
# Run an Oite program
./target/release/oitec myprogram.ot
# Dump SSA IR (for debugging)
./target/release/oitec ir myprogram.ot
# Run with VM (debug mode)
./target/release/oitec --run-binary output.otb
# Build to native binary (requires LLVM)
./target/release/oitec build myprogram.ot --release -o myprogram
# Run the compiled binary
./myprogramlet x = 42; // Number
let name = "Oite"; // String
let active = true; // Boolean
let data = { key: 1 }; // Object
let items = [1, 2, 3]; // Array// Function declaration
function greet(name) {
return "Hello, " + name + "!";
}
// Arrow functions
let double = (x) => x * 2;
let add = (a, b) => a + b;
// Closures
function counter() {
let count = 0;
return () => {
count = count + 1;
return count;
};
}if (condition) {
// ...
} else {
// ...
}
for (let i = 0; i < 10; i++) {
// ...
if (done) break;
if (skip) continue;
}
while (condition) {
// ...
}
do {
// ...
} while (condition);let obj = { x: 10, y: 20 };
obj.z = 30;
console.log(obj["x"]);
let arr = [1, 2, 3];
arr.push(4);
let first = arr[0];class Animal {
name: string;
constructor(name: string) {
this.name = name;
}
speak() {
console.log(this.name + " makes a sound");
}
}
class Dog extends Animal {
breed: string;
constructor(name: string, breed: string) {
super(name);
this.breed = breed;
}
speak() {
console.log(this.name + " barks!");
}
}
let dog = new Dog("Buddy", "Golden Retriever");
dog.speak(); // "Buddy barks!"Oite supports JavaScript-style private fields using the # prefix:
class Counter {
#count = 0; // Private field (only accessible within class)
increment() {
this.#count++;
}
getCount() {
return this.#count; // Can access private field from methods
}
}
let c = new Counter();
c.increment();
console.log(c.getCount()); // 1
// c.#count; // ERROR: Private field not accessible outside class
// c["#count"]; // Returns undefined (encapsulation works)try {
riskyOperation();
} catch (e) {
console.log("Error: " + e);
} finally {
cleanup();
}
class HttpError extends Error {
constructor(status, message) {
super(message);
this.status = status;
}
}Runtime errors are exceptions too: null.x throws a TypeError, an unbound
name a ReferenceError. An uncaught one prints Uncaught TypeError: ... and
exits with status 1.
At run time, assigning an object shares it, as in JavaScript. Nothing is copied, and memory is not freed yet (#123).
A compile-time move check rejects a use of a variable after its value was assigned to another variable:
let a = { value: 42 };
let b = a; // the value moves from 'a' to 'b'
// console.log(a.value); // borrow error: Cannot borrow moved variable 'a'
console.log(b.value); // 42
let x = 10;
let y = x; // 'x' was initialized with a number literal, so it is copied
console.log(x); // 10The check covers top-level code only, not function bodies. A string, the
result of a call and an arithmetic result all move. .js files follow
the same rules as .ot files. See
Memory model for the full rules.
Oite compiles to an SSA (Static Single Assignment) intermediate representation:
// Source: let x = 1 + 2; let y = x * 3;
fn main() -> any {
bb0:
v0 = const 1
v1 = const 2
v2 = add.num v0, v1 // Specialized to numeric add
store.local $0, v2
v3 = load.local $0
v4 = const 3
v5 = mul.any v3, v4
return
}
// After optimization:
bb0:
v2 = const 3 // 1+2 constant-folded!
store.local $0, v2
...
The type inference pass specializes dynamic operations:
| Before | After | Speedup |
|---|---|---|
add.any v0, v1 |
add.num v0, v1 |
~10x |
mul.any v0, v1 |
mul.num v0, v1 |
~10x |
Oite core provides only essential primitives:
console.log("Hello", 42, true);
console.error("Error message");Used by the bootstrap compiler for bytecode emission. VM only:
let stream = ByteStream.create();
ByteStream.writeU8(stream, 0xff);
ByteStream.writeU32(stream, 12345);
ByteStream.writeF64(stream, 3.14159);
ByteStream.writeString(stream, "hello");
let bytes = ByteStream.toArray(stream);Basic file operations for the bootstrap compiler. VM only: oitec jit and
oitec build refuse require.
let fs = require("fs");
let content = fs.readFileSync("file.txt");
fs.writeFileSync("out.txt", "Hello!");Note: Full standard library functionality (Math, Date, JSON, comprehensive fs/path, etc.) will be provided by the Rolls ecosystem in a separate repository. See Platform architecture for the plan.
Oite/
├── Cargo.toml # Minimal dependencies
├── README.md # This file
├── PROGRESS.md # Development status
├── compiler/ # Self-hosted compiler (modular, target)
│ ├── main.ot # CLI entry point
│ ├── lexer/ # Tokenization module
│ ├── parser/ # AST generation module
│ ├── ast/ # AST type definitions
│ ├── ir/ # IR system module
│ ├── codegen/ # Code generation module
│ └── stdlib/ # Runtime declarations
├── bootstrap/ # Bootstrap compiler (working reference)
│ └── *.ot # 11 files (~5,000 lines)
├── src/
│ ├── main.rs # Entry point
│ ├── lib.rs # Library target
│ ├── compiler/ # Rust compiler (production)
│ │ ├── mod.rs # Parser → Bytecode
│ │ └── borrow_ck.rs # Borrow checker
│ ├── ir/
│ │ ├── mod.rs # SSA IR types
│ │ ├── lower/ # Bytecode → IR
│ │ ├── typecheck.rs # Type inference
│ │ ├── verify.rs # Validation
│ │ ├── opt.rs # Optimizations
│ │ └── format.rs # IR serialization
│ ├── backend/
│ │ ├── mod.rs # Backend trait
│ │ ├── cranelift/ # JIT backend
│ │ ├── jit.rs # JIT runtime
│ │ ├── layout.rs # Memory layout
│ │ └── llvm/ # AOT backend
│ ├── types/ # Type checker
│ ├── runtime/
│ │ ├── mod.rs # Runtime module
│ │ ├── abi.rs # NaN-boxed values
│ │ ├── heap.rs # Memory allocation
│ │ ├── stubs/ # The native runtime
│ │ └── async/
│ │ ├── mod.rs # Core async traits
│ │ ├── task.rs # Task abstraction
│ │ ├── reactor.rs # Basic epoll/kqueue
│ │ └── runtime_impl.rs # Simple executor
│ ├── vm/ # Debug interpreter
│ │ ├── mod.rs # VM implementation
│ │ ├── value.rs # Runtime values
│ │ ├── opcodes.rs # Bytecode opcodes
│ │ └── stdlib_setup.rs # Minimal setup
│ └── stdlib/
│ └── mod.rs # console, ByteStream only
├── docs/ # Documentation site
│ ├── docs/ # Language, status, platform architecture
│ ├── docs-compiler/ # Compiler internals, self-hosting
│ ├── docs-rolls/ # Rolls (system libraries)
│ └── docs-unroll/ # Unroll (tooling)
└── tests/
Oite has three compiler implementations working toward full self-hosting:
| Compiler | Location | Status | Purpose |
|---|---|---|---|
| Rust | src/compiler/ |
✅ Production | Native binaries via LLVM/Cranelift |
| Bootstrap | bootstrap/*.ot |
🟡 Reference, runs on the VM | Bytecode compiler written in Oite; seed for self-hosting |
| Modular | compiler/*.ot |
🟡 Partial, runs on the VM | LLVM IR for simple programs; cannot compile its own source yet |
Self-hosting is partial. The modular compiler runs on the VM and turns simple
programs into LLVM IR, but it cannot compile its own source yet
(#131), and
scripts/bootstrap_verify.sh checks that one module compiles
deterministically, not a full self-compilation fixpoint.
# Generate LLVM IR with the self-hosted compiler (runs on the VM).
# Run it from the repository root; it writes myapp.ll next to myapp.ot.
./target/release/oitec compiler/main.ot llvm myapp.ot
# Compile to native binary (-lm: the generated code calls fmod)
clang myapp.ll -lm -o myapp
./myappCurrent requirements:
- Rust: Still needed to build the VM that runs the self-hosted compiler
- LLVM/Clang: Required to compile generated LLVM IR to native code
Roadmap to full independence:
Current: Rust VM runs compiler/*.ot → LLVM IR → clang → Native
Future: Prebuilt oitec binary → LLVM IR → clang → Native (no Rust!)
See Self-hosting for the detailed roadmap.
Pre-alpha. Development Status has the
per-feature matrix for each backend; a feature counts as done there only when
golden tests in tests/lang/ cover it.
| Component | Status |
|---|---|
| Runtime kernel (NaN-boxing, allocator) | 🟡 Works; memory is never freed (#123) |
| SSA IR + optimizations | ✅ Works |
| Native backends (Cranelift JIT, LLVM AOT) | ✅ Same language features as the VM; some globals are VM-only (see above) |
| Language features (classes, async, modules) | 🟡 On every backend; no generators, regular expressions or tagged templates yet |
| Static type checking | 🟡 Warnings; oitec check reports errors; generic calls are not checked (#190) |
| Self-hosting compiler | 🟡 Cannot compile its own source yet (#131) |
| Rolls ecosystem (HTTP, TLS, fs) | 📋 Planned; needs an FFI first (#132) |
See PROGRESS.md for design notes.
# Run all tests
cargo test --release
# Run specific IR tests
cargo test --release ir::The Oite ecosystem will eventually include:
- Rolls: Official system libraries (
@rolls/http,@rolls/tls,@rolls/fs, etc.) - Unroll: Package manager, build system, and developer tooling
See Platform architecture and the Unroll design.
Contributions are welcome! CONTRIBUTING.md has the rules a change must follow.
Oite is distributed under the terms of the Apache License (Version 2.0).
See LICENSE for details.