This commit is a WORK IN PROGRESS for the base implementation of the
HyphaeVM. This will be squashed into a larger commit eventually when
the work of implementing the HyphaeVM is finished.
Of note, the ISA is mostly finished and much of the VM design is in
place. Yet to be done are a few traps in mycelium, migrating pieces
like the number package and the sexpr package into the VM package,
and of course much testing.
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit adds a new datatype: the quickmap. It provides an extremely
fast but relatively high collision string hash to whatever key hashmap.
This is optimized purely for variable names, and is intended to use for
variable name lookup during (eval ...) or (string->symbol ...) if I must
implement that.
The hashmap is bucketed, with a set number of buckets (199 in this case).
Each bucket is preallocated at initialization containing an empty vector.
There will only ever be one of these initialized as it is only to contain
globally accessible names.
The interface provides new, get, remove, contains_key, insert, and an
iterator implementation.
Unit tests are included and CI is updated.
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit adds a new data type to the codebase. It organizes data
into first in last out linked lists of first in last out linked lists.
Hence the name: StackStack.
This data type was made to represent frames of execution, where there
there is a stack for each function call containing local variables and
arguments. The following tertiary goals were also met:
- no relocating of adjacent data on push or pop
- no copying or cloning of contained data on modification or mutation
- index access to all elements of all contained stacks starting with
most recent insertions.
There are operations to allocate a new stack on the stackstack and
to deallocate the top stack on the stackstack. Additionally there are
operations for pushing and popping from the top stack.
Unit tests are added and CI is updated to include them.
Signed-off-by: Ava Affine <ava@sunnypup.io>