A small, fast programming language — Rust bytecode VM, .krx sources.
Quick start · Language · Examples · Contributing · License
Requirements: Rust (2021 edition)
git clone <repo-url> && cd kria-lang
cargo build --release| Command | What it does |
|---|---|
kria |
Interactive REPL |
kria program.krx |
Run entry file (+ imported modules) |
kria -h |
Help |
./target/release/kria test.krx
./target/release/kria examples/13_imports/main.krxREPL: persistent session, auto-print for expressions, multi-line blocks, :help / :reset / :exit.
- Dynamic typing ·
setbindings ·print()·type()·wait(ms)·//and/* */comments ·"..."/"""..."""strings · newline-terminated statements - Operators: arithmetic, comparisons,
and/or/not - Control flow:
if/elseif/else,while,break,continue - Functions:
fn name(...), lambdasfn(...) { },return, closures (copy-on-create captures)
| Feature | Summary |
|---|---|
| Arrays | Mutable [...], immutable #[...], index, .length, push / pop, for item in arr |
| Objects | { key: value }, dot / bracket access, property assign, rmv(), deep equality, for key, value in obj |
| Input | input<str>, input<int>, input<float> with prompts |
Run one entry file; other .krx files load only via import:
import math from "./math.krx"
print(math.add(2, 3))
export fn— visible to importers; other functions stay private- Relative paths only (
./,../); circular imports are rejected - Package manager (KPM) is planned later
Runnable samples live under examples/:
| File | Topic |
|---|---|
01_basics.krx |
Variables, print, operators |
02_conditionals.krx |
if / elseif |
03_loops.krx |
while, for-in |
04_functions_basic.krx |
Functions, closures |
11_arrays.krx |
Arrays |
12_objects.krx |
Objects |
13_imports/main.krx |
Multi-file imports |
14_type_wait.krx |
type(), wait() |
15_comments_strings.krx |
Block comments, multiline strings |
Source (.krx) → Lexer → Parser → Compiler → Bytecode → Stack VM
- Flat bytecode, constant pool, call frames for functions
- Hot-loop optimizations (
OP_LOOP_INC_LESS, combined global ops) - Implementation:
src/(lexer,parser,compiler,vm,repl,modules,project)
cargo build --release
./benchmarks/benchmarks.shResults are written to benchmarks/benchmark_results.txt. Override warmup and runs with BENCH_WARMUP=3 BENCH_RUNS=10.
Linux / macOS — from the repo root (or any directory):
./release/build.sh install # build + copy to ~/.kria/bininstall updates ~/.bashrc / ~/.zshrc when needed. Open a new terminal or run source ~/.bashrc, then kria --help.
If kria is still unknown in the current window:
export PATH="${PATH}:$HOME/.kria/bin"Other commands: ./release/build.sh (build only), ./release/build.sh package (tarball in release/).
Windows — cargo build --release, then NSIS via release/kria-setup.nsi.
See CONTRIBUTING.md for setup, code style, and pull request guidelines.
MIT — Copyright (c) 2026 Piotriox
