diff --git a/lox_tests/and/execute b/lox_tests/and/execute deleted file mode 100644 index f6b9d9d..0000000 --- a/lox_tests/and/execute +++ /dev/null @@ -1,24 +0,0 @@ -execute: Some( - False, -) -stack: [, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 4, - ), -) -stack: [, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/arithmetic/execute b/lox_tests/arithmetic/execute deleted file mode 100644 index 691ef83..0000000 --- a/lox_tests/arithmetic/execute +++ /dev/null @@ -1,186 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Add, -) -stack: [, 3] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 3.0, - ), - ), -) -stack: [, 1, 2, 3] -stdout: "" - -execute: Some( - Multiply, -) -stack: [, 1, 6] -stdout: "" - -execute: Some( - Add, -) -stack: [, 7] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 3.0, - ), - ), -) -stack: [, 1, 2, 3] -stdout: "" - -execute: Some( - Divide, -) -stack: [, 1, 0.6666666666666666] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, 0.33333333333333337] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 3.0, - ), - ), -) -stack: [, 1, 2, 3] -stdout: "" - -execute: Some( - Negate, -) -stack: [, 1, 2, -3] -stdout: "" - -execute: Some( - Multiply, -) -stack: [, 1, -6] -stdout: "" - -execute: Some( - Add, -) -stack: [, -5] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/assignment/execute b/lox_tests/assignment/execute deleted file mode 100644 index 9b7d24e..0000000 --- a/lox_tests/assignment/execute +++ /dev/null @@ -1,150 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "a", - }, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 2] -stdout: "" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 2] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 2] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "2\n" - -execute: Some( - Constant( - F64( - 3.0, - ), - ), -) -stack: [, 3] -stdout: "2\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 3] -stdout: "2\n" - -execute: Some( - Print, -) -stack: [] -stdout: "2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 3] -stdout: "2\n3\n" - -execute: Some( - GlobalVarDeclaration { - name: "b", - }, -) -stack: [] -stdout: "2\n3\n" - -execute: Some( - Nil, -) -stack: [, nil] -stdout: "2\n3\n" - -execute: Some( - GlobalVarDeclaration { - name: "c", - }, -) -stack: [] -stdout: "2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "b", - }, -) -stack: [, 3] -stdout: "2\n3\n" - -execute: Some( - WriteGlobalVariable { - name: "c", - }, -) -stack: [, 3] -stdout: "2\n3\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "c", - }, -) -stack: [, 3] -stdout: "2\n3\n" - -execute: Some( - Print, -) -stack: [] -stdout: "2\n3\n3\n" - -execute: None -stack: [] -stdout: "2\n3\n3\n" - diff --git a/lox_tests/boolean/execute b/lox_tests/boolean/execute deleted file mode 100644 index cdd0f1a..0000000 --- a/lox_tests/boolean/execute +++ /dev/null @@ -1,64 +0,0 @@ -execute: Some( - True, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - False, -) -stack: [, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - True, -) -stack: [, true] -stdout: "" - -execute: Some( - Not, -) -stack: [, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - False, -) -stack: [, false] -stdout: "" - -execute: Some( - Not, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/closure/execute b/lox_tests/closure/execute deleted file mode 100644 index fc92335..0000000 --- a/lox_tests/closure/execute +++ /dev/null @@ -1,187 +0,0 @@ -execute: Some( - String( - "global", - ), -) -stack: [, global] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "x", - }, -) -stack: [] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "outer", - arity: 0, - chunk: Chunk { - code: [ - String( - "outer", - ), - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, - ReadLocalVariable { - index_in_stack: 1, - }, - Call { - arity: 0, - }, - Pop, - Pop, - CloseUpvalue, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "outer", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "outer", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "" - -execute: Some( - String( - "outer", - ), -) -stack: [, , outer] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, -) -stack: [, , outer, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, , outer, , ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, , outer, , ] -stdout: "" - -execute: Some( - ReadUpvalue { - index: 0, - }, -) -stack: [, , outer, , , outer] -stdout: "" - -execute: Some( - Print, -) -stack: [, , outer, , ] -stdout: "outer\n" - -execute: None -stack: [, , outer, ] -stdout: "outer\n" - -execute: Some( - Pop, -) -stack: [, , outer] -stdout: "outer\n" - -execute: Some( - Pop, -) -stack: [, ] -stdout: "outer\n" - -execute: Some( - CloseUpvalue, -) -stack: [] -stdout: "outer\n" - -execute: None -stack: [] -stdout: "outer\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "outer\n" - -execute: None -stack: [] -stdout: "outer\n" - diff --git a/lox_tests/closure2/execute b/lox_tests/closure2/execute deleted file mode 100644 index 631ad92..0000000 --- a/lox_tests/closure2/execute +++ /dev/null @@ -1,276 +0,0 @@ -execute: Some( - Closure { - function: Function { - name: "outer", - arity: 0, - chunk: Chunk { - code: [ - String( - "value", - ), - Closure { - function: Function { - name: "middle", - arity: 0, - chunk: Chunk { - code: [ - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, - ReadLocalVariable { - index_in_stack: 0, - }, - Call { - arity: 0, - }, - Pop, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, - ReadLocalVariable { - index_in_stack: 1, - }, - Call { - arity: 0, - }, - Pop, - Pop, - CloseUpvalue, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "outer", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "outer", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "" - -execute: Some( - String( - "value", - ), -) -stack: [, , value] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "middle", - arity: 0, - chunk: Chunk { - code: [ - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, - ReadLocalVariable { - index_in_stack: 0, - }, - Call { - arity: 0, - }, - Pop, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, -) -stack: [, , value, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, , value, , ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, , value, , ] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, -) -stack: [, , value, , , ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , value, , , , ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, , value, , , , ] -stdout: "" - -execute: Some( - ReadUpvalue { - index: 0, - }, -) -stack: [, , value, , , , , value] -stdout: "" - -execute: Some( - Print, -) -stack: [, , value, , , , ] -stdout: "value\n" - -execute: None -stack: [, , value, , , ] -stdout: "value\n" - -execute: Some( - Pop, -) -stack: [, , value, , ] -stdout: "value\n" - -execute: Some( - Pop, -) -stack: [, , value, ] -stdout: "value\n" - -execute: None -stack: [, , value, ] -stdout: "value\n" - -execute: Some( - Pop, -) -stack: [, , value] -stdout: "value\n" - -execute: Some( - Pop, -) -stack: [, ] -stdout: "value\n" - -execute: Some( - CloseUpvalue, -) -stack: [] -stdout: "value\n" - -execute: None -stack: [] -stdout: "value\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "value\n" - -execute: None -stack: [] -stdout: "value\n" - diff --git a/lox_tests/closure3/execute b/lox_tests/closure3/execute deleted file mode 100644 index 0950b5b..0000000 --- a/lox_tests/closure3/execute +++ /dev/null @@ -1,249 +0,0 @@ -execute: Some( - String( - "global", - ), -) -stack: [, global] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "x", - }, -) -stack: [] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "outer", - arity: 0, - chunk: Chunk { - code: [ - String( - "outer", - ), - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - String( - "inner", - ), - WriteUpvalue { - index: 1, - }, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - Upvalue { - index: 0, - is_local: true, - }, - ], - }, - ReadLocalVariable { - index_in_stack: 1, - }, - Call { - arity: 0, - }, - Pop, - ReadLocalVariable { - index_in_stack: 0, - }, - Print, - Pop, - CloseUpvalue, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "outer", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "outer", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "" - -execute: Some( - String( - "outer", - ), -) -stack: [, , outer] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - String( - "inner", - ), - WriteUpvalue { - index: 1, - }, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - Upvalue { - index: 0, - is_local: true, - }, - ], - }, -) -stack: [, , outer, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, , outer, , ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, , outer, , ] -stdout: "" - -execute: Some( - ReadUpvalue { - index: 0, - }, -) -stack: [, , outer, , , outer] -stdout: "" - -execute: Some( - Print, -) -stack: [, , outer, , ] -stdout: "outer\n" - -execute: Some( - String( - "inner", - ), -) -stack: [, , outer, , , inner] -stdout: "outer\n" - -execute: Some( - WriteUpvalue { - index: 1, - }, -) -stack: [, , inner, , , inner] -stdout: "outer\n" - -execute: Some( - Pop, -) -stack: [, , inner, , ] -stdout: "outer\n" - -execute: None -stack: [, , inner, ] -stdout: "outer\n" - -execute: Some( - Pop, -) -stack: [, , inner] -stdout: "outer\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , inner, inner] -stdout: "outer\n" - -execute: Some( - Print, -) -stack: [, , inner] -stdout: "outer\ninner\n" - -execute: Some( - Pop, -) -stack: [, ] -stdout: "outer\ninner\n" - -execute: Some( - CloseUpvalue, -) -stack: [] -stdout: "outer\ninner\n" - -execute: None -stack: [] -stdout: "outer\ninner\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "outer\ninner\n" - -execute: None -stack: [] -stdout: "outer\ninner\n" - diff --git a/lox_tests/closure4/execute b/lox_tests/closure4/execute deleted file mode 100644 index 0da0e97..0000000 --- a/lox_tests/closure4/execute +++ /dev/null @@ -1,313 +0,0 @@ -execute: Some( - Closure { - function: Function { - name: "outer", - arity: 0, - chunk: Chunk { - code: [ - String( - "value", - ), - Closure { - function: Function { - name: "middle", - arity: 0, - chunk: Chunk { - code: [ - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, - String( - "create inner closure", - ), - Print, - ReadLocalVariable { - index_in_stack: 0, - }, - Return, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, - String( - "return from outer", - ), - Print, - ReadLocalVariable { - index_in_stack: 1, - }, - Return, - Pop, - CloseUpvalue, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "outer", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "outer", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "" - -execute: Some( - String( - "value", - ), -) -stack: [, , value] -stdout: "" - -execute: Some( - Closure { - function: Function { - name: "middle", - arity: 0, - chunk: Chunk { - code: [ - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, - String( - "create inner closure", - ), - Print, - ReadLocalVariable { - index_in_stack: 0, - }, - Return, - Pop, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: true, - }, - ], - }, -) -stack: [, , value, ] -stdout: "" - -execute: Some( - String( - "return from outer", - ), -) -stack: [, , value, , return from outer] -stdout: "" - -execute: Some( - Print, -) -stack: [, , value, ] -stdout: "return from outer\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, , value, , ] -stdout: "return from outer\n" - -execute: Some( - Return, -) -stack: [, ] -stdout: "return from outer\n" - -execute: Some( - GlobalVarDeclaration { - name: "mid", - }, -) -stack: [] -stdout: "return from outer\n" - -execute: Some( - ReadGlobalVariable { - name: "mid", - }, -) -stack: [, ] -stdout: "return from outer\n" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "return from outer\n" - -execute: Some( - Closure { - function: Function { - name: "inner", - arity: 0, - chunk: Chunk { - code: [ - ReadUpvalue { - index: 0, - }, - Print, - ], - }, - }, - upvalues: [ - Upvalue { - index: 0, - is_local: false, - }, - ], - }, -) -stack: [, , ] -stdout: "return from outer\n" - -execute: Some( - String( - "create inner closure", - ), -) -stack: [, , , create inner closure] -stdout: "return from outer\n" - -execute: Some( - Print, -) -stack: [, , ] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , , ] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - Return, -) -stack: [, ] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - GlobalVarDeclaration { - name: "in", - }, -) -stack: [] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - ReadGlobalVariable { - name: "in", - }, -) -stack: [, ] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - ReadUpvalue { - index: 0, - }, -) -stack: [, , value] -stdout: "return from outer\ncreate inner closure\n" - -execute: Some( - Print, -) -stack: [, ] -stdout: "return from outer\ncreate inner closure\nvalue\n" - -execute: None -stack: [] -stdout: "return from outer\ncreate inner closure\nvalue\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "return from outer\ncreate inner closure\nvalue\n" - -execute: None -stack: [] -stdout: "return from outer\ncreate inner closure\nvalue\n" - diff --git a/lox_tests/comparison/execute b/lox_tests/comparison/execute deleted file mode 100644 index 9639bea..0000000 --- a/lox_tests/comparison/execute +++ /dev/null @@ -1,132 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Less, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Greater, -) -stack: [, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1, 1] -stdout: "" - -execute: Some( - GreaterEqual, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/equality/execute b/lox_tests/equality/execute deleted file mode 100644 index 354a6d9..0000000 --- a/lox_tests/equality/execute +++ /dev/null @@ -1,68 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Equal, -) -stack: [, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - NotEqual, -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/fib/execute b/lox_tests/fib/execute deleted file mode 100644 index f3b4093..0000000 --- a/lox_tests/fib/execute +++ /dev/null @@ -1,1439 +0,0 @@ -execute: Some( - Closure { - function: Function { - name: "fib", - arity: 1, - chunk: Chunk { - code: [ - ReadLocalVariable { - index_in_stack: 0, - }, - Constant( - F64( - 1.0, - ), - ), - LessEqual, - JumpIfFalse( - 8, - ), - Pop, - ReadLocalVariable { - index_in_stack: 0, - }, - Return, - Jump( - 9, - ), - Pop, - ReadGlobalVariable { - name: "fib", - }, - ReadLocalVariable { - index_in_stack: 0, - }, - Constant( - F64( - 1.0, - ), - ), - Subtract, - Call { - arity: 1, - }, - ReadGlobalVariable { - name: "fib", - }, - ReadLocalVariable { - index_in_stack: 0, - }, - Constant( - F64( - 2.0, - ), - ), - Subtract, - Call { - arity: 1, - }, - Add, - Return, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "fib", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, , 5] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 5] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 5, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 5] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 5, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 4] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, 4, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 4] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 4, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, , 3] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, , 3] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, 3] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, 3, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, , 3, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, , 3, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, , 3] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, , 3, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 3] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 3, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, , 3, , 2] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, , 3, , 2] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 2, 2, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, , 3, , 2, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, , 3, , 2, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, , 3, , 2] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, , 3, , 2, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 2, , 2, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, , 3, , 2, , 1] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, , 3, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, , 1, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 2, , 1, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, , 3, , 2, , 1, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, , 3, , 2, , 1, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, , 3, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, , 1, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, , 3, , 2, 1] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, , 3, , 2, 1, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 2, 1, , 2, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0, 0, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, , 3, , 2, 1, 0] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, , 4, , 3, , 2, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, , 3, 1] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, , 3, 1, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, 1, , 3] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, , 4, , 3, 1, , 3, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, , 3, 1, , 1] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, , 3, 1, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, 1, , 1, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, , 3, 1, , 1, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, , 3, 1, , 1, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, , 3, 1, , 1, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, , 3, 1, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, , 3, 1, , 1, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, , 3, 1, 1] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, , 4, , 3, 2] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, 2] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, 2, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 4] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 4, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, 2, , 2] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, 2, , 2] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 2, 2, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, 2, , 2, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, 2, , 2, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, 2, , 2] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, 2, , 2, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 2, , 2, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, 2, , 2, , 1] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, 2, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, , 1, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 2, , 1, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, 2, , 2, , 1, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, 2, , 2, , 1, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, 2, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, , 1, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, 2, , 2, 1] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, , 4, 2, , 2, 1, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, 1, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 2, 1, , 2, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, , 4, 2, , 2, 1, , 0, 0, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, , 4, 2, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, , 4, 2, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, 2, , 2, 1, 0] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, , 4, 2, , 2, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, , 4, 2, 1] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, , 4, 3] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, 3, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 5] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, 3, , 5, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, 3, , 3] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, 3, , 3] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, 3] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, 3, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, 3, , 3, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, 3, , 3, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, 3, , 3] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, 3, , 3, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 3] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 3, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, 3, , 3, , 2] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, 3, , 3, , 2] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 2, 2, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, 3, , 3, , 2, false] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, 3, , 3, , 2, false] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, 3, , 3, , 2] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, 3, , 3, , 2, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 2, , 2, 1] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, 3, , 3, , 2, , 1] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, 3, , 3, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, , 1, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 2, , 1, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, 3, , 3, , 2, , 1, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, 3, , 3, , 2, , 1, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, 3, , 3, , 2, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, , 1, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3, , 3, , 2, 1] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, 3, , 3, , 2, 1, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, 1, , 2] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 2, 1, , 2, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, , 2, 1, , 0, 0, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, 3, , 3, , 2, 1, , 0, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, , 2, 1, , 0, 0] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3, , 3, , 2, 1, 0] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, 3, , 3, , 2, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3, , 3, 1] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "fib", - }, -) -stack: [, , 5, 3, , 3, 1, ] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, 1, , 3] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, , 5, 3, , 3, 1, , 3, 2] -stdout: "" - -execute: Some( - Subtract, -) -stack: [, , 5, 3, , 3, 1, , 1] -stdout: "" - -execute: Some( - Call { - arity: 1, - }, -) -stack: [, , 5, 3, , 3, 1, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, 1, , 1, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, , 5, 3, , 3, 1, , 1, 1, 1] -stdout: "" - -execute: Some( - LessEqual, -) -stack: [, , 5, 3, , 3, 1, , 1, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 8, - ), -) -stack: [, , 5, 3, , 3, 1, , 1, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [, , 5, 3, , 3, 1, , 1] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, , 5, 3, , 3, 1, , 1, 1] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3, , 3, 1, 1] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, 3, , 3, 2] -stdout: "" - -execute: Some( - Return, -) -stack: [, , 5, 3, 2] -stdout: "" - -execute: Some( - Add, -) -stack: [, , 5, 5] -stdout: "" - -execute: Some( - Return, -) -stack: [, 5] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "5\n" - -execute: None -stack: [] -stdout: "5\n" - diff --git a/lox_tests/for/execute b/lox_tests/for/execute deleted file mode 100644 index 3187308..0000000 --- a/lox_tests/for/execute +++ /dev/null @@ -1,1040 +0,0 @@ -execute: Some( - Constant( - F64( - 0.0, - ), - ), -) -stack: [, 0] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "i", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 0] -stdout: "" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 0, 10] -stdout: "" - -execute: Some( - Less, -) -stack: [, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 0] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 0] -stdout: "0\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 0, 1] -stdout: "0\n" - -execute: Some( - Add, -) -stack: [, 1] -stdout: "0\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 1] -stdout: "0\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 1] -stdout: "0\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 1, 10] -stdout: "0\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 1] -stdout: "0\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 1] -stdout: "0\n1\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1, 1] -stdout: "0\n1\n" - -execute: Some( - Add, -) -stack: [, 2] -stdout: "0\n1\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 2] -stdout: "0\n1\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 2] -stdout: "0\n1\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 2, 10] -stdout: "0\n1\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 2] -stdout: "0\n1\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 2] -stdout: "0\n1\n2\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 2, 1] -stdout: "0\n1\n2\n" - -execute: Some( - Add, -) -stack: [, 3] -stdout: "0\n1\n2\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 3] -stdout: "0\n1\n2\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 3] -stdout: "0\n1\n2\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 3, 10] -stdout: "0\n1\n2\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 3] -stdout: "0\n1\n2\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 3] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 3, 1] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Add, -) -stack: [, 4] -stdout: "0\n1\n2\n3\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 4] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 4] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 4, 10] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 4] -stdout: "0\n1\n2\n3\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 4] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 4, 1] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Add, -) -stack: [, 5] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 5] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 5] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 5, 10] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 5] -stdout: "0\n1\n2\n3\n4\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 5] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 5, 1] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Add, -) -stack: [, 6] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 6] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 6] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 6, 10] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 6] -stdout: "0\n1\n2\n3\n4\n5\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 6] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 6, 1] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Add, -) -stack: [, 7] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 7] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 7] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 7, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 7] -stdout: "0\n1\n2\n3\n4\n5\n6\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 7] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 7, 1] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Add, -) -stack: [, 8] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 8] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 8] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 8, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 8] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 8] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 8, 1] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Add, -) -stack: [, 9] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 9] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 9] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 9, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 9] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n" - -execute: Some( - Print, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 9] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 9, 1] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Add, -) -stack: [, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - WriteGlobalVariable { - name: "i", - }, -) -stack: [, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - ReadGlobalVariable { - name: "i", - }, -) -stack: [, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Constant( - F64( - 10.0, - ), - ), -) -stack: [, 10, 10] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Less, -) -stack: [, false] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, false] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - -execute: None -stack: [] -stdout: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n" - diff --git a/lox_tests/func/execute b/lox_tests/func/execute deleted file mode 100644 index bcd04e3..0000000 --- a/lox_tests/func/execute +++ /dev/null @@ -1,204 +0,0 @@ -execute: Some( - Closure { - function: Function { - name: "hello", - arity: 0, - chunk: Chunk { - code: [ - String( - "hello", - ), - Print, - ], - }, - }, - upvalues: [], - }, -) -stack: [, ] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "hello", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "hello", - }, -) -stack: [, ] -stdout: "" - -execute: Some( - Call { - arity: 0, - }, -) -stack: [, ] -stdout: "" - -execute: Some( - String( - "hello", - ), -) -stack: [, , hello] -stdout: "" - -execute: Some( - Print, -) -stack: [, ] -stdout: "hello\n" - -execute: None -stack: [] -stdout: "hello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\n" - -execute: Some( - String( - "world", - ), -) -stack: [world] -stdout: "hello\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nworld\n" - -execute: Some( - Closure { - function: Function { - name: "add", - arity: 2, - chunk: Chunk { - code: [ - ReadLocalVariable { - index_in_stack: 0, - }, - ReadLocalVariable { - index_in_stack: 1, - }, - Add, - Return, - ], - }, - }, - upvalues: [], - }, -) -stack: [] -stdout: "hello\nworld\n" - -execute: Some( - GlobalVarDeclaration { - name: "add", - }, -) -stack: [] -stdout: "hello\nworld\n" - -execute: Some( - ReadGlobalVariable { - name: "add", - }, -) -stack: [] -stdout: "hello\nworld\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "hello\nworld\n" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "hello\nworld\n" - -execute: Some( - Call { - arity: 2, - }, -) -stack: [, 1, 2] -stdout: "hello\nworld\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, 1, 2, 1] -stdout: "hello\nworld\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, 1, 2, 1, 2] -stdout: "hello\nworld\n" - -execute: Some( - Add, -) -stack: [, 1, 2, 3] -stdout: "hello\nworld\n" - -execute: Some( - Return, -) -stack: [3] -stdout: "hello\nworld\n" - -execute: Some( - GlobalVarDeclaration { - name: "c", - }, -) -stack: [] -stdout: "hello\nworld\n" - -execute: Some( - ReadGlobalVariable { - name: "c", - }, -) -stack: [3] -stdout: "hello\nworld\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nworld\n3\n" - -execute: None -stack: [] -stdout: "hello\nworld\n3\n" - diff --git a/lox_tests/if/execute b/lox_tests/if/execute deleted file mode 100644 index 9a5236d..0000000 --- a/lox_tests/if/execute +++ /dev/null @@ -1,46 +0,0 @@ -execute: Some( - True, -) -stack: [, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 6, - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - String( - "true", - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "true\n" - -execute: Some( - Jump( - 9, - ), -) -stack: [] -stdout: "true\n" - -execute: None -stack: [] -stdout: "true\n" - diff --git a/lox_tests/local_var/execute b/lox_tests/local_var/execute deleted file mode 100644 index 4b8b86a..0000000 --- a/lox_tests/local_var/execute +++ /dev/null @@ -1,64 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 1, - }, -) -stack: [, 1, 2, 2] -stdout: "" - -execute: Some( - Print, -) -stack: [, 1, 2] -stdout: "2\n" - -execute: Some( - Pop, -) -stack: [, 1] -stdout: "2\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, 1, 1] -stdout: "2\n" - -execute: Some( - Print, -) -stack: [, 1] -stdout: "2\n1\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "2\n1\n" - -execute: None -stack: [] -stdout: "2\n1\n" - diff --git a/lox_tests/local_var_assign/execute b/lox_tests/local_var_assign/execute deleted file mode 100644 index 98256b2..0000000 --- a/lox_tests/local_var_assign/execute +++ /dev/null @@ -1,72 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - WriteLocalVariable { - index_in_stack: 0, - }, -) -stack: [, 2, 2] -stdout: "" - -execute: Some( - Pop, -) -stack: [, 2] -stdout: "" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, 2, 2] -stdout: "" - -execute: Some( - Print, -) -stack: [, 2] -stdout: "2\n" - -execute: Some( - ReadLocalVariable { - index_in_stack: 0, - }, -) -stack: [, 2, 2] -stdout: "2\n" - -execute: Some( - Print, -) -stack: [, 2] -stdout: "2\n2\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "2\n2\n" - -execute: None -stack: [] -stdout: "2\n2\n" - diff --git a/lox_tests/or/execute b/lox_tests/or/execute deleted file mode 100644 index 78be13c..0000000 --- a/lox_tests/or/execute +++ /dev/null @@ -1,32 +0,0 @@ -execute: Some( - True, -) -stack: [, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 3, - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Jump( - 4, - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/print/execute b/lox_tests/print/execute deleted file mode 100644 index 4116db2..0000000 --- a/lox_tests/print/execute +++ /dev/null @@ -1,36 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - Constant( - F64( - 2.0, - ), - ), -) -stack: [, 1, 2] -stdout: "" - -execute: Some( - Add, -) -stack: [, 3] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "3\n" - -execute: None -stack: [] -stdout: "3\n" - diff --git a/lox_tests/string/execute b/lox_tests/string/execute deleted file mode 100644 index 6bb7a54..0000000 --- a/lox_tests/string/execute +++ /dev/null @@ -1,32 +0,0 @@ -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "" - -execute: Some( - String( - " world", - ), -) -stack: [, hello, world] -stdout: "" - -execute: Some( - Add, -) -stack: [, hello world] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: None -stack: [] -stdout: "" - diff --git a/lox_tests/var/execute b/lox_tests/var/execute deleted file mode 100644 index 10af0a7..0000000 --- a/lox_tests/var/execute +++ /dev/null @@ -1,110 +0,0 @@ -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "a", - }, -) -stack: [] -stdout: "" - -execute: Some( - Nil, -) -stack: [, nil] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "b", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 1] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "1\n" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "1\n" - -execute: Some( - GlobalVarDeclaration { - name: "str1", - }, -) -stack: [] -stdout: "1\n" - -execute: Some( - String( - "world", - ), -) -stack: [, world] -stdout: "1\n" - -execute: Some( - GlobalVarDeclaration { - name: "str2", - }, -) -stack: [] -stdout: "1\n" - -execute: Some( - ReadGlobalVariable { - name: "str1", - }, -) -stack: [, hello] -stdout: "1\n" - -execute: Some( - ReadGlobalVariable { - name: "str2", - }, -) -stack: [, hello, world] -stdout: "1\n" - -execute: Some( - Add, -) -stack: [, helloworld] -stdout: "1\n" - -execute: Some( - Print, -) -stack: [] -stdout: "1\nhelloworld\n" - -execute: None -stack: [] -stdout: "1\nhelloworld\n" - diff --git a/lox_tests/while/execute b/lox_tests/while/execute deleted file mode 100644 index 1c094ce..0000000 --- a/lox_tests/while/execute +++ /dev/null @@ -1,550 +0,0 @@ -execute: Some( - Constant( - F64( - 0.0, - ), - ), -) -stack: [, 0] -stdout: "" - -execute: Some( - GlobalVarDeclaration { - name: "a", - }, -) -stack: [] -stdout: "" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 0] -stdout: "" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 0, 5] -stdout: "" - -execute: Some( - Less, -) -stack: [, true] -stdout: "" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "" - -execute: Some( - Pop, -) -stack: [] -stdout: "" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 0] -stdout: "hello\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 0, 1] -stdout: "hello\n" - -execute: Some( - Add, -) -stack: [, 1] -stdout: "hello\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 1] -stdout: "hello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "hello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 1] -stdout: "hello\n" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 1, 5] -stdout: "hello\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "hello\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "hello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\n" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "hello\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 1] -stdout: "hello\nhello\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 1, 1] -stdout: "hello\nhello\n" - -execute: Some( - Add, -) -stack: [, 2] -stdout: "hello\nhello\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 2] -stdout: "hello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "hello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 2] -stdout: "hello\nhello\n" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 2, 5] -stdout: "hello\nhello\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "hello\nhello\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "hello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\n" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "hello\nhello\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 2] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 2, 1] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Add, -) -stack: [, 3] -stdout: "hello\nhello\nhello\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 3] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "hello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 3] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 3, 5] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "hello\nhello\nhello\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\n" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "hello\nhello\nhello\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 3] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 3, 1] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Add, -) -stack: [, 4] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 4] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 4] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 4, 5] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Less, -) -stack: [, true] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, true] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - String( - "hello", - ), -) -stack: [, hello] -stdout: "hello\nhello\nhello\nhello\n" - -execute: Some( - Print, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 4] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 1.0, - ), - ), -) -stack: [, 4, 1] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Add, -) -stack: [, 5] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - WriteGlobalVariable { - name: "a", - }, -) -stack: [, 5] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Jump( - 2, - ), -) -stack: [] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - ReadGlobalVariable { - name: "a", - }, -) -stack: [, 5] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Constant( - F64( - 5.0, - ), - ), -) -stack: [, 5, 5] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Less, -) -stack: [, false] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - JumpIfFalse( - 15, - ), -) -stack: [, false] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: Some( - Pop, -) -stack: [] -stdout: "hello\nhello\nhello\nhello\nhello\n" - -execute: None -stack: [] -stdout: "hello\nhello\nhello\nhello\nhello\n" - diff --git a/src/main.rs b/src/main.rs index 535dd0f..6ae2741 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,13 @@ use std::{ fs, path::{Path, PathBuf}, - sync::{Arc, Mutex}, }; use clap::{Parser, Subcommand}; use expect_test::expect_file; use lox_db::Database; use lox_error_format::FormatOptions; -use lox_ir::{bytecode, diagnostic::Diagnostics, input_file::InputFile, word::Word}; +use lox_ir::{diagnostic::Diagnostics, input_file::InputFile, word::Word}; use salsa::DebugWithDb; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; @@ -133,18 +132,19 @@ impl TestCase { expect_file![self.bytecode].assert_eq(&format!("{:#?}", chunk)); // test execute - let buf = Arc::new(Mutex::new(String::new())); - let step_inspect = |code: Option, vm: &lox_execute::VM| { - let mut buf = buf.lock().unwrap(); - buf.push_str(&format!("execute: {:#?}\n", code)); - buf.push_str(&format!("stack: {:?}\n", &vm.stack_values())); - buf.push_str(&format!("stdout: {:#?}\n", vm.output)); - buf.push('\n'); - }; - let output = lox_execute::execute_file(db, input_file, Some(step_inspect)); - expect_file![self.execute].assert_eq(&buf.lock().unwrap()); + // let buf = Arc::new(Mutex::new(String::new())); + // let step_inspect = |code: Option, vm: &lox_execute::VM| { + // let mut buf = buf.lock().unwrap(); + // buf.push_str(&format!("execute: {:#?}\n", code)); + // buf.push_str(&format!("stack: {:?}\n", &vm.stack_values())); + // buf.push_str(&format!("stdout: {:#?}\n", vm.output)); + // buf.push('\n'); + // }; + // let output = lox_execute::execute_file(db, input_file, Some(step_inspect)); + // expect_file![self.execute].assert_eq(&buf.lock().unwrap()); // test stdout + let output = lox_execute::execute_file(db, input_file, None::); expect_file![self.stdout].assert_eq(&output); println!("ok");