Skip to content
Try Kata

A language,
from first
principles.

KataScript is a small, expression-oriented programming language.

Try a closure

Run this example, or step through it to see how each counter keeps its own state.

Walk through the project →
func make_counter(start: Int, step: Int): Func {
let value = start
ret func(): Int {
value = value + step
ret value
}
}
let next = make_counter(0, 1)
let tens = make_counter(0, 10)
print("next: {next()}")
print("next: {next()}")
print("tens: {tens()}")
print("next: {next()}")
print("tens: {tens()}")

Learn KataScript

Inside the interpreter

Kata is a personal language workbench: a Rust interpreter, a terminal REPL, and a standard library written partly in KataScript itself.

See the language status for supported features and known limits.

Look inside the repository ↗
  1. 01
    SourceYour program, in a .ks file.
    let n = 42
  2. 02
    Tokens & syntaxA lexer and parser give it structure.
    --dump-ast
  3. 03
    ExecutionValues, scopes, and runtime checks.
    42 : Int

From the Blog

All posts →