about summary refs log tree commit diff
path: root/pkg/lang/vm/executor
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-08-11 01:25:47 +0000
committerMel <einebeere@gmail.com>2022-08-11 01:25:47 +0000
commit86f31acf6789be116dcc54ed85b069a37c0f7aa8 (patch)
treebc7afd6a8c340825996d29c6cfd392ae42b4fbd5 /pkg/lang/vm/executor
parentc46b2bc7ce6df1f2c6c9494ef08015ec29992da5 (diff)
downloadjinx-86f31acf6789be116dcc54ed85b069a37c0f7aa8.tar.zst
jinx-86f31acf6789be116dcc54ed85b069a37c0f7aa8.zip
Actual modules and core
Diffstat (limited to 'pkg/lang/vm/executor')
-rw-r--r--pkg/lang/vm/executor/executor.go17
-rw-r--r--pkg/lang/vm/executor/nativefunc.go5
2 files changed, 22 insertions, 0 deletions
diff --git a/pkg/lang/vm/executor/executor.go b/pkg/lang/vm/executor/executor.go
new file mode 100644
index 0000000..0b7ccef
--- /dev/null
+++ b/pkg/lang/vm/executor/executor.go
@@ -0,0 +1,17 @@
+package executor
+
+import (
+	"jinx/pkg/lang/vm/mem"
+	"jinx/pkg/lang/vm/stack"
+	"jinx/pkg/lang/vm/value"
+)
+
+type Exectutor interface {
+	Mem() mem.Mem
+	Stack() stack.Stack
+
+	GetThis() (value.Value, error)
+
+	AddGlobal(name string, v value.Value) error
+	GetGlobal(name string) (value.Value, bool, error)
+}
diff --git a/pkg/lang/vm/executor/nativefunc.go b/pkg/lang/vm/executor/nativefunc.go
new file mode 100644
index 0000000..2188bfb
--- /dev/null
+++ b/pkg/lang/vm/executor/nativefunc.go
@@ -0,0 +1,5 @@
+package executor
+
+import "jinx/pkg/lang/vm/value"
+
+type NativeFunc func(executor Exectutor, args []value.Value) (value.Value, error)