- TypeScript 62.3%
- Zig 32.7%
- JavaScript 2.3%
- Astro 1.5%
- CSS 1.2%
| .opencode/agents | ||
| compiler | ||
| docs | ||
| frontend | ||
| vm | ||
| AGENTS.md | ||
| README.md | ||
Nik lang
Nik is a high-level, general-purpose language compiled for a register-based virtual machine.
VM
The VM currently executes version 0.1 nikfiles on 64-bit Linux:
- 64 general-purpose registers (
r0is hardwired to zero) - 8 normalized comparison registers (
c0throughc7) - A bounded 128-word operand stack
- Moving heap allocation for immutable byte strings, U64 arrays, U64 pairs, and traced objects
- Relative conditional and unconditional branches
- Function calls with a bounded 128-frame call stack
The complete file format, instruction encoding, runtime behavior, and
validation rules are documented in vm/docs/SPEC.md.
Build and test the VM with:
cd vm
zig build
zig build test
Compiler
The TypeScript bootstrap compiler is in compiler/. It reads Nik
source, indexes declarations, resolves lexical names, checks typed HIR, and
emits executable .nikb files with typed string values, immutable U64 arrays and
pairs, explicit U64-to-string coercion, concatenation, string and Bool equality,
and literal/runtime print calls.
See compiler/README.md for setup, commands, and current
backend limits.
The proposed v0.2 format and language evolution paths are tracked in
docs/ROADMAP_0.2.md.
cd compiler
pnpm install
pnpm test
node dist/src/cli.js build ../vm/testdata/hello_source.nik
Run the resulting file with the VM from vm/zig-out/bin/vm.