d7b78e09e3
finish impl for local vars
2019-06-03 16:24:54 -03:00
26d299cd23
add local/global "switch"
2019-06-03 16:10:49 -03:00
5138410be4
compiler: add scope support
2019-06-03 15:17:07 -03:00
25ee586acb
compiler: add local scope basics
2019-06-03 15:10:12 -03:00
69dda36d16
add SetGlobal/SetGlobalLong opcodes
...
- main: split compile/runtime error messages
2019-06-03 01:41:22 -03:00
9f45dea2c0
vm: remove uneeded hack
2019-06-03 00:58:44 -03:00
8bc220d2f8
chunk: split writing side-effects into own function
...
split writeConstant() into that and writeConstantRaw() for the places
where we don't want OP_CONSTANT written as well.
this caused a bug where doing `"some const string" + x` would cause an
unecessary OP_CONSTANT to be added for the x variable and would cause
the wrong result to be given.
- main: reset stack on repl tick (?)
2019-06-03 00:55:50 -03:00
922f3c530c
chunk: fix disasm on the new const-load op codes
2019-06-03 00:07:11 -03:00
3936b4a426
main: keep a long-running vm instance for REPL
...
enables us to declare variables and keep them going for as long as the
REPL goes.
- vm: remove source arg from init(), move to interpret()
2019-06-03 00:02:07 -03:00
005981fbbd
vm: add getglobal support
2019-06-02 23:57:28 -03:00
887cb1adea
add emitting of GetGlobal/GetGlobalLong
2019-06-02 23:43:12 -03:00
e3ac28d84e
vm: deinit globals on vm deinit
2019-06-02 23:13:42 -03:00
3a6df2d9ea
add basic global variable support
...
- chunk: make writeConstant return a ConstantIndex for better
integration with the (optional) OP_CONST_LONG
- compiler: quickfix emitConstant()
- vm: add a global ValueMap
2019-06-02 22:52:19 -03:00
aa94396e51
compiler: add nicer error handling
...
- vm: fix pop opcode handler
2019-06-02 18:11:23 -03:00
06df2d37ee
add expression statements
2019-06-02 18:04:36 -03:00
bea6e34365
add print statement
...
- remove opcode return's use as debug
2019-06-02 17:28:54 -03:00
3f2a8f3801
add object list cleaning on VM.deinit
2019-06-02 15:39:04 -03:00
cf53b6fc86
add basics of virtual machine object list
...
- object: move functions to accept VM pointer, not Allocator
2019-06-02 14:52:19 -03:00
38715af200
vm: add string concatenation
...
- compiler: fix string creation
2019-06-02 14:18:01 -03:00
9ac5fccc2b
add objects and string comparison
2019-06-02 14:01:54 -03:00
44c27f43b7
move new_scanner.zig to scanner.zig
2019-06-02 13:17:32 -03:00
71dba5c77d
vm: add greater and less
2019-06-02 00:23:50 -03:00
15c58a2216
comparison operators, part 1
2019-06-02 00:16:33 -03:00
39e28f01ac
chunk: add printing of OP_NOT
2019-06-02 00:03:54 -03:00
c5d704a34f
add not operator
2019-06-02 00:02:37 -03:00
1d774c6011
add support for nil, true and false literal values
2019-06-01 23:44:59 -03:00
ec652b29d9
remove print debug
2019-06-01 23:35:13 -03:00
589413488c
move towards dynamically typed values
...
- remove InterpretResult as an enum, replace by error.
- scanner: fix peekNext()
- vm: add runtime errors, add VM.peek()
2019-06-01 23:33:53 -03:00
0f8e19adf1
compiler: finish parser (for math expressions)
2019-06-01 21:32:25 -03:00
230fef20b5
add other bytecode emitters
2019-06-01 20:48:26 -03:00
2736bee8d8
scanner: remove debug print
2019-06-01 20:34:09 -03:00
e1d0e3ec0b
add basic compiler code
2019-06-01 20:33:43 -03:00
7d7aabbdd7
scanner: add keyword handling (copied off the old scanner)
...
as with most things, lol
2019-06-01 17:20:50 -03:00
d62c58a195
scanner: add identifiers
2019-06-01 17:15:35 -03:00
566d8313f3
add number tokens
2019-06-01 17:13:50 -03:00
9d1d253c94
scanner: fix peekNext
2019-06-01 17:12:00 -03:00
27b04e1612
scanner: add basic error handling, strings, comments
2019-06-01 17:07:22 -03:00
f4f1fe1fbc
scanner: add whitespace handling
2019-06-01 16:54:15 -03:00
2c7cf356b3
scanner: add basic tokens and matched-tokens
2019-06-01 16:51:02 -03:00
6b9cc575d9
add draft scanner, remove messy Token union, replace by struct
2019-06-01 16:37:24 -03:00
63045e4df5
add src/new_scanner.zig
2019-06-01 16:21:36 -03:00
b80cd52c50
main: readd runPrompt and runFile
...
- main: make run() use the VM struct instance
2019-06-01 16:17:28 -03:00
a9dca436bd
remove chunk running code, add draft compiler struct
2019-06-01 16:12:39 -03:00
088674bf0b
vm: add dynamically-sized growing stack
2019-06-01 15:45:30 -03:00
3377d1675c
vm, chunk: add binary operators
2019-06-01 15:40:18 -03:00
2822676707
vm: add negate opcode
2019-06-01 15:27:19 -03:00
61e463713c
vm: add stack
2019-06-01 15:23:23 -03:00
456bc95138
vm: add debug flags
2019-06-01 15:01:39 -03:00
dae3c259fd
add basic virtual machine code
2019-06-01 14:55:11 -03:00
14fa63e1f6
finish impl for ConstantLong
2019-06-01 14:18:44 -03:00