5 unstable releases
| new 0.3.0 | Dec 3, 2025 |
|---|---|
| 0.2.1 | Nov 23, 2025 |
| 0.2.0 | Nov 22, 2025 |
| 0.1.1 | Nov 18, 2025 |
| 0.1.0 | Nov 18, 2025 |
#1217 in Command line utilities
420KB
11K
SLoC
Nilang
A scripting language interpreter designed for Advent of Code 2025!
Overview
Nilang is a dynamically-typed scripting language with a focus on simplicity and expressiveness. It features a custom bytecode compiler with an optimizing IR, register allocation, and a trace and sweep garbage-collected runtime.
Features
- Dynamic typing - Variables can hold any type
- First-class functions - Functions as values, closures, partial functions
- Lists and maps - Built-in collection types
- For/while loops - Standard control flow
- REPL - Interactive development
- And much much more!
Installation
Quick Install (Recommended)
- First, install Rust and cargo
- Run the installation script:
curl -sSf https://raw.githubusercontent.com/Nilando/nilang/main/install.sh | bash
This will install nilang via cargo, download the standard library, and place it in ~/.nilang/std/.
Building from Source
git clone https://github.com/Nilando/nilang
cd nilang
cargo build --release
./install.sh
Usage
Run a Nilang program:
nilang program.nl
Start the REPL:
nilang
Pipe input to the interpreter:
echo 'print(1 + 2);' | nilang -s
Quick Start
🏗️ Tutorial document is in progress! 🏗️
Check out the examples/ directory for code samples:
fibonacci.nl- Fibonacci sequence generatorfizzbuzz.nl- FizzBuzz implementationquicksort.nl- Quicksort algorithmgame_of_life.nl- Conway's Game of Lifeeratosthenes_sieve.nl- Prime number sieve- And many more!
Try running an example:
nilang examples/fibonacci.nl
Project Status
Nilang is currently in early development (v0.1.0), and may not be maintained/updated any further. The language is functional but may have rough edges. Future features of interest include FFI through standard C bindings and compilation to WebAssembly, though these may not be implemented in the near future.
Known Limitations
- Error messages need improvement, particularly for parser errors
- Limited standard library
- Performance optimizations ongoing
- No FFI support
Architecture
Nilang uses a multi-stage compilation pipeline:
- Lexer → Tokens
- Parser → AST
- IR Lowering → Three-address code with SSA
- Optimization → GVN, constant folding, DCE
- Codegen → Register allocation and bytecode emission
- VM → Bytecode interpretation with garbage collection
Contributing
Issues and pull requests are welcome! This is a learning project and a work in progress.
License
MIT License - see LICENSE-MIT for details.
Author
Niland Schumacher
Dependencies
~4MB
~64K SLoC