Documentation
¶
Overview ¶
Package asm parses and compiles vise assembly code to bytecode.
Index ¶
Constants ¶
const ( MENU_DOWN = _MENU_OFFSET MENU_UP = _MENU_OFFSET + 1 MENU_NEXT = _MENU_OFFSET + 2 MENU_PREVIOUS = _MENU_OFFSET + 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arg ¶
type Arg struct { Sym *string `(@Sym Whitespace?)?` Size *uint32 `(@Size Whitespace?)?` Flag *uint8 `(@Size Whitespace?)?` Selector *string `(@Sym Whitespace?)?` Desc *string `(Quote ((@Sym | @Size) @Whitespace?)+ Quote Whitespace?)?` }
Arg holds all parsed argument elements of a single line of assembly code.
type Asm ¶
type Asm struct {
Instructions []*Instruction `@@*`
}
Asm assembles bytecode from the vise assembly mini-language.
type BatchCode ¶
type BatchCode uint16
BatchCode defines quasi-opcodes that expand to mulitple individual vm instructions.
type Batcher ¶
type Batcher struct {
// contains filtered or unexported fields
}
Batcher handles assembly commands that generates multiple instructions, such as menu navigation commands.
func NewBatcher ¶
func NewBatcher(mp MenuProcessor) Batcher
NewBatcher creates a new Batcher objcet.
type Instruction ¶
type Instruction struct { OpCode string `@Ident` OpArg Arg `(Whitespace @@)?` Comment string `Comment? EOL` }
Instruction represents one full line of assembly code.
func (Instruction) String ¶
func (i Instruction) String() string
String implement the String interface.
type MenuProcessor ¶
type MenuProcessor struct {
// contains filtered or unexported fields
}
MenuProcessor handles code lines with BatchCode quasi-opcodes that control menu generation.
It creates vm instructions for display of menu and handling of input on either size of a vm.HALT instruction.
func NewMenuProcessor ¶
func NewMenuProcessor() MenuProcessor
NewMenuProcessor creates a new MenuProcessor object.
func (*MenuProcessor) Add ¶
Add a menu batch instruction to be processed.
Instructions will be rendered in the order in which they have been added.
func (*MenuProcessor) ToLines ¶
func (mp *MenuProcessor) ToLines() []byte
ToLines returns the generated bytecode from the added menu batch instructions.