aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.c
AgeCommit message (Collapse)Author
2023-11-02Better logs for assemblerAryadev Chavali
2023-11-02Implemented CALL(_STACK) and RET on the assemblerAryadev Chavali
2023-11-02Made lexer more error prone so parser is lessAryadev Chavali
Lexer now will straight away attempt to eat up any type or later portions of an opcode rather than leaving everything but the root. This means checking for type in the parser is a direct check against the name rather than prefixed with a dot. Checks are a bit more strong to cause more tokens to go straight to symbol rather than getting checked after one routine in at on the parser side.
2023-11-02Made separate tokens for JUMP_ABS and JUMP_STACKAryadev Chavali
Makes more sense, don't need to fiddle around with strings as much in the parser due to this!
2023-11-02Removed instruction OP_JUMP_REGISTERAryadev Chavali
Not necessary when you can just push the relevant word onto the stack then just do OP_JUMP_STACK.
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-01Implemented MALLOC_STACK and SUB in the assemblerAryadev Chavali
2023-11-01Implemented stack versions of MGET and MSET in assemblerAryadev Chavali
2023-11-01Implemented OP_MSIZE into lexer/parser of ASMAryadev Chavali
2023-11-01Implemented lexer and parser for new memory management instructionsAryadev Chavali
2023-11-01Add MULT to lexer and parser for assemblerAryadev Chavali
2023-11-01Fixed bug where comparators wouldn't be parsed correctlyAryadev Chavali
This is because comparators may apply to signed types, so I need to use the right parsing function.
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-31Use standardised signed version of word type from base.hAryadev Chavali
2023-10-31parse_word deals with characters nowAryadev Chavali
Just takes the character literally as a number.
2023-10-31Changed asm/parser instruction push-reg->push.regAryadev Chavali
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-26Implemented a rudimentary parser with support for 4 instruction typesAryadev Chavali
2023-10-26Unified literal for numbers, main program now tokenisesAryadev Chavali
2023-10-25Started working on a parserAryadev Chavali
No implementations yet