about summary refs log tree commit diff
path: root/pkg/lang/vm/text
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-07-27 11:01:29 +0000
committerMel <einebeere@gmail.com>2022-07-27 11:01:29 +0000
commit22a69393f58abcf3bcf9e7039f994dae78422213 (patch)
tree6f88f586bd57d298d54e345a6c4b8d7144a5d2ec /pkg/lang/vm/text
parent45b6f073fe398e820e9e4a82900bc282ee32af9b (diff)
downloadjinx-22a69393f58abcf3bcf9e7039f994dae78422213.tar.zst
jinx-22a69393f58abcf3bcf9e7039f994dae78422213.zip
Implement VM modules and globals
Diffstat (limited to 'pkg/lang/vm/text')
-rw-r--r--pkg/lang/vm/text/decompiler.go2
-rw-r--r--pkg/lang/vm/text/op.go2
2 files changed, 4 insertions, 0 deletions
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",