diff options
Diffstat (limited to 'chunk.d')
| -rw-r--r-- | chunk.d | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -7,6 +7,7 @@ import parser; enum ObjType { FUNCTION, SCRIPT, + LIST, } abstract class Obj { @@ -35,6 +36,26 @@ class Function : Obj { } } +class List : Obj { + int[] addresses; + + this() { + this.type = ObjType.LIST; + } + + void addItem(int addr) { + addresses ~= addr; + } + + int first() { + return addresses[0]; // TODO this fails on empty lists + } + + override string toString() { + return format("list (%d)", addresses.length); + } +} + enum OpCode { OP_ADD, OP_LESS, @@ -61,8 +82,14 @@ enum OpCode { OP_CALL, + OP_CONCAT, // No? + + OP_FIRST, // No? + OP_TYPE_CHECK_NUMBER, OP_TYPE_CHECK_BOOLEAN, + OP_TYPE_CHECK_STRING, + OP_TYPE_CHECK_LIST, } class Chunk { |
