very minor restructuring of function order
rework object creation into a more uniform interface
restructure Compiler & VM interface so they can be re-used between evaluation calls.
This allows the REPL to retain state between calls. Does not yet work for functions as they are compiled into the instructions vector which is discarded after each call (and would need updated jump instructions anyway)
Merge branch 'main' of github.com:dannyvankooten/nederlang
start refactoring VM into separate type with methods.
I couldn't get this to run fast in my previous experiments but apparently this is due to the IP and BP not being on the VM type itself but stored in the current frame (last element in the Vec<Frame> property). If we copy these over to the VM type things are fast (if not faster!) than one giant function.
start refactoring VM into separate type with methods.
I couldn't get this to run fast in my previous experiments but apparently this is due to the IP and BP not being on the VM type itself but stored in the current frame (last element in the Vec<Frame> property). If we copy these over to the VM type things are fast (if not faster!) than one giant function.
get rid of Compiler::change_instruction_operand_at in favor of more specific change_jump_operand_at method (with u16 overflow check)
refactor compiler for some additional type safety
add selection sort example
WebAssembly doesn't have i64 so overflows on negative values. Use isize instead.
add support for indexing into string (by UTF8-character) and assignment indexing into string
rework ast representation to use unnamed structs
add support for array indexing and assignments
support some escape sequences
compile array expressions
fix some panics discovered by fuzzer
use Vec::last_mut() instead of Vec::iter_mut().last()