aboutsummaryrefslogtreecommitdiff
path: root/asm
AgeCommit message (Collapse)Author
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-01Clearer VERBOSE messagesAryadev Chavali
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-11-01Lexer now returns more descriptive tokensAryadev Chavali
More useful tokens, in particular for each opcode possible. This makes parsing a simpler task to reason as now we're just checking against an enum rather than doing a string check in linear time. It makes more sense to do this at the tokeniser as the local data from the buffer will be in the cache most likely as the buffer is contiguously allocated. While it will always be slow to do linear time checks on strings, when doing it at the parser we're having to check strings that may be allocated in a variety of different places. This means caching becomes a harder task, but with this approach we're less likely to have cache misses as long as the buffer stays there.
2023-10-31Allow hex literals for numbersAryadev Chavali
As strto(ul|ll) allow the parsing of hex literals of the form `0x`, we allow lexing of hex literals which start with `x`. They're lexed into C hex literals which work for strtol.
2023-10-31Use standardised signed version of word type from base.hAryadev Chavali
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-31asm/main logs are now indented and look prettierAryadev Chavali
2023-10-31Lexer now returns errors on failureAryadev Chavali
Currently only for invalid character literals, but still a possible problem.
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-29Added a "usage" message and colours for assemblerAryadev Chavali
Prints useful and pretty messages when verbose being at least 1.
2023-10-28Introduce error reporting in asm/mainAryadev Chavali
Pretty simple implementation, I've stopped printing the tokens cos I think the lexer is done.
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-28Ignore comments (using semicolons) in lexerAryadev Chavali
Easier to do it here than at the parser.
2023-10-28Introduced a column and line for each tokenAryadev Chavali
Accurate error reporting can be introduced using this.
2023-10-26Plugged in asm/parser to asm/mainAryadev Chavali
Just prints instructions so far.
2023-10-26Implemented a rudimentary parser with support for 4 instruction typesAryadev Chavali
2023-10-26Added support in lexer for negative numbersAryadev Chavali
Though we deal with unsigned numbers internally, it should be possible to read and manipulate negative numbers through 2s complement. Later on we'll add support for signed operations via 2s complement, so this should be allowed.
2023-10-26asm/main now uses TOKEN_STREAM_ATAryadev Chavali
2023-10-26Lexer forces uppercase for symbolsAryadev Chavali
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
2023-10-25Separated lexer from main file in asmAryadev Chavali
2023-10-24Wrote lexer for assemblyAryadev Chavali
Pretty simple tokeniser, doesn't do a lot and needs to error check better.
2023-10-23Starting development on assembly languageAryadev Chavali