Syntax
letimmutable ·varmutableto name(...)defines a function ·endcloses the blockif · then · else · end— also an expressionfor each n in 1..5repeat 3 timestry / otherwise as errf"hello {name}"interpolation
cr8script is an English-shaped scripting language for LLMs and anyone
who wants quick scripts without Python's footguns. One file. No build.
No imports. It refuses truthy/falsy, refuses silent type mixing, and prints
0.1 + 0.2 = 0.3 exactly. Pipelines on lists of records read like SQL;
errors name the line, the value, and the fix.
The premise is unfashionable: a language whose refusals
are the feature. cr8script will not let "5" + 3
be a string. It will not let if 0 then
be falsy. It will not silently swallow a typo'd field name. The error
messages know the line and the value, and offer a fix.
truthy / falsy · == != >= <= · silent type coercion · null / undefined · classes & methods
let & var ·
nothing ·
is at least ·
for each in ·
group by ·
summarize ·
f"{x}"
A surface so small that an LLM rarely gets it wrong. The static
checker emits { line, message, hint } JSON so a model
can self-correct before running.
sample.cr8# sales — list of records let sales = [ { product: "widget", region: "east", amount: 12.50 }, { product: "gadget", region: "east", amount: 8.00 }, { product: "widget", region: "west", amount: 15.00 }, { product: "doodad", region: "east", amount: 99.00 }, ] let by_product = sales | group by product | summarize { total: sum(amount), n: length(items) } | sort by total descending for each row in by_product show f"{row.product}: {row.total} across {row.n} order(s)" end
stdoutdoodad: 99 across 1 order(s)
widget: 27.5 across 2 order(s)
gadget: 8 across 1 order(s)
let immutable · var mutableto name(...) defines a function · end closes the blockif · then · else · end — also an expressionfor each n in 1..5repeat 3 timestry / otherwise as errf"hello {name}" interpolationwhere · filtersort by · ascending / descendingtake · first nmap · transformgroup by · yields {key, items}summarize { ... } · roll upnumber — one decimal type, 0.1+0.2=0.3text — sealed strings, no coercionboolean — only in conditions, no truthy/falsylist — 1-based indexingrecord — values, not objectsnothing — the only absencemath · sqrt · pow · pi · ehttp · get returns { ok, status, body }time · now · sleepjson · parse · stringifycsv · parse · writesum / count / average / min / maxREPL · python3 cr8script.py--check · static field-access checks--check-json · structured for LLMs--test · golden suite--lex / --ast · debug dumpstour.cr8 · the language end-to-endendpython3 cr8script.py examples/tour.cr8
language tour
python3 cr8script.py
repl
python3 cr8script.py --test
golden suite
python3 cr8script.py --check-json file.cr8
llm correction loop
cr8script is built so an agent can write it correctly the first time. Two files exist for that purpose:
--check-json emits { line, message, hint }
diagnostics — iterate against the static checker before running.