ytSoftkey VS Code compilerThis is the new, independent VS Code project for the Architecture
The current milestone provides tokenization, parsing, semantic type checking, live diagnostics, compile/debug-entry commands, versioned structured IR, flattened bytecode, a checked BIN container, a typed value codec, and a TypeScript reference VM. No UKEY firmware or C runtime code is included in this repository. The frozen compiler/runtime behavior for globals, reference lifetime, definite
assignment, numeric overflow, UTF-8 strings, dynamic arrays and function errors is
documented in the source distribution's
The AST preserves complete function bodies, structured primitive/array/struct types, stable structure/member/function/variable IDs, value/ref/out modifiers, resolved user-function calls, array indexes and slices, structure initializers, member access, control flow, and source ranges. It intentionally contains no VM handles, C pointers, IR instructions or BIN offsets.
Successful and diagnostic compilation results also expose version 1 IR. The IR contains stable IDs, normalized expressions, structured control flow, source ranges and the global initialization order, without C pointers or runtime handles. The bytecode lowering pass converts structured control flow into labels and jumps.
Its execution expressions use append-only numeric opcodes and opcode-specific fixed
operand slots. Variable-size values such as call arguments occupy one list slot, so
the UKEY runtime never has to discover generic expression fields or dispatch strings.
W8BN version 3 stores that program in a compact deterministic payload using stable
field IDs, a shared UTF-8 string table, typed tags and variable-length integers,
behind a header with version, payload length and checksum. The PC decoder can still
open a legacy V1 JSON container only when it carries the current executable schema;
V2 and older generic-expression programs must be recompiled. Firmware targets only V3. The TypeScript VM currently executes scalar expressions,
variables, globals, calls, conditions, loops, switches and Bytecode generation also embeds a UKEY ABI v1 resource budget. It uses 32-bit handles
and four-byte alignment to calculate the global area, each function's local frame,
expression evaluation-stack peak, temporary-value peak, and statically required initial
heap. Programs that may grow the heap at runtime are marked explicitly instead of being
assigned an unsafe finite estimate. The VM also supports writable array elements/slices and structure members. Host
calls copy value parameters, expose committed The reference VM enforces device-style limits for array length, UTF-8 string bytes, reachable heap, nested values, elapsed execution time, call depth and total call-stack bytes. Heap checks cover globals, active frames and pending deep copies; failed allocation or API output leaves existing values unchanged. Successful results report peak heap and call-stack usage for PC-side sizing. Runtime numeric operations enforce each declared integer width.
Dynamic built-in APIs are declared in workspace Source syntax is parsed exactly once by the AST builder. Symbol binding, type checking and control-flow/lifetime checks consume that AST; the retired token-based parser is excluded from the build to prevent grammar drift. Explicit numeric conversions use C#-style cast syntax:
Numeric types can be explicitly converted in either direction. Arrays and
structures cannot be converted to unrelated types, and string/byte conversion
is reserved for configurable built-in functions such as Reference-like values can be nullable with
Explicit reference variables use the same stable-variable-cell model as
Functions may also use local labels and
Function parameters do not support default values. Independent debug inputs are provided by VS Code debug configuration or the future SETVAR call interface:
Run Parameters support
Functions are collected before bodies are checked, so forward calls, recursion,
and mutual calls are supported. Calls validate argument count, argument types,
and Array operations use value semantics. Assigning one array to another performs a deep copy once the BIN backend is generated. Slices use half-open ranges:
Multidimensional array types and chained indexes are also accepted, for example
Structures support value members,
All members must be named and initialized. A Development
Open this directory in VS Code and press F5 to launch the Extension Development Host. |