Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ride vm and compiler. #438

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f7bff52
Stateful compiler.
Frozen Oct 23, 2020
393bea6
Context for func execution.
Frozen Oct 23, 2020
c32e887
Function definition passed tess.
Frozen Oct 23, 2020
1975cd8
Uncomment completed tests.
Frozen Oct 23, 2020
fb77419
Pass args as reference.
Frozen Oct 30, 2020
d20052b
Pass args as mem storage.
Frozen Nov 3, 2020
197130e
Global variables.
Frozen Nov 5, 2020
980f91f
Get attribute vm.
Frozen Nov 6, 2020
b11b59e
Odd byte codes.
Frozen Nov 6, 2020
3f70cd3
Stagenet tests.
Frozen Nov 10, 2020
03e9286
Cells for variables.
Frozen Nov 12, 2020
3165334
Fix bug with if stmt.
Frozen Nov 23, 2020
f4c6943
Cache function result as variable.
Frozen Dec 1, 2020
ae6f02a
Function arguments.
Frozen Dec 2, 2020
86f9281
Cache variable result.
Frozen Dec 3, 2020
f6a69e9
Clear cache.
Frozen Dec 3, 2020
0fd9f97
Fix clear cache.
Frozen Dec 7, 2020
219cf08
Reverse assigments.
Frozen Dec 7, 2020
2f51036
Deferred code.
Frozen Dec 9, 2020
9e7f14c
Property state.
Frozen Dec 10, 2020
0296798
Call function.
Frozen Dec 10, 2020
9c0d640
Property invocation changed.
Frozen Dec 13, 2020
8f7a32a
Property bytecode checked in tests.
Frozen Dec 13, 2020
f01939c
Reversed tree.
Frozen Dec 15, 2020
4bdddaa
Fix transitions.
Frozen Dec 22, 2020
d983007
Merge branch 'master' into ride_vm_fsm
Frozen Dec 22, 2020
415c5c1
Fix transitions.
Frozen Dec 23, 2020
b43481d
Fix functions.
Frozen Dec 23, 2020
f755658
Fix functions.
Frozen Dec 24, 2020
33f2f24
Save entrypoints into meta.
Frozen Dec 24, 2020
36be49d
Testnet random script.
Frozen Jan 24, 2021
1b6f2ff
Passed testnet.
Frozen Feb 1, 2021
8a2b1cd
Enabled cache.
Frozen Feb 4, 2021
598f0aa
Merge branch 'master' into ride_vm_fsm
Frozen Feb 4, 2021
78afd85
Merged master.
Frozen Feb 4, 2021
ff8c959
Switchable bloom filter.
Frozen Feb 5, 2021
60410b4
Fix tests.
Frozen Feb 5, 2021
cc3d021
Merge branch 'optional_bloom_filter' into ride_vm_fsm
Frozen Feb 5, 2021
b70c14b
Code clean up and returned back debug info.
Frozen Feb 9, 2021
3e16ec5
Fix panic.
Frozen Feb 9, 2021
73a8ce5
Remove caching duplicates.
Frozen Feb 12, 2021
349c863
Expanded tree.
Frozen Mar 10, 2021
9c1b500
Rewrite tree by using immutable context with variables.
Frozen Mar 16, 2021
74b8cf3
Fix problems with tree expand.
Frozen Mar 17, 2021
be99ac9
Fix naming.
Frozen Mar 18, 2021
5d035b3
Remove unused code.
Frozen Mar 18, 2021
8b64449
Fix vetcheck errors.
Frozen Mar 18, 2021
366b203
Fix vetcheck errors.
Frozen Mar 18, 2021
ba560d8
Set up go 1.16
Frozen Mar 18, 2021
6c06ca0
Merge branch 'master' into ride_vm_fsm
Frozen Mar 18, 2021
b50a0c7
Rewrite path.
Frozen Mar 19, 2021
15d0cb0
Removed fmtcheck.
Frozen Mar 19, 2021
2e6c584
Clean code in tree evaluator.
Frozen Mar 19, 2021
2c1c208
Fix small errors.
Frozen Mar 19, 2021
f86c981
Clean up compiler.
Frozen Mar 22, 2021
1d6f34a
Fix bug with var override in condition stste.
Frozen Mar 25, 2021
80bfd76
Merge remote-tracking branch 'origin/expand_tree_rewrite_path' into r…
Frozen Mar 25, 2021
a644a73
Fix bug with nil values and duplicate vars in conditional state.
Frozen Apr 2, 2021
cee2edc
Merge remote-tracking branch 'origin/master' into ride_vm_fsm
Frozen Apr 2, 2021
0c792d4
Updated mocks.
Frozen Apr 2, 2021
48d19f8
Added skip file compiler_heplers
esuwu Apr 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Function definition passed tess.
Frozen committed Oct 23, 2020
commit c32e8876653065c6ffcf481818c254a1ca535b9c
3 changes: 1 addition & 2 deletions pkg/ride/compiler2.go
Original file line number Diff line number Diff line change
@@ -44,8 +44,7 @@ func ccc(f Fsm, node Node) (Fsm, error) {
}
return f.Return(), nil
case *FunctionDeclarationNode:
// TODO
fsm, err := ccc(f.Assigment(n.Name), n.Body)
fsm, err := ccc(f.FuncDeclaration(n.Name, n.Arguments), n.Body)
if err != nil {
return fsm, err
}
51 changes: 41 additions & 10 deletions pkg/ride/compiler2_test.go
Original file line number Diff line number Diff line change
@@ -70,16 +70,16 @@ func Test22(t *testing.T) {
env RideEnvironment
res bool
}{
//{`V1: true`, "AQa3b8tH", nil, true},
//{`V3: let x = 1; true`, "AwQAAAABeAAAAAAAAAAAAQbtAkXn", nil, true},
//{`V3: let x = "abc"; true`, "AwQAAAABeAIAAAADYWJjBrpUkE4=", nil, true},
//{`V1: let i = 1; let s = "string"; toString(i) == s`, "AQQAAAABaQAAAAAAAAAAAQQAAAABcwIAAAAGc3RyaW5nCQAAAAAAAAIJAAGkAAAAAQUAAAABaQUAAAABcwIsH74=", nil, false},
//{`V3: let i = 12345; let s = "12345"; toString(i) == s`, "AwQAAAABaQAAAAAAAAAwOQQAAAABcwIAAAAFMTIzNDUJAAAAAAAAAgkAAaQAAAABBQAAAAFpBQAAAAFz1B1iCw==", nil, true},
//{`V3: if (true) then {let r = true; r} else {let r = false; r}`, "AwMGBAAAAAFyBgUAAAABcgQAAAABcgcFAAAAAXJ/ok0E", nil, true},
//{`V3: if (false) then {let r = true; r} else {let r = false; r}`, "AwMHBAAAAAFyBgUAAAABcgQAAAABcgcFAAAAAXI+tfo1", nil, false},
{`V1: true`, "AQa3b8tH", nil, true},
{`V3: let x = 1; true`, "AwQAAAABeAAAAAAAAAAAAQbtAkXn", nil, true},
{`V3: let x = "abc"; true`, "AwQAAAABeAIAAAADYWJjBrpUkE4=", nil, true},
{`V1: let i = 1; let s = "string"; toString(i) == s`, "AQQAAAABaQAAAAAAAAAAAQQAAAABcwIAAAAGc3RyaW5nCQAAAAAAAAIJAAGkAAAAAQUAAAABaQUAAAABcwIsH74=", nil, false},
{`V3: let i = 12345; let s = "12345"; toString(i) == s`, "AwQAAAABaQAAAAAAAAAwOQQAAAABcwIAAAAFMTIzNDUJAAAAAAAAAgkAAaQAAAABBQAAAAFpBQAAAAFz1B1iCw==", nil, true},
{`V3: if (true) then {let r = true; r} else {let r = false; r}`, "AwMGBAAAAAFyBgUAAAABcgQAAAABcgcFAAAAAXJ/ok0E", nil, true},
{`V3: if (false) then {let r = true; r} else {let r = false; r}`, "AwMHBAAAAAFyBgUAAAABcgQAAAABcgcFAAAAAXI+tfo1", nil, false},
//{`V3: func abs(i:Int) = if (i >= 0) then i else -i; abs(-10) == 10`, "AwoBAAAAA2FicwAAAAEAAAABaQMJAABnAAAAAgUAAAABaQAAAAAAAAAAAAUAAAABaQkBAAAAAS0AAAABBQAAAAFpCQAAAAAAAAIJAQAAAANhYnMAAAABAP/////////2AAAAAAAAAAAKmp8BWw==", nil, true},
//{`V3: let x = 1; func add(i: Int) = i + 1; add(x) == 2`, "AwQAAAABeAAAAAAAAAAAAQoBAAAAA2FkZAAAAAEAAAABaQkAAGQAAAACBQAAAAFpAAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAF4AAAAAAAAAAACfr6U6w==", nil, true},
//{`V3: let b = base16'0000000000000001'; func add(b: ByteVector) = toInt(b) + 1; add(b) == 2`, "AwQAAAABYgEAAAAIAAAAAAAAAAEKAQAAAANhZGQAAAABAAAAAWIJAABkAAAAAgkABLEAAAABBQAAAAFiAAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAFiAAAAAAAAAAACX00biA==", nil, true},
{`V3: let x = 1; func add(i: Int) = i + 1; add(x) == 2`, "AwQAAAABeAAAAAAAAAAAAQoBAAAAA2FkZAAAAAEAAAABaQkAAGQAAAACBQAAAAFpAAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAF4AAAAAAAAAAACfr6U6w==", env, true},
{`V3: let b = base16'0000000000000001'; func add(b: ByteVector) = toInt(b) + 1; add(b) == 2`, "AwQAAAABYgEAAAAIAAAAAAAAAAEKAQAAAANhZGQAAAABAAAAAWIJAABkAAAAAgkABLEAAAABBQAAAAFiAAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAFiAAAAAAAAAAACX00biA==", nil, true},
//{`V3: let b = base16'0000000000000001'; func add(v: ByteVector) = toInt(v) + 1; add(b) == 2`, "AwQAAAABYgEAAAAIAAAAAAAAAAEKAQAAAANhZGQAAAABAAAAAXYJAABkAAAAAgkABLEAAAABBQAAAAF2AAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAFiAAAAAAAAAAACI7gYxg==", nil, true},
//{`V3: let b = base16'0000000000000001'; func add(v: ByteVector) = toInt(b) + 1; add(b) == 2`, "AwQAAAABYgEAAAAIAAAAAAAAAAEKAQAAAANhZGQAAAABAAAAAXYJAABkAAAAAgkABLEAAAABBQAAAAFiAAAAAAAAAAABCQAAAAAAAAIJAQAAAANhZGQAAAABBQAAAAFiAAAAAAAAAAAChRvwnQ==", nil, true},
//{`V3: let data = base64'AAAAAAABhqAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWyt9GyysOW84u/u5V5Ah/SzLfef4c28UqXxowxFZS4SLiC6+XBh8D7aJDXyTTjpkPPED06ZPOzUE23V6VYCsLw=='; func getStock(data:ByteVector) = toInt(take(drop(data, 8), 8)); getStock(data) == 1`, `AwQAAAAEZGF0YQEAAABwAAAAAAABhqAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWyt9GyysOW84u/u5V5Ah/SzLfef4c28UqXxowxFZS4SLiC6+XBh8D7aJDXyTTjpkPPED06ZPOzUE23V6VYCsLwoBAAAACGdldFN0b2NrAAAAAQAAAARkYXRhCQAEsQAAAAEJAADJAAAAAgkAAMoAAAACBQAAAARkYXRhAAAAAAAAAAAIAAAAAAAAAAAICQAAAAAAAAIJAQAAAAhnZXRTdG9jawAAAAEFAAAABGRhdGEAAAAAAAAAAAFCtabi`, nil, true},
@@ -91,7 +91,7 @@ func Test22(t *testing.T) {
//{`let x = throw(); true`, `AQQAAAABeAkBAAAABXRocm93AAAAAAa7bgf4`, nil, true},
//{`let x = throw(); true || x`, `AQQAAAABeAkBAAAABXRocm93AAAAAAMGBgUAAAABeKRnLds=`, nil, true},
// Global variables
{`tx == tx`, "BAkAAAAAAAACBQAAAAJ0eAUAAAACdHhnqgP4", env, true},
//{`tx == tx`, "BAkAAAAAAAACBQAAAAJ0eAUAAAACdHhnqgP4", env, true},
//{`tx.id == base58''`, `AQkAAAAAAAACCAUAAAACdHgAAAACaWQBAAAAAJBtD70=`, env, false},
//{`tx.id == base58'H5C8bRzbUTMePSDVVxjiNKDUwk6CKzfZGTP2Rs7aCjsV'`, `BAkAAAAAAAACCAUAAAACdHgAAAACaWQBAAAAIO7N5luRDUgN1SJ4kFmy/Ni8U2H6k7bpszok5tlLlRVgHwSHyg==`, env, true},
//{`let x = tx.id == base58'a';true`, `AQQAAAABeAkAAAAAAAACCAUAAAACdHgAAAACaWQBAAAAASEGjR0kcA==`, env, true},
@@ -122,3 +122,34 @@ func Test22(t *testing.T) {
assert.Equal(t, test.res, r.Result(), test.comment)
}
}

/*

let x = 1; let y = 2; func gt(i: Int, i2: Int) = i > i2; gt(x, y)

*/
func Test33(t *testing.T) {

e := Executable{
LibVersion: 3,
ByteCode: []byte{
OpPush, 0, 0, OpReturn,
OpPush, 0, 1, OpReturn,
OpPushFromFrame, 0, 0,
OpPushFromFrame, 0, 1,
OpExternalCall, 0, 12, 0, 2,
OpReturn,
// ENTRYPOINT
OpJump, 0, 0, // jump to the beginning, first variable
OpJump, 0, 4, // jump to the second variable
OpJump, 0, 8, // вызов пользовательской функции add
OpReturn,
},
Constants: []rideType{rideInt(1), rideInt(2)},
EntryPoints: map[string]uint16{"": 20},
}

rs, err := e.Run(nil)
t.Log(rs)
t.Log(err)
}
13 changes: 7 additions & 6 deletions pkg/ride/compiler_fsm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ride

import "fmt"

type Fsm interface {
Assigment(name string) Fsm
Return() Fsm
@@ -12,6 +14,7 @@ type Fsm interface {
TrueBranch() Fsm
FalseBranch() Fsm
Bytes(b []byte) Fsm
FuncDeclaration(name string, args []string) Fsm
}

type FunctionChecker func(string) (uint16, bool)
@@ -23,8 +26,6 @@ type params struct {
c *constants
// relation of variables and it's offset.
r *references
// global variables defined not in script.
ctx Context
// way to get function id.
f FunctionChecker
}
@@ -56,10 +57,10 @@ func constant(a Fsm, params params, rideType rideType) Fsm {
func reference(f Fsm, params params, name string) Fsm {
pos, ok := params.r.get(name)
if !ok {
index := params.c.put(rideString(name))
params.b.fillContext(index)
//panic(fmt.Sprintf("reference %s not found", name))
return f
//index := params.c.put(rideString(name))
//params.b.fillContext(index)
panic(fmt.Sprintf("reference %s not found", name))
//return f
}
params.b.jump(pos)
return f
12 changes: 9 additions & 3 deletions pkg/ride/compiler_fsm_assigment.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@ type AssigmentFsm struct {
offset uint16
}

func (a AssigmentFsm) FuncDeclaration(name string, args []string) Fsm {
return funcDeclarationFsmTransition(a, a.params, name, args)
}

func (a AssigmentFsm) Bytes(b []byte) Fsm {
return constant(a, a.params, rideBytes(b))
}
@@ -43,16 +47,18 @@ func newAssigmentFsm(prev Fsm, p params, name string) Fsm {
b: p.b,
c: p.c,
f: p.f,
// Create new scope, so assigment in assigment can't affect global state.
r: newReferences(p.r),
r: p.r,
},
name: name,
offset: p.b.len(),
}
}

// Create new scope, so assigment in assigment can't affect global state.
func (a AssigmentFsm) Assigment(name string) Fsm {
return assigmentFsmTransition(a, a.params, name)
params := a.params
params.r = newReferences(params.r)
return assigmentFsmTransition(a, params, name)
}

func (a AssigmentFsm) Return() Fsm {
15 changes: 13 additions & 2 deletions pkg/ride/compiler_fsm_call.go
Original file line number Diff line number Diff line change
@@ -10,6 +10,10 @@ type CallFsm struct {
argc uint16
}

func (a CallFsm) FuncDeclaration(name string, args []string) Fsm {
return funcDeclarationFsmTransition(a, a.params, name, args)
}

func (a CallFsm) Bytes(b []byte) Fsm {
return constant(a, a.params, rideBytes(b))
}
@@ -56,9 +60,16 @@ func (a CallFsm) Long(value int64) Fsm {
}

func (a CallFsm) Return() Fsm {
n, ok := a.f(a.name)
// check user functions
n, ok := a.r.get(a.name)
if ok {
a.b.call(n, a.argc)
return a.prev
}

n, ok = a.f(a.name)
if !ok {
panic(fmt.Sprintf("function names %s not found", a.name))
panic(fmt.Sprintf("function named %s not found", a.name))
}
a.b.externalCall(n, a.argc)
return a.prev
4 changes: 4 additions & 0 deletions pkg/ride/compiler_fsm_conditional.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,10 @@ type ConditionalFsm struct {
patchPosition uint16
}

func (a ConditionalFsm) FuncDeclaration(name string, args []string) Fsm {
panic("Illegal call FuncDeclaration on ConditionalFsm")
}

func (a ConditionalFsm) Bytes(b []byte) Fsm {
return constant(a, a.params, rideBytes(b))
}
4 changes: 4 additions & 0 deletions pkg/ride/compiler_fsm_definitions.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@ type DefinitionFsm struct {
params
}

func (a DefinitionFsm) FuncDeclaration(name string, args []string) Fsm {
return funcDeclarationFsmTransition(a, a.params, name, args)
}

func (a DefinitionFsm) Bytes(b []byte) Fsm {
panic("Illegal call `Bytes` on `DefinitionFsm`")
}
83 changes: 83 additions & 0 deletions pkg/ride/compiler_fsm_func_declaration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package ride

type FuncDeclarationFsm struct {
params
prev Fsm
name string
args []string
offset uint16
globalScope *references
}

func funcDeclarationFsmTransition(prev Fsm, params params, name string, args []string) Fsm {
// save reference to global scope, where code lower that function will be able to use it.
globalScope := params.r
// all variable we add only visible to current scope,
// avoid corrupting parent state.
params.r = newReferences(params.r)
for i := range args {
params.r.set(args[i], params.b.len())
params.b.w.WriteByte(OpPushFromFrame)
params.b.w.Write(encode(uint16(i)))
params.b.ret()
}

return &FuncDeclarationFsm{
prev: prev,
name: name,
args: args,
params: params,
offset: params.b.len(),
globalScope: globalScope,
}
}

func (a FuncDeclarationFsm) Assigment(name string) Fsm {
return assigmentFsmTransition(a, a.params, name)
}

func (a FuncDeclarationFsm) Return() Fsm {
a.globalScope.set(a.name, a.offset)
a.b.ret()
return a.prev
}

func (a FuncDeclarationFsm) Long(value int64) Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) Call(name string, argc uint16) Fsm {
return callTransition(a, a.params, name, argc)
}

func (a FuncDeclarationFsm) Reference(name string) Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) Boolean(v bool) Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) String(s string) Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) Condition() Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) TrueBranch() Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) FalseBranch() Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) Bytes(b []byte) Fsm {
panic("implement me")
}

func (a FuncDeclarationFsm) FuncDeclaration(name string, args []string) Fsm {
panic("Illegal call `FuncDeclaration` is `FuncDeclarationFsm`")
}
15 changes: 11 additions & 4 deletions pkg/ride/compiler_helpers.go
Original file line number Diff line number Diff line change
@@ -66,6 +66,13 @@ func (b *builder) externalCall(id uint16, argc uint16) {
b.w.Write(encode(argc))
}

// Call user defined function.
func (b *builder) call(id uint16, argc uint16) {
b.w.WriteByte(OpCall)
b.w.Write(encode(id))
b.w.Write(encode(argc))
}

func (b *builder) startPos() {
b.startAt = uint16(b.w.Len())
}
@@ -78,10 +85,10 @@ func (b *builder) jpmIfFalse() {
b.w.WriteByte(OpJumpIfFalse)
}

func (b *builder) fillContext(id constid) {
b.w.WriteByte(OpFillContext)
b.w.Write(encode(id))
}
//func (b *builder) fillContext(id constid) {
// b.w.WriteByte(OpFillContext)
// b.w.Write(encode(id))
//}

type constants struct {
values []rideType
13 changes: 10 additions & 3 deletions pkg/ride/executable.go
Original file line number Diff line number Diff line change
@@ -13,16 +13,23 @@ func (a *Executable) Run(environment RideEnvironment) (RideResult, error) {
return nil, err
}

ctx := newContext()
ctx = ctx.add("tx", environment.transaction())
provider, err := selectFunctionNameProvider(a.LibVersion)
if err != nil {
return nil, err
}
//ctx := newContext()
//ctx = ctx.add("tx", environment.transaction())

v := vm{
code: a.ByteCode,
ip: int(a.EntryPoints[""]),
constants: a.Constants,
functions: fSelect,
context: ctx,
//context: ctx,
functionName: provider,
}

//v.push(environment.transaction())

return v.run()
}
33 changes: 17 additions & 16 deletions pkg/ride/opcodes.go
Original file line number Diff line number Diff line change
@@ -4,20 +4,21 @@ package ride
// Parameter is 2 bytes length

const (
OpHalt byte = iota //00 - Halts program execution. No parameters.
OpReturn //01 - Returns from declaration to stored position. No parameters.
OpPush //02 - Put constant on stack. One parameter: constant ID.
OpPop //03 - Removes value from stack. No parameters.
OpTrue //04 - Put True value on stack. No parameters.
OpFalse //05 - Put False value on stack. No parameters.
OpJump //06 - Moves instruction pointer to new position. One parameter: new position.
OpJumpIfFalse //07 - Moves instruction pointer to new position if value on stack is False. One parameter: new position.
OpProperty //08 - Puts value of object's property on stack. One parameter: constant ID that holds name of the property.
OpExternalCall //09 - Call a standard library function. Two parameters: function ID, number of arguments.
OpCall //10 - Call a function declared at given address. Two parameters: position of function declaration, number of arguments.
OpGlobal //11 - Load global constant. One parameter: global constant ID.
OpLoad //12 - Evaluates an expression that declared at address. One parameter: position of declaration.
OpLoadLocal //13 - Load an argument of function call on stack. One parameter: argument number.
OpRef //14 - Put reference to expression/function on stack. One parameter: position of declaration.
OpFillContext //15 - Put reference to expression/function on stack. One parameter: position of declaration.
OpHalt byte = iota //00 - Halts program execution. No parameters.
OpReturn //01 - Returns from declaration to stored position. No parameters.
OpPush //02 - Put constant on stack. One parameter: constant ID.
OpPop //03 - Removes value from stack. No parameters.
OpTrue //04 - Put True value on stack. No parameters.
OpFalse //05 - Put False value on stack. No parameters.
OpJump //06 - Moves instruction pointer to new position. One parameter: new position.
OpJumpIfFalse //07 - Moves instruction pointer to new position if value on stack is False. One parameter: new position.
OpProperty //08 - Puts value of object's property on stack. One parameter: constant ID that holds name of the property.
OpExternalCall //09 - Call a standard library function. Two parameters: function ID, number of arguments.
OpCall //10 - Call a function declared at given address. Two parameters: position of function declaration, number of arguments.
OpGlobal //11 - Load global constant. One parameter: global constant ID.
OpLoad //12 - Evaluates an expression that declared at address. One parameter: position of declaration.
OpLoadLocal //13 - Load an argument of function call on stack. One parameter: argument number.
OpRef //14 - Put reference to expression/function on stack. One parameter: position of declaration.
OpFillContext //15 - Put reference to expression/function on stack. One parameter: position of declaration.
OpPushFromFrame //16
)
Loading