plushi.instruction
This namespace contains function which manage the set of supported
instructinos, and the related information such as supported data types.
get-instruction
(get-instruction name)
(get-instruction name include-docstring)
Given an instruction name (either string or keyword) return the instruction
map of the corresponding push instruction.
get-supported-instructions
(get-supported-instructions)
(get-supported-instructions types)
(get-supported-instructions types name-pattern)
Returns all (or a subset) of the registered instructions in the
instruction-set atom.
By supplying a collection of types, the resulting set of instructions will be
limited to instructions that deal with one or more of the specified types.
By supplyhing a regex name-pattern, the resulting set of instructions will be
filtered down to instructions whose name fits the pattern.
get-supported-types
(get-supported-types)
Returns all of the stack types (input and output) mentioned in the
instructions stored in the instruction-set atom.
instruction-set
An clojure atom containing a map of all registered instructions. Keys are
keywords made from instruction names. Values are maps that conforms to the
:plushi.instruction/instruction spec.
make-instruction
(make-instruction name function input-types output-types code-blocks)
(make-instruction name function input-types output-types code-blocks docstring)
Creates an instruction map that :plushi.instruction/instruction spec.
- Name should be a unique string with respect to the other instructions in the instruction set.
- Function can be any clojure function.
- input-types is either the keyword :STATE or a vector of stack types.
- output-types is either the keyword :STATE or a vector of stack types.
- code-blocks is the number of code blocks that follow the instruction.
- docstring (optional) is a string explaining what the instruction does.
register
(register instruction)
(register name function input-types output-types code-blocks)
(register name function input-types output-types code-blocks docstring)
Given an instruction, or the necessary components to make an instruction,
add a key-value pair to the instruction-set atom.
Instructin components:
- Name should be a unique string with respect to the other instructions in the instruction set.
- Function can be any clojure function.
- input-types is either the keyword :STATE or a vector of stack types.
- output-types is either the keyword :STATE or a vector of stack types.
- code-blocks is the number of code blocks that follow the instruction.
- docstring (optional) is a string explaining what the instruction does.
unregister
(unregister instruction-name)
Given an instruction name, remove the instruction from the instruction set.