summaryrefslogtreecommitdiff
path: root/interp/interpreter.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-16 12:30:31 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-16 12:30:31 +0100
commitee9397bc031dc33e4f735b3331643bbf60a0d17a (patch)
tree42087d58e916904af3e70de6171e0f1c9c894d8f /interp/interpreter.go
parent31e3793202402fda21905027c18ebfa5c8d8c832 (diff)
feat: handle slice expressions
Diffstat (limited to 'interp/interpreter.go')
-rw-r--r--interp/interpreter.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/interp/interpreter.go b/interp/interpreter.go
index 8d372c3..4faba28 100644
--- a/interp/interpreter.go
+++ b/interp/interpreter.go
@@ -42,7 +42,8 @@ func (i *Interp) Eval(src string) (res reflect.Value, err error) {
i.Push(i.Data[dataOffset:]...)
i.PushCode(i.Code[codeOffset:]...)
if s, ok := i.Symbols["main"]; ok {
- i.PushCode(vm.Instruction{Op: vm.Calli, Arg: []int{int(i.Data[s.Index].Int())}})
+ i.PushCode(vm.Instruction{Op: vm.Push, Arg: []int{int(i.Data[s.Index].Int())}})
+ i.PushCode(vm.Instruction{Op: vm.Call, Arg: []int{0}})
}
i.PushCode(vm.Instruction{Op: vm.Exit})
i.SetIP(max(codeOffset, i.Entry))