stack.StackEffect, action.ActionEnum.dispatch and action.AbstractAction contain methods for code generation. It would make more sense to separate the description of the VM from code generation, by extracting the code generation methods (see below), and making them top-level functions in run_fn.py.
Specification:
StackEffect: args, results, by_name, of, __str__, __repr__StackItem: everything but load and storeStackPictureAction: everything but gen_caseActionEnum: everything but dispatchInstruction: everything but gen_case and (arguably) opcode
Code generation:
StackEffect: declare_vars, load_args, store_resultsStackItem: load and store
The top-level functions in stack.pyAbstractAction: gen_caseAction: gen_caseActionEnum: dispatchInstruction: gen_case and (arguably) opcode
stack.StackEffect
,action.ActionEnum.dispatch
andaction.AbstractAction
contain methods for code generation. It would make more sense to separate the description of the VM from code generation, by extracting the code generation methods (see below), and making them top-level functions inrun_fn.py
.Specification:
StackEffect
:args
,results
,by_name
,of
,__str__
,__repr__
StackItem
: everything butload
andstore
StackPicture
Action
: everything butgen_case
ActionEnum
: everything butdispatch
Instruction
: everything butgen_case
and (arguably)opcode
Code generation:
StackEffect
:declare_vars
,load_args
,store_results
StackItem
:load
andstore
The top-level functions instack.py
AbstractAction
:gen_case
Action
:gen_case
ActionEnum
:dispatch
Instruction
:gen_case
and (arguably)opcode