Martin Dørum
1cc1303c2b
better builtins macro
3 vuotta sitten
Martin Dørum
bbbd0716ca
add operators &&, ||, ??
3 vuotta sitten
Martin Dørum
d5974171e3
add test cases, and fix bugs in the process
3 vuotta sitten
Martin Dørum
01f1b7d2f9
don't allocate for arrays <2 elements long
3 vuotta sitten
Martin Dørum
ea4271543e
while function
3 vuotta sitten
Martin Dørum
a81643f312
utility function to check if something is truthy
3 vuotta sitten
Martin Dørum
1c3cb1d6fb
naming things
3 vuotta sitten
Martin Dørum
dd620958b7
store array/buffer length in the l2_vm_value itself
3 vuotta sitten
Martin Dørum
07d6688baf
new parenthesized function call syntax
3 vuotta sitten
Martin Dørum
9ffc6c5f80
more robust continuations, and implement 'loop' function
3 vuotta sitten
Martin Dørum
732adeb00e
add comparison operators
3 vuotta sitten
Martin Dørum
382c4b9b1d
1-byte version of instructions
3 vuotta sitten
Martin Dørum
0acbfd77f0
better bytecode format
3 vuotta sitten
Martin Dørum
c080f561d7
don't GC builtins
3 vuotta sitten
Martin Dørum
6ebc5345b3
parse changes, and operators == and !=
3 vuotta sitten
Martin Dørum
3bf458897b
veery basic control flow
3 vuotta sitten
Martin Dørum
b94f188974
builtin variables
3 vuotta sitten
Martin Dørum
8c10cec784
infix functions
3 vuotta sitten
Martin Dørum
bc29640896
add a REPL
3 vuotta sitten
Martin Dørum
1b1ae8cdf4
separate loader.h/c
3 vuotta sitten
Martin Dørum
61b791bdf1
add --output option to write bytecode to file
3 vuotta sitten
Martin Dørum
928f7cfc33
don't allocate arguments array for builtins
3 vuotta sitten
Martin Dørum
08cd621d90
actually run the GC
3 vuotta sitten
Martin Dørum
ded80df7a8
short string optimization for tokens
3 vuotta sitten
Martin Dørum
5b6dc6be51
reduce unnecessary allocs in io_mem_writer
3 vuotta sitten
Martin Dørum
c82bc5349b
report lex errors
3 vuotta sitten
Martin Dørum
47e2a5e981
check errors
3 vuotta sitten
Martin Dørum
2af11e76a4
add error type
3 vuotta sitten
Martin Dørum
2490558d45
store stack base pointer in the stack frame
3 vuotta sitten
Martin Dørum
e755acb19c
make C++ happy with the headers
3 vuotta sitten
Martin Dørum
417e555d02
enable strict warnings, make code not emit warnings
3 vuotta sitten
Martin Dørum
fa662b6868
change the IO APIs a bit
3 vuotta sitten
Martin Dørum
1c184b3111
dynamic lookups
3 vuotta sitten
Martin Dørum
82c92b26b9
rework bytecode and stacks
Instructions now take their static arguments in the bytecode directly
instead of from the stack. The return address is now moved into a
separate frame stack. That means the only thing in the main stack is now
variable references. That means we can mark every variable which is
currently on the stack during a GC; even variables which aren't referred
to from a namespace.
As a result, a GC can happen before or after any instruction without
having to worry. The VM should also be faster, and the bytecode should
be smaller, due to fewer instructions.
3 vuotta sitten
Martin Dørum
d726ee311a
correctness fixes, thanks to asan
3 vuotta sitten
Martin Dørum
fc8bdb9df1
support setting the VM's stdout
3 vuotta sitten
Martin Dørum
12495a8bcd
fixes, and array dot-number assign
3 vuotta sitten
Martin Dørum
164cc76ce9
= operator
3 vuotta sitten
Martin Dørum
9d2d3c3a01
array literals
3 vuotta sitten
Martin Dørum
e042ce953b
len() function
3 vuotta sitten
Martin Dørum
fb5a02c602
array lookup with a dot-number token
3 vuotta sitten
Martin Dørum
6933015c72
better parser (though code gen not implemented yet)
3 vuotta sitten
Martin Dørum
41331f4be0
mostly parsing stuuff
3 vuotta sitten
Martin Dørum
5d8bcf692e
change up some types
3 vuotta sitten
Martin Dørum
1d30f3c869
builtins, functions, etc
3 vuotta sitten
Martin Dørum
2bf2b4a88f
builtin stuff, and reorganized l2_vm_value
3 vuotta sitten
Martin Dørum
a11c4a0351
object literals
3 vuotta sitten
Martin Dørum
abb1277e83
parsing and vm stuff
3 vuotta sitten
Martin Dørum
2dffcd295d
basic programs can now execute correctly
3 vuotta sitten
Martin Dørum
feaef07544
started on functions
3 vuotta sitten