From 6fe6e6546c4801f850d943c699fccdd5dc6ea723 Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 20 May 2022 20:28:17 +0200 Subject: Continuous VM stack implementation --- pkg/lang/vm/text/compiler_test.go | 6 ++---- pkg/lang/vm/text/op.go | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'pkg/lang/vm/text') diff --git a/pkg/lang/vm/text/compiler_test.go b/pkg/lang/vm/text/compiler_test.go index cf2f6a9..237e884 100644 --- a/pkg/lang/vm/text/compiler_test.go +++ b/pkg/lang/vm/text/compiler_test.go @@ -13,8 +13,7 @@ import ( func TestSimple(t *testing.T) { src := ` - get_arg - get_arg + add sub ret ` @@ -24,8 +23,7 @@ func TestSimple(t *testing.T) { require.NoError(t, err) parts := [][]byte{ - opBin(code.OpGetArg), - opBin(code.OpGetArg), + opBin(code.OpAdd), opBin(code.OpSub), opBin(code.OpRet), } diff --git a/pkg/lang/vm/text/op.go b/pkg/lang/vm/text/op.go index bbcc2d4..df40d8f 100644 --- a/pkg/lang/vm/text/op.go +++ b/pkg/lang/vm/text/op.go @@ -15,12 +15,12 @@ var ( code.OpPushArray: "push_array", code.OpPushFunction: "push_function", code.OpPushObject: "push_object", + code.OpShift: "shift", code.OpDrop: "drop", code.OpGetGlobal: "get_global", code.OpGetLocal: "get_local", code.OpGetMember: "get_member", code.OpGetMethod: "get_method", - code.OpGetArg: "get_arg", code.OpGetEnv: "get_env", code.OpAdd: "add", code.OpSub: "sub", -- cgit 1.4.1