From 22a69393f58abcf3bcf9e7039f994dae78422213 Mon Sep 17 00:00:00 2001 From: Mel Date: Wed, 27 Jul 2022 11:01:29 +0000 Subject: Implement VM modules and globals --- pkg/lang/vm/text/decompiler.go | 2 ++ pkg/lang/vm/text/op.go | 2 ++ 2 files changed, 4 insertions(+) (limited to 'pkg/lang/vm/text') diff --git a/pkg/lang/vm/text/decompiler.go b/pkg/lang/vm/text/decompiler.go index 2b4e704..8a85d49 100644 --- a/pkg/lang/vm/text/decompiler.go +++ b/pkg/lang/vm/text/decompiler.go @@ -93,7 +93,9 @@ func (d *Decompiler) decompileInstruction(bc code.Raw) (string, code.Raw) { // Operations that take a string. case code.OpPushString, code.OpPushType, + code.OpAddGlobal, code.OpGetGlobal, + code.OpSetGlobal, code.OpSetMember, code.OpGetMember: s, rest := d.decompileString(bc[1:]) diff --git a/pkg/lang/vm/text/op.go b/pkg/lang/vm/text/op.go index ce53f50..ff3c568 100644 --- a/pkg/lang/vm/text/op.go +++ b/pkg/lang/vm/text/op.go @@ -17,7 +17,9 @@ var ( code.OpPushObject: "push_object", code.OpPushType: "push_type", code.OpDrop: "drop", + code.OpAddGlobal: "add_global", code.OpGetGlobal: "get_global", + code.OpSetGlobal: "set_global", code.OpGetLocal: "get_local", code.OpSetLocal: "set_local", code.OpGetMember: "get_member", -- cgit 1.4.1