aboutsummaryrefslogtreecommitdiff
path: root/asm/lexer.cpp
AgeCommit message (Collapse)Author
2024-04-15Fix some off by one errors in lexerAryadev Chavali
2024-04-15lexer now produces a vector of heap allocated tokensAryadev Chavali
This removes the problem of possibly expensive copies occurring due to working with tokens produced from the lexer (that C++ just... does): now we hold pointers where the copy operator is a lot easier to use. I want expensive stuff to be done by me and for a reason: I want to be holding the shotgun.
2024-04-14enum -> enum class in lexerAryadev Chavali
This makes enum elements scoped which is actually quite useful as I prefer the namespacing that enum's give in C++.
2024-04-14Added static assert to lexer in case of opcode changesAryadev Chavali
2024-04-14Implemented cstr functions.Aryadev Chavali
2024-04-14Implemented overload for ostream and token as well as constructors for tokenAryadev Chavali
2024-04-14Implemented tokenise_bufferAryadev Chavali
Note that this is basically the same as the previous version, excluding the fact that it uses C++ idioms more and does a bit better in error checking.
2024-04-14Implemented tokenise_literal_stringAryadev Chavali
One thing I've realised is that even methods such as this require error tracking. I won't implement it in the tokenise method as it's not related to consuming the string per se but instead in the main method.
2024-04-14Implemented tokenise_literal_char (tokenise_char_literal)Aryadev Chavali
I made the escape sequence parsing occur here instead of leaving it to the main tokenise_buffer function as I think it's better suited here.
2024-04-14Implemented tokenise_literal_hexAryadev Chavali
Note the overall size of this function in comparison to the C version, as well as its clarity. Of course, it is doing allocations in the background through std::string which requires more profiling if I want to make this super efficientâ„¢ but honestly the assembler just needs to work, whereas the runtime needs to be fast.
2024-04-14Implemented tokenise_literal_number (tokenise_number)Aryadev Chavali
2024-04-14Started implementing lexer in lexer.cppAryadev Chavali
The implementation for tokenise_symbol is already a lot nicer to look at and add to due to string/string_view operator overloading of ==. Furthermore, error handling through pair<> instead of making some custom structure which essentially does the same thing is already making me happy for this rewrite.