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
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
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
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
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
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
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
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
27b04e1612
scanner: add basic error handling, strings, comments
2019-06-01 17:07:22 -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
a9dca436bd
remove chunk running code, add draft compiler struct
2019-06-01 16:12:39 -03:00
c4401dc8cf
moving to the virtual machine part of the book, pt 1
...
the java part would still fuck me up since it lies on OOP stuff
that zig doesnt provide, so i'm skipping towards the C part of the book
which will hopefully be more understandable from a zig perspective.
2019-06-01 01:20:06 -03:00