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