One language core. Explicit target boundaries.

Build small programs
you can reason about.

Explore Yin's implemented hosted language with immutable values, exhaustive outcomes, and strict typed boundaries. The long-term compiler architecture targets constrained runtimes without claiming those backends exist today. Your code runs entirely in the browser and is never sent to a server.

Try it now Rust/Wasm client runtime
0.22.0Current version
176Rust tests
0Server dependencies
Interactive runtime

Run Yin right here

Choose an example, edit the code, then press ⌘+Enter to run it.

Language
Runnable demos
main.yin
Result
Loading the Yin runtimeRuns locally from WebAssembly
Language tour

Small language. Clear semantics.

Yin is more than a syntax toy: its interpreter and type checker share one thoroughly tested language specification.

01

Lexical closures

Functions capture the environment where they are defined. Interactive redefinitions do not rewrite existing closures.

(define make-adder
  (fun (base)
    (fun (value) (+ base value))))
02

Static types

Arguments, return values, and assignments are checked before execution, with precise source locations for errors.

IntFloatBoolStringAny
03

Union types

(U Int Float) expresses multiple possibilities under explicit subtype rules.

04

Nominal record inheritance

Construct typed records, inherit fields transitively, and read them without sacrificing static types.

(record Point [x Int] [y Int])
(define point (Point :x 10 :y 20))
(field point :x)
05

Immutable collections

Use vectors, insertion-ordered dictionaries, and sets with persistent updates and safe optional lookup.

(define config (dict "mode" "dev"))
(dict/get config "mode")
(dict/put config "port" "8080")
06

Pattern-driven programs

Narrow unions, destructure immutable data, and combine typed collection and string operations.

(match (parse-int "42")
  [(Int value) (+ value 1)]
  [(Bool _) 0])
07

Explicit outcomes

Represent expected failure as typed data and handle every success and error path before execution.

(match (fetch true)
  [(Ok value) value]
  [(Err message) (report message)])
08

Structured contracts

Decode untrusted JSON into a closed source type, handle structured errors, and export the same contract as JSON Schema.

(match (decode-json Request text)
  [(Ok request) (handle request)]
  [(Err error) (field error :path)])
09

Multi-file programs

Modules expose an explicit public surface. Every reachable dependency is type-checked and each module initializes once.

(import "./validation.yin"
  [validate-config])
(validate-config config)
10

Optional automation profiles

Typed tools, ordered policies, guarded hosts, and portable deterministic contracts remain available when an embedder needs explicit authority.

yin --capabilities program.yin
yin --contract-check decision.yin