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

MIT license

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

  1. First, install Rust and cargo
  2. 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 generator
  • fizzbuzz.nl - FizzBuzz implementation
  • quicksort.nl - Quicksort algorithm
  • game_of_life.nl - Conway's Game of Life
  • eratosthenes_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:

  1. Lexer → Tokens
  2. Parser → AST
  3. IR Lowering → Three-address code with SSA
  4. Optimization → GVN, constant folding, DCE
  5. Codegen → Register allocation and bytecode emission
  6. 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