From 0a7a3dcfdb8aa4b4b645f36090aab3366cd8e6d6 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 5 Oct 2025 21:09:56 -0700 Subject: [PATCH] update spec --- SPEC.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SPEC.md b/SPEC.md index 20378bd..e8dba5e 100644 --- a/SPEC.md +++ b/SPEC.md @@ -61,7 +61,7 @@ type Bytecode = { type Instruction = { op: OpCode - operand?: number | string | { positional: number; named: number } + operand?: number | string } type Constant = @@ -526,7 +526,9 @@ LOAD 'mkdir' PUSH 'src/bin' # positional arg PUSH 'recursive' # name PUSH true # value -CALL { positional: 1, named: 1 } +PUSH 1 # positionalCount +PUSH 1 # namedCount +CALL ``` ### Tail Recursive Function @@ -549,12 +551,16 @@ recurse: LOAD 'n' LOAD 'acc' MUL - TAIL_CALL 2 # No stack growth! + PUSH 2 # positionalCount + PUSH 0 # namedCount + TAIL_CALL # No stack growth! main: LOAD 'factorial' PUSH 5 PUSH 1 - CALL 2 + PUSH 2 # positionalCount + PUSH 0 # namedCount + CALL ``` ## Error Conditions