Module cpclib_asm::assembler
source · [−]Expand description
Production of the bytecodes from the tokens.
Modules
Structs
Environment of the assembly
Enums
Several passes are needed to properly assemble a source file. This structure allows to code which pass is going to be analysed. First pass consists in collecting the various labels to manipulate and so on. Some labels stay unknown at this moment. Second pass serves to get the final values
Traits
Trait to implement for each type of token. it allows to drive the appropriate data vonversion
Functions
Converts an absolute address to a relative one (relative to $)
Assemble align directive. It can only work if current address is known…
arg1 contains the tests arg2 contains the information
Assemble DEFS directive
Assemble an opcode and returns the generated bytes or the error message if it is impossible to assemblea. We assum the opcode is properlt coded. Panic occurs if it is not the case
Apply the effect of the localised token. Most of the action is delegated to visit_token. The difference with the standard token is the ability to embed listing
When visiting a repetition, we unroll the loop and stream the tokens TODO reimplement it in a similar way that the LocatedToken version that is better
Manage the stable ticker stuff.
Visit the tokens during a single pass. Is deprecated in favor to the mulitpass version
Visit the tokens during several passes without providing a specific symbol table.
Visit the tokens during several passes by providing a specific symbol table. Warning Listing output is only possible for LocatedToken
Assemble the tokens doing one pass only (so symbols are not properly treated)