update spec
This commit is contained in:
parent
db4f332472
commit
0a7a3dcfdb
14
SPEC.md
14
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user