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 — decimal-safe by default,
useful for finance, billing, and reporting scripts where Python's float
footguns would silently corrupt totals. 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 / maxpip install cr8script · one command on PATH--check-json · structured diagnostics for agents--test · golden suitetour.cr8 · the language end-to-endAGENTS.md · system-prompt template + tool defsLLM_MAP.md · typed planning graphendpip install cr8script
install
cr8script --example tour
language tour
cr8script --help
all flags
cr8script --check-json file.cr8
llm correction loop
cr8script is built so an agent can write it correctly the first time. Five surfaces exist for that purpose:
cr8_check / cr8_run,
and a task-shape pointer table. Everything you need to wire
cr8script into an agent loop.
.cr8 generation. Forces the model to externalize
goals, inputs, transforms, decisions, risks, outputs, and
checks before writing code. Has its own validator
(tools/check_map.py) that mirrors the
--check-json shape.
--check-json emits { line, message, hint }
diagnostics -- iterate against the static checker before running.