Compiles TypeScript/JavaScript to native code using LLVM. Still experimental, but it works for basic stuff. Supports multi-file projects, generates standalone executables, and uses reference counting for memory management.
- Basic types: numbers, booleans, strings, arrays, classes, unions
- Multi-file compilation with a package system
- Generics (via monomorphization) and union types
- Async functions (still in preview, but they work)
- Reference counting with weak refs and cycle collection
- Outputs LLVM IR and links to a custom runtime
You'll need:
- Rust (install via rustup)
- LLVM 18 dev headers and tools
- clang (usually comes with LLVM)
Installing LLVM 18:
Fedora:
sudo dnf install llvm18 llvm18-devel clang18The easiest way is to use toasty standalone.
Install it:
cargo install --git https://gitlab.com/Chrono-byte/oats toastyThen compile and run:
# Create a simple program
echo 'export function main(): void { println(5 + 3); }' > add.ts
# Build it
toasty build add.ts
# Or build and run
toasty run add.tsThe runtime gets cached in ~/.oats/runtime/ so subsequent builds are faster.
Environment variables:
OATS_RUNTIME_CACHE: Change where the runtime cache goes
If you want to hack on Oats:
git clone https://gitlab.com/Chrono-byte/oats.git
cd oats
# Build everything
cargo build --workspace
# Run an example
cargo run -p toasty --release -- run examples/add.tscrates/oatsc: The actual compiler (parsing, type checking, LLVM IR generation)crates/runtime: Runtime library with ARC, allocators, logging, cycle collector.crates/toasty: CLI tool withbuildandruncommandscrates/std: Standard library (console, filesystem, networking, etc.)docs/: Documentation (architecture, dev guides, memory design, roadmap)examples/: Example programs and test suitesscripts/: Helper scripts for dev/testing
Check out docs/README.md for more detailed docs.
Contributions welcome. Check out docs/ROADMAP.md to see what's planned.
To build and test:
# Build everything
cargo build --workspace
# Run tests
cargo test --workspace
# Run the end-to-end tests
# there is a test suite member called e2e_tests.rs that runs the end-to-end testsLicensed under the zlib/libpng License with Acknowledgement. See the LICENSE file for details.