aboutsummaryrefslogtreecommitdiff
path: root/asm/preprocesser.hpp
AgeCommit message (Collapse)Author
2024-04-16Halting work on preprocesser units and rewrite as a wholeasm-rewrite-cppAryadev Chavali
I've decided to split the project into 2 repositories: the assembler and the runtime. The runtime will contain both the executable and lib/ while the assembler will have the runtime as a git submodule and use it to build. I think this is a clean solution, a lot cleaner than having them all in one project where the Makefile has to massively expand.
2024-04-15preprocesser publicly exposes only preprocesser functionAryadev Chavali
The preprocess_* functions are now privately contained within the implementation file to help the preprocesser outer function. Furthermore I've simplified the API of the preprocess_* functions by making them only return pp_err_t and store their results in a vector parameter taken by reference.
2024-04-15preprocesser function now only returns a pp_err_tAryadev Chavali
We leave the parameter tokens alone, considering it constant, while the parameter vec_out is used to hold the new stream of tokens. This allows the caller to have a before and after view on the token stream and reduces the worry of double frees.
2024-04-15Default constructor for pp_err_tAryadev Chavali
2024-04-15preprocess_* now uses const references to tokensAryadev Chavali
They copy and construct new token vectors and just read the token inputs.
2024-04-15Rewrote preprocesser APIAryadev Chavali
This C++ rewrite allows me to rewrite the actual API of the system. In particular, I'm no longer restricting myself to just using enums then figuring out a way to get proper error logging later down the line (through tracking tokens in the buffer internally, for example). Instead I can now design error structures which hold references to the token they occurred on as well as possible lexical errors (if they're a FILE_LEXICAL_ERROR which occurs due to the ~%USE~ macro). This means it's a lot easier to write error logging now at the top level.
2024-04-14parser -> preprocesser + parserAryadev Chavali
I've decided to split the module parsing into two modules, one for the preprocessing stage which only deals with tokens and the parsing stage which generates bytecode.