WalkLang v5 Runtime and Backend Maturity

v5 keeps C as the primary backend and tightens the runtime model around generated output that can be built, inspected, and shipped.

Backend Contract

Generated C must stay:

predictable
portable
debuggable
readable enough to inspect

WalkLang source still follows the same pipeline:

.walk -> generated C -> native executable

Release Builds

Release builds use the native C compiler with optimization enabled:

walk build main.walk -o build/main --release

--release adds:

-O3
-DNDEBUG

Custom compiler flags still work and are appended after the release defaults:

walk build main.walk -o build/main --release --cflag -DWALK_TRACE=0

Use --cc or WALK_CC to choose the native compiler.

Runtime Layer

Generated C includes a small walk runtime section before user code. It defines:

WalkInt
WalkFloat
WalkBool
WalkString
WalkSize
WalkArray*
runtime print helpers
runtime string length helper
runtime random helper
runtime array allocation helper

The helper layer keeps compiler-emitted code predictable without exposing pointers, allocation calls, or runtime ownership to WalkLang source.

Memory Model

WalkLang v5 still has no source-level memory management.

no malloc syntax
no free syntax
no pointer syntax
no public garbage collector promise

Array literals allocate item storage through the generated runtime helper. That storage is owned by the generated program for the process lifetime, so arrays can be returned from functions without pointing at expired stack memory.

Example:

func: numbers() array[int]
    var: nums = [4, 5, 6]
    return: nums

var: got = numbers()
out: got[0]

The generated C keeps the allocation explicit in the runtime layer and keeps user statements tagged with source comments.

Generated C Inspectability

Generated C starts with a short backend comment and runtime section. Emitted source statements include comments like:

/* source: main.walk:6:1 */

These comments do not change runtime behavior. They make emitted functions and main easier to inspect while preserving predictable C output and snapshot coverage.

Non-Goals

v5 does not add:

LLVM backend
WASM backend
manual memory management syntax
garbage collection
ownership annotations in WalkLang source
step-through debugger adapter