Skip to content

Getting Started

The quickest way to start is the browser editor, which needs no installation. To run .nlk files on your own machine, build the CLI from a repository checkout; there is not currently a published package installer or standalone binary.

Open the editor and choose Run. The starter program is the bubble sort from the Onward! ’26 paper “Assignment Has Never Existed”; on a wide screen, the trace beside the code shows one row per round of its outer loop. The Tour of Nilakan continues from there, one program per lesson.

Install the repository’s declared Node and pnpm versions, clone the repository, and run:

pnpm check:deps
pnpm install
pnpm check:deps
pnpm --filter @nlk/cli build

The first check:deps verifies the required Node and pnpm versions and reports whether the checkout needs installation. After pnpm install, run it again to verify the workspace, lockfile, installed dependencies, and required tools. The filtered build produces packages/cli/dist/index.js. After that, replace nilakan in the examples below with pnpm --silent nilakan:

pnpm --silent nilakan hello.nlk

If you deliberately expose the compiled CLI as a nilakan executable in your own environment, the shorter commands below are equivalent. The installed CLI also provides nlk as an alias.

Create hello.nlk:

print("hello, Nilakan")
Run in playground

Run it:

nilakan hello.nlk

The CLI requires file input to use the .nlk extension.

Use - to read source from stdin:

cat hello.nlk | nilakan -

From the repository without a separately exposed binary:

cat hello.nlk | pnpm --silent nilakan -

On Windows PowerShell:

Get-Content hello.nlk | nilakan -

On Windows cmd.exe:

type hello.nlk | nilakan -
def add(left: num, right: num) -> num:
return left + right
print(add(2, 3))
Run in playground

Parameter and return annotations are runtime type contracts.

Use init to create loop state and primed assignment to stage the next state.

def exchange() -> tuple[num, num]:
init:
left = 1
right = 2
done = False
while not done:
left' = right
right' = left
done' = True
return left, right
print(exchange())
Run in playground

Both primed assignments read the same current state. The loop then commits both next-state values together. Thinking In Traces shows how to design loops like this one, starting from the table of values each round should produce.

See the CLI reference for all supported options and exit codes.