aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.h
AgeCommit message (Collapse)Author
2023-11-08Added a preprocessing routine in assemblerAryadev Chavali
Preprocessor handles macros and macro blocks by working at the token level, not doing any high level parsing or instruction making. Essentially every macro is recorded in a registry, recording the name and the tokens assigned to it. Then for every caller it just inserts the tokens inline, creating a new stream and freeing the old one. It leaves actual high level parsing to `parse_next` and `process_presults`.
2023-11-06Current work on preprocessorAryadev Chavali
2023-11-05Current work on preprocessor implementationAryadev Chavali
Lots to refactor and test
2023-11-03Refactor assembler to use prog_t structureAryadev Chavali
Set the program structure correctly with a header using the parsed global instruction.
2023-11-03Added a start address (equivalent to `main`) to assemblerAryadev Chavali
Creates a jump address to the label delegated by "global" so program starts at that point.
2023-11-02Created a preprocessing unit presult_t and a function to process themAryadev Chavali
Essentially a presult_t contains one of these: 1) A label construction, which stores the label symbol into `label` (PRES_LABEL) 2) An instruction that calls upon a label, storing the instruction in `instruction` and the label name in `label` (PRES_LABEL_ADDRESS) 3) An instruction that uses a relative address offset, storing the instruction in `instruction` and the offset wanted into `relative_address` (PRES_RELATIVE_ADDRESS) 4) An instruction that requires no further processing, storing the instruction into `instruction` (PRES_COMPLETE_INSTRUCTION) In the processing stage, we resolve all calls by iterating one by one and maintaining an absolute instruction address. Pretty nice, lots more machinery involved in parsing now.
2023-11-01Parser now uses updated lexerAryadev Chavali
Much simpler, uses a switch case which is a much faster method of doing the parsing. Though roughly equivalent in terms of LOC, I feel that this is more extensible
2023-10-31Moved inst module to libAryadev Chavali
As it has no dependencies on vm specifically, and it's more necessary for any vendors who wish to target the virtual machine, it makes more sense for inst to be a lib module rather than a vm module.
2023-10-28asm/parser supports all opcodes, introduced parse errorsAryadev Chavali
Introduced some functions to parse differing types of opcodes. Use the same style of a.b.c... for namespacing or type specification for certain opcodes. Bit hacky and not tested, but does work. Parse errors can be reported with an exact location using the token column, line.
2023-10-26Auto fill licensesAryadev Chavali
2023-10-26Unified literal for numbers, main program now tokenisesAryadev Chavali
2023-10-25Started working on a parserAryadev Chavali
No implementations yet