Documentation ¶
Overview ¶
Package egg/assembler implements a set of usefull functions and structs for creating assemblers.
Index ¶
Constants ¶
const ( TOKEN_LABEL = iota TOKEN_INSTRUCTION TOKEN_ARG TOKEN_LITERAL )
Variables ¶
This section is empty.
Functions ¶
func ParseLiteral ¶
Parses everything cleanly excepts that any % followed by a two-digit hex number (e.g., %FA) in substituted by it's own value. Use %% for a literal %.
Types ¶
type ArgTranslateFunction ¶
Function to pass to ResolveTokensFixedSize.
type DebuggerToken ¶
Token only for instructions. An array of DebuggerToken is passed to the debugger.
func CreateDebugTokensFixedSize ¶
func CreateDebugTokensFixedSize(tokens []Token, size uint64) []DebuggerToken
Creates an array of DebuggerToken when instructions have always a fixed size.
type ResolvedToken ¶
Token with resolved labels and arguments (only instructions have arguments). Can only be instruction or literal.
func ResolveTokensFixedSize ¶
func ResolveTokensFixedSize(tokens []Token, size uint64, arg ArgTranslateFunction) ([]ResolvedToken, error)
Resolves labels and arguments for fixed-size instructions with size bytes. ArgTranslateFunction translates arguments into numbers. The arguments are translating first resolving the labels, and them, if the argument is not a label, calling ArgTranslateFunction with it. Labels are always changed by their address, so the architeture-side should change it to an offset when needed.
type Token ¶
Can be label, instruction, arg or literal.