Need a global object table for literals
Implement gc_mark for VM_State
Just wrap std::fstream?
return stack
args and local variables stack
need Set_Global N and Get_Global N
need Set_Local N and Get_Local N
positive N will be local variables and negative N will be arguments
need Set_Ref P, and Get_Ref P
this is to implement lambda captures
? can emit_set/get_value(symbol) determine locality? (global, local, arg, capture ref)
CONS
LIST
CHARACTER
STRING
QUOTE
QUASIQUOTE
UNQUOTE
UNQUOTE-SPLICING
compile_function
compile LAMBDA
compile DEFMACRO
compile HANDLER-CASE
call_lisp_function(function, argc, argv)
+evaluate
- Construct &REST if exists
- Do this first so GC will not collect args.
- Save args position as m_stack_top - nargs
- Set m_stack_top to m_locals
- Push from args to m_stack_top
- Push &REST if exists
- Jump to function
There could also be passes before that eliminate/transform no-ops such as:
set_local 4 pop get_local 4 pop_jump_if_nil f get_local 4
which could be reduced to a new instruction “pop_if_nil_and_jump f”
This would allow us to swap instructions with different widths, gotcha here is resolving branch offsets.
+sin +cos +tan +atan +pow