JaggerScript / docsProject documentation

Reference

Interpreter Runtime

Look up syntax, contracts, layouts, algorithms, and exact behavior.

The interpreter state is built around a heap, a stack of function frames, a stack pointer, the currently running instance, class definitions, and function maps. Object instances hold a pointer and a global scope that maps field names to heap pointers.

S=(H,  K,  sp,  icurrent,  C,  F)S = (H,\;K,\;sp,\;i_{\mathrm{current}},\;C,\;F)
Runtime state. The interpreter state combines heap, stack frames, active instance, class table, and function table.

That model gives the language reference behavior without pretending JavaScript variables are the runtime. Local variables live in stack frames; object fields live through heap-backed instance scopes; scoped access walks object references until it reaches the requested field.

v(a.b.c)=H[scope⁡(H[scope⁡(a)].b).c]v(a.b.c) = H\left[\operatorname{scope}(H[\operatorname{scope}(a)].b).c\right]
Scoped lookup. Member access is resolved by following instance scopes through heap pointers until the final field is found.
Program
  |
  v
class table C -------- function table F
  |                         |
  v                         v
running instance i ---- stack frame K[sp]
  |                         |
  v                         v
globalScope: name -> ptr   locals: name -> Value
  |
  v
heap H: ptr -> Value
Interpreter state topology. Object fields are addressed through heap pointers, while local variables live in the active stack frame.

Assignments preserve the existing storage discipline. Local writes update the active frame. Field writes walk the scope path to the target instance and then update or replace the heap value behind the field pointer. If the existing field type and assigned value type disagree, the runtime rejects the assignment.

type⁡(H[p])=type⁡(v)⇒H′[p]=v\operatorname{type}(H[p]) = \operatorname{type}(v) \Rightarrow H'[p] = v
Assignment type invariant. A field assignment is valid only when the stored field type agrees with the assigned value type.