diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-11-14 13:47:51 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-11-14 13:47:51 +0100 |
| commit | 1a9c22d1219eb0239417db16c9fe96eea3ced2fe (patch) | |
| tree | a4fa82cfbbc924d281a94e307656a7af14caadcd /parser/interpreter.go | |
| parent | a4d7730581e8e65faa6a9285d107a041accf60b1 (diff) | |
fix: refactor VM instruction type
Use custom types for VM instructions. More idiomatic code for tracing.
Diffstat (limited to 'parser/interpreter.go')
| -rw-r--r-- | parser/interpreter.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parser/interpreter.go b/parser/interpreter.go index e6ac95c..6f354d9 100644 --- a/parser/interpreter.go +++ b/parser/interpreter.go @@ -40,9 +40,9 @@ func (i *Interpreter) 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([]int64{0, vm.Calli, i.Data[s.index].Data.Int()}) + i.PushCode(vm.Instruction{Op: vm.Calli, Arg: []int{int(i.Data[s.index].Data.Int())}}) } - i.PushCode([]int64{0, vm.Exit}) + i.PushCode(vm.Instruction{Op: vm.Exit}) i.SetIP(max(codeOffset, i.Entry)) if debug { i.PrintData() |
