KataScript · experimental
A language,
from first
principles.
A small programming language.
An open workbench for understanding it.
Write expressions, model data, and follow an idea all the way from source to execution.
cargo run -- ks hello.ks↗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()}")Two counters. Two captured values. One function.
Walk through the example →
A PLACE TO START
Read it. Run it. Take it apart.
Choose a path through the language.
Get your bearings
Install kata, run a file, and find your way around the workbench.
Read the docs 02Learn the language
From a first binding to closures, types, and the iterator protocol.
Follow the guide 03Make something
Build a word counter, keep state in a closure, and work with results.
Start a tutorialSMALL ENOUGH TO INSPECT
The machinery
is part of the story.
Kata is a personal language workbench: a Rust interpreter, a terminal REPL, and a standard library written partly in KataScript itself.
It is experimental. The design is open, the implementation is readable, and the rough edges are documented.
Look inside the repository ↗- 01SourceYour program, in a
.ksfile.let n = 42 - 02Tokens & syntaxA lexer and parser give it structure.
--dump-ast - 03ExecutionValues, scopes, and runtime checks.
42 : Int
FROM THE WORKBENCH
Notes on a language in progress.
A home for KataScript
A new place for the language guide, practical tutorials, and examples you can inspect and run.
A closure keeps a binding
A small counter reveals what a function carries out of the scope where it was created.
Three ways to name a type
Why KataScript separates product types, sum types, and interfaces into kind, enum, and type.