A small, deliberate programming language.
Blocks are indentation. Statements end at the newline. The reserved words fit on one line, and for anything you want to do there is one obvious way to write it.
Korrin is dynamically typed. It has string interpolation, exceptions, and a module system with a small standard library. It runs real programs today.
words = "the quick brown fox".split(" ")
for word in words:
print("{word} has {word.len()} letters")
the has 3 letters
quick has 5 letters
brown has 5 letters
fox has 3 letters
Indentation is the block
No braces, no end. The structure you see is the structure
that runs.
A newline ends a statement
No semicolons. Two statements never share a line.
Twenty-five keywords
The whole reserved vocabulary:
and as break class continue elif else except
false finally fn for if import in nil not or pass raise return super true
try while
Dynamically typed
No annotations. Values carry their type; you carry the intent.
One way to write it
When two features would do the same job, Korrin keeps one and leaves the other out.
A short program that uses a class, the math
module, and string interpolation. It reads close to how you would describe
it out loud.
import "math"
class Circle:
fn init(self, r):
self.r = r
fn area(self):
return math.pi * self.r * self.r
for r in [1, 2, 3]:
c = Circle(r)
print("radius {r}: area {math.round(c.area())}")
radius 1: area 3
radius 2: area 13
radius 3: area 28
Everything about the language is written down.
- The guide A hands-on walk through the language, one chapter at a time. Every example is run on each build, so it cannot drift.
- The specification The exact rules: lexical structure, grammar, semantics, every error code. Normative. If the implementation disagrees, one of them is a bug.
- The changelog What has landed, newest first.
- Design notes Every meaningful decision, written down when it was made, and why it went one way and not another.
Korrin is not packaged for install yet. Build it from source with a recent stable Rust toolchain.