Kornwolf Research · language + runtime

Krank

Programs that know a price from a duration.

KrankScript works with asset amounts, prices, units, time and live Series. The language gives each value a type the compiler understands. Hosts supply the market data, world state and actions that programs use.

semantic valuesdimensional typescausal seriestyped hosts
type modelconcept sketch
Illustrative type shapes Amount · BTC Price<BTC, USDT> Duration<millisecond> Series<Price<BTC, USDT>>
Asset, unit and time information travels with the value.
typeMeaning
compileArtifact
runHost

01 · Semantic values

Values carry their units, assets and time.

A duration counts milliseconds or seconds. An amount belongs to BTC or USDT. A timestamp identifies a point in time. Krank can check these distinctions while it compiles your program.

Units

A meter and a second are different things.

Units combine through arithmetic. Multiplying a distance by a rate gives a new dimension. Adding incompatible dimensions produces a type error.

duration · rate · frequency · derived units
Assets

BTC stays BTC.

An amount of BTC and an amount of USDT have different types, even when both are stored as numbers.

amounts · prices · pairs · exposure
Time

A timestamp is a different thing from a duration.

Instants, durations, intervals, calendar dates and time zones follow different rules. Type checking can catch a mix-up before it runs.

instant · duration · interval · calendar

One definition

Define a type once. Use it across the tools.

The same type description drives compiler checks, runtime validation, serialization and editor help.

staticcompiler
type identity
operations
result types
runtimeboundary
validation
normalization
serialization
toolseditor
completion
hover
diagnostics

02 · Arithmetic + lowering

Meaning first. Machine representation follows.

Krank tracks the asset, unit and precision of a value. The compiler can then lower it to fixed-point, floating-point or vector operations that meet the program’s accuracy requirements.

1Semantic typeasset + unit + precision
→
2Constraintsrange + error + workload
→
3Loweringfixed · float · vector
→
4Machine valuewithin the precision limit
Algebra

Arithmetic derives meaning.

Multiplication, division and powers derive dimensions and compound semantic types, keeping results typed through arithmetic.

Precision

Exactness is explicit.

Workloads can state the precision they need. The runtime can pick an implementation that meets the contract without paying for stronger arithmetic everywhere.

Boundaries

Conversion happens where data enters or leaves.

Parsing and wire formats live at external boundaries. Inside a Krank program, values keep their semantic types.

Reflection

Tools can inspect the same model.

Types retain enough structure for diagnostics, schemas, editor help and runtime inspection to describe the value in domain terms.

Executable proof

Compile it. Run it. Inspect the result.

The example uses the KrankScript compiler and portable runtime. Its run record shows the Kornwolf host interface, artifact fingerprint, resource use and computed value.

runtime-demo.kscompiled + executed
use kornwolf::market::plot
scaled = close * 1.01 + 100
plot(scaled)
artifacthost contract
interface kornwolf.market@2026.10.04
type series<float>
fingerprint fnv1a64:b8e07b0c0fce0409
run recordcompleted
fuel       9
host calls 2
outputs    1
value      [110.1, 120.2]

03 · Time + causality

A live Series remembers what came before.

Market bars, sensor readings and strategy signals arrive over time. Krank records their order and state so a program can replay market history, simulate a run and process live updates.

historyRecorded data
replayOrdered events
simulationModeled effects
liveCurrent events
signal.kscompiled graph
loading executable Series demo…
graphloading
nodes–
alerts–
replay–
closefast EMAslow EMAbull / longbear / short
Series

Recalculate what changed.

A new bar updates the affected indicators and signals. Earlier values stay available for history and replay.

history · windows · transforms · state
Effects

Know when a program calls out.

Host calls, writes and model requests carry effects that the runtime can track through execution and replay.

reads · writes · models · host calls
Concurrency

Give tasks a deadline.

Tasks carry cancellation, resource budgets and backpressure rules the runtime can enforce.

tasks · deadlines · races · budgets

04 · Hosts

One KrankScript. Different machines.

KrankScript uses .ks files. Kornwolf adds market data and trading capabilities. Axora adds worlds, scenes and audio. Each host provides typed modules to the same language and runtime. Pine v6 compatibility work tracks a separate .pine frontend.

model.ksPlain Krank
.ks
core language
portable libraries
typed capabilities
strategy.ksKornwolf host
.ks
kornwolf::market
kornwolf::alerts
strategy policy
scene.ksAxora host
.ks
axora::world
sensorium + audio
creator capabilities

Parser-backed examples

KrankScript at work.

These .ks examples pass the current parser. Their host modules come from Kornwolf and Axora. The syntax is still evolving.

btc-eth-relative-value.ksKornwolf host
use kornwolf::market::{market, plot}

btc = market("BINANCE:BTCUSDT").bars("1m")
eth = market("BINANCE:ETHUSDT").bars("1m")
z = zscore(log(btc.close) - log(eth.close), 240)

plot(z, label: "BTC / ETH relative value")

05 · Capability atlas

The Krank capability map.

Explore the compiler, execution engine, Series model, host integration and Pine v6 coverage. Each area shows its current development stage.

Areas tracked10
Pine v6 families24
Native Pine executionIn development
shippingbuildingtarget
loading

Loading capabilities…

06 · Toolchain

The same language in your editor and runtime.

Tree-sitter parses KrankScript as you type. The Rust compiler and language server provide analysis, diagnostics and completion. Browser adapters bring those tools into web editors.

Parser

Tree-sitter

Incremental parsing and highlight queries for editor and browser use.

Compiler

Rust workspace

Syntax, semantic analysis and runtime work share typed internal structures.

Editor

LSP + VS Code

Diagnostics, completion and navigation can use the same semantic definitions.

Browser

Web adapters

The language package exposes source identity and linked host metadata to web tools.