Our assembler functions as follows:
| Token type | Description | Identifier | Syntax |
|---|---|---|---|
| Register | One of the 32 registers in the CPU | R | rN where N is the index |
| Number | A number, 16 bits. Cannot be negative (yet). | N | 0xN, 0bN, 0oN,
0dN/N where N is the number in hexadecimal,
binary, octal or decimal |
| Boolean | A true or false value, a single bit. | B | true or false |
| Identifier | A piece of text. Usually either a label or a specific instruction | N/A | N/A |
| Label | An alias or line marker; pre-processing tool to not have to use numbers everywhere | N/A | >name: for aliases, 'name: for line
markers. Remove : for use |
In the file for an instruction, the instruction will be written as
instruction data:RN -> test:R. This would mean that
“data” (the name is used for the description) is a register or a
number.