Alpha · Node 22.18+ · Apache-2.0

Build your language on a compiler that grows with it.

The compiler is written in mini and emits readable JavaScript for Node. Extend the syntax and built-ins as your language takes shape.

Try the playground Get started

samples/programs/fibonacci.mini sample
/// Print a Fibonacci sequence using mixed-value output.

import "core/io";
import "util/io";

/// Calculate a Fibonacci number with an iterative loop.
fn fib(n) {
    a := 0;
    b := 1;
    i := 0;
    while i < n {
        next := a + b;
        a = b;
        b = next;
        i = i + 1;
    }
    return a;
}
index := 0;
while index < 10 {
    io_write(fib(index), " ");
    index = index + 1;
}
io_write_line("");
output
0 1 1 2 3 5 8 13 21 34 
Open in playground →

A practical base for language builders

Start with a working compiler, then extend the language in small, verifiable steps.

Readable generated code

Compile to JavaScript you can inspect, run on Node, and adapt for your language.

Self-hosting you can verify

Compiler updates must rebuild to the same output across successive generations and run a compiled example.

A focused language core

Functions, control flow, text, lists, maps, and JSON provide a practical base for growing a language.

Build and run

Node.js 22.18.0 or newer. The compiler installs no packages.

  1. Get the source

    git clone https://github.com/HKhademian/Mini
    cd Mini
  2. Build the generated tools

    ./bin/bootstrap
  3. Run a sample

    ./bin/mini run samples/lists/list-join.mini

    prints one | two | three

Real samples, real output

Explore the language through runnable examples. Browse all samples by topic.

Lists

Join list items with a visible separator.

samples/lists/list-join.mini
/// Build a list of words and print them as one line.

import "core/io";
import "core/list";
import "util/io";

words := list_of("one", "two", "three");
io_write_line(list_join(" | ", words));
output
one | two | three

Program arguments

Forward command-line arguments to the program.

samples/lists/argument-list.mini
/// Print each command-line argument on its own line.

import "core/list";
import "core/io";
import "util/io";

args := fn_args();
io_write_line("Arguments (", list_length(args), "):");
position := 0;
while position < list_length(args) {
    io_write_line("- [", list_get(args, position), "]");
    position = position + 1;
}
output
Arguments (3):
- [alpha]
- [beta]
- [gamma]

Text and stdin

Normalize tabs and line endings from standard input.

samples/text/normalize-whitespace.mini
/// Read stdin, replace each tab or line-ending character with a space, and print it.

import "core/io";
import "core/text";

/// Return normalized text without changing source; ordinary characters are retained.
fn normalize(source) {
    output := "";
    position := 0;
    current := "";
    while position < text_length(source) {
        current = text_get(source, position);
        if current == "\t" || current == "\r" || current == "\n" {
            output = output + " ";
        } else {
            output = output + current;
        }
        position = position + 1;
    }
    return output;
}
io_write(normalize(io_read_all()));
output
alpha beta gamma

Read more

Start with the language, then explore the compiler and release guides.