Commit graph

79 commits

Author SHA1 Message Date
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
2d33e03efb add incomplete ConstantLong instruction
- move ValueList's count to usize for ConstantLong
2019-06-01 02:06:23 -03:00
ba78b39300 add constant values to the virtual machine 2019-06-01 01:46:01 -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
727a259638 rm make_exprs.py, moving to the c part 2019-06-01 00:04:04 -03:00
6ff75a0926 finish make_exprs.py script
- add src/expr.zig
2019-05-31 23:43:46 -03:00
8007df6853 add mypy_cache to gitignore 2019-05-31 23:38:21 -03:00
3b73978f40 add make_exprs.py script 2019-05-31 23:37:45 -03:00
756f85d77d add multiline block comments 2019-05-31 22:45:23 -03:00