for domain tools
SJON is the DSL you don’t have to write.
Most domain tools eventually grow their own little config language. SJON saves you that work: a small embeddable data language with schemas, helpful diagnostics, units, comments, and clean JSON interop, ready to drop in. And it reads the same to the person reviewing the file as to the model that wrote it.
- 1.0
- CC0
- Zig
- JS
- Rust
examples/basic.sjon
A scene file. Each (name ...) describes a thing; the :words are its fields. Numbers can carry units (4b = four beats), and a small expression like (* 2 (b 1)) works wherever a plain value would.
(scene :bpm 130 :name "intro"
(canvas :name main
(camera :mode ortho :zoom (* 2 (b 1)))
(shape :sdf :radius 0.5
:color [0.9 0.4 0.2 1]
:delay 4b
:alpha (smoothstep 0 1 t))))(plugin :name shapes :version "1.0.0" :license "CC0-1.0"
(value-kind :name rgba
:underlying vector
:vector (vector-shape :element number :length 4))
(form :name shape
(key :name sdf :type symbol)
(key :name radius :type number)
(key :name color :type rgba)))(let [beats 4
fade (smoothstep 0 1 t)
seed (hash scene-name beats)]
(shape :delay (b beats)
:alpha fade
:jitter (rand-range seed 0 -0.1 0.1)))