A robustly typed language from the ML family that compiles to fast, readable JavaScript, with TypeScript type generation and easy JS interop.
kulics/koral
An experimental compiled programming language designed for AI-generated code that people review, with explicit syntax and no garbage collector, compiling to C.
- Stars
- 418
- Forks
- 27
- Open issues
- 0
- Last commit
- 5 hours ago
What is it?
Koral is a compiled programming language built around the idea that much code is now produced by AI agents and still has to be read by people. Its syntax favors few ways to go wrong: every statement ends with an explicit semicolon, mutability is declared once at the type, a module-level name has a single owner, and error handling is written inline within expressions rather than through throw, try, or catch.
Memory management has no garbage collector and no manual free. Nominal types are declared in one of two forms: an immutable `type` or a shared `type mutable`, and memory handling follows from that choice. The compiler emits C, which the project describes as aimed at broad platform compatibility. The language includes algebraic data types, exhaustive pattern matching, generics with trait constraints, trait objects, a C FFI, and `defer`.
The project is marked experimental and not yet production-ready. Its compiler is self-hosting, written in Koral itself and bootstrapped from a frozen Swift reference compiler.
Key features
- 01Statements end with explicit semicolons and imports use a single `using` form.
- 02Memory is managed without a garbage collector or manual free, based on `type` and `type mutable`.
- 03Control flow such as `if`, `when`, `while` and `for` is expression-based, with exhaustive matching.
- 04Errors are handled inline with `or else`, `and then` and `or return`.
- 05Compiles to C and provides a C FFI with raw pointers and `defer`.
Use cases
- Exploring a language designed to make AI-generated code easier to review.
- Studying compiler design, including a self-hosting compiler and a C backend.
- Experimenting with memory management without a garbage collector.
Quick start
- 1
Clone the repository
git clone https://github.com/kulics/koral.git - 2
Build the frozen Swift reference compiler (needs a Swift toolchain)
swift build -c release --package-path compiler-reference - 3
Build the self-hosting compiler with the reference compiler
compiler-reference/.build/release/koralc build --package-config compiler/koral.json --target-module koralc -o bin/compiler
Things to know
- Experimental and not yet production-ready.
- Building requires a Swift toolchain, clang, and Git.
- Compiles through C, so a C toolchain is needed to produce binaries.
In collections
Topics
FAQ
- What is koral?
- An experimental compiled programming language designed for AI-generated code that people review, with explicit syntax and no garbage collector, compiling to C. Koral is a compiled programming language built around the idea that much code is now produced by AI agents and still has to be read by people. Its syntax favors few ways to go wrong: every statement ends with an explicit semicolon, mutability is declared once at the type, a module-level name has a single owner, and error handling is written inline within expressions rather than through throw, try, or catch.
- Is koral free to use? What license does it have?
- koral is open source under the MIT license. Check the license terms before using it in commercial products.
- Is koral still maintained?
- Actively maintained. The last commit to koral was on Nov 6, 2026.
- What can I use koral for?
- Exploring a language designed to make AI-generated code easier to review. Studying compiler design, including a self-hosting compiler and a C backend. Experimenting with memory management without a garbage collector.
- How do I install koral?
- Clone the repository: git clone https://github.com/kulics/koral.git Build the frozen Swift reference compiler (needs a Swift toolchain): swift build -c release --package-path compiler-reference Build the self-hosting compiler with the reference compiler: compiler-reference/.build/release/koralc build --package-config compiler/koral.json --target-module koralc -o bin/compiler
- Where can I get koral?
- The source code and installation instructions are on GitHub: https://github.com/kulics/koral
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
The Go programming language, an open source language for building simple, reliable, and efficient software.
The main source repository for the Rust programming language, containing the compiler, standard library, and documentation.
Sway is a Rust-inspired programming language for writing smart contracts on the Fuel blockchain.
A simple, fast, compiled programming language for maintainable software, with zero library dependencies and automatic C-to-V translation.
Odin is a general-purpose, data-oriented systems programming language positioned as a C alternative, with a built-in standard library.