Readable generated code
Compile to JavaScript you can inspect, run on Node, and adapt for your language.
Alpha · Node 22.18+ · Apache-2.0
The compiler is written in mini and emits readable JavaScript for Node. Extend the syntax and built-ins as your language takes shape.
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("");
0 1 1 2 3 5 8 13 21 34
Start with a working compiler, then extend the language in small, verifiable steps.
Compile to JavaScript you can inspect, run on Node, and adapt for your language.
Compiler updates must rebuild to the same output across successive generations and run a compiled example.
Functions, control flow, text, lists, maps, and JSON provide a practical base for growing a language.
Node.js 22.18.0 or newer. The compiler installs no packages.
git clone https://github.com/HKhademian/Mini
cd Mini
./bin/bootstrap
./bin/mini run samples/lists/list-join.mini
prints one | two | three
Explore the language through runnable examples. Browse all samples by topic.
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));
one | two | three
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;
}
Arguments (3):
- [alpha]
- [beta]
- [gamma]
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()));
alpha beta gamma
Start with the language, then explore the compiler and release guides.
Build the tools and run your first program.
Goals, audience, and design choices.
Accepted syntax and function contracts, with open rules marked.
The self-hosted compiler, its commands, and the analysis interface.
Supported Node range and the generated JavaScript contract.
The official release cycle, artifacts, and verification.