The Korrin guide
A hands-on introduction. Read it front to back once; keep the specification open afterwards as a reference.
Every code block below is run by CI, so what you see is what Korrin does.
- Getting started — install, run a file, use the REPL.
- Values — numbers, strings, booleans,
nil, lists, maps. - Control flow and functions —
if, loops,fn, closures. - Classes — objects, methods, inheritance,
super. - Errors —
try,except,finally,raise. - Modules —
import, module objects, the standard library. - A worked example — a small program, start to finish.
The whole language on one page
- Blocks are indentation; a newline ends a statement. No braces, no semicolons.
- 25 keywords:
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. #starts a comment.- Assignment is bare:
x = 1. Nolet. - Every string interpolates:
"hi {name}";{{is a literal brace. - Operations on
str/list/mapare methods:xs.push(v),text.trim(),m.keys(),x.len().print,str,int,range, … stay functions. - Only
nilandfalseare falsy. - Errors are exceptions:
raise Error("..."),try:/except err:/finally:. Built-in faults are catchable and carry.code/.message. import "./file"for your own modules,import "math"for the standard library; members aremod.name,_nameis private./always gives a float; integer overflow is an error, not a wraparound.