aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-04-14Finished todo on importing another fileAryadev Chavali
2024-04-14fix! loops in preprocess_use_blocks iterate to the wrong bound0.0.1Aryadev Chavali
A token_stream being constructed on the spot has different used/available properties to a fully constructed one: a fully constructed token stream uses available to hold the total number of tokens and used as an internal iterator, while one that is still being constructed uses the semantics of a standard darr. Furthermore, some loops didn't divide by ~sizeof(token_t)~ which lead to iteration over bound errors.
2024-04-12Fix problems with running programs due to mismatched endianAryadev Chavali
Basically ensure we're converting to big endian when writing bytecode and converting from big endian when reading bytecode.
2024-04-12Fixing build problems due to endian.hAryadev Chavali
Have to define _DEFAULT_SOURCE before you can use the endian conversion functions. As most standard library headers use features.h, and _DEFAULT_SOURCE must be defined before features.h is included, we have to include base.h before other headers.
2024-04-09Reworking todos on library linkingAryadev Chavali
2024-04-09Some rewording of spec.orgAryadev Chavali
2024-04-09Added some TODOs to lib/inst.c to enforce endianAryadev Chavali
2024-04-09Mid-work through documenting darr.hAryadev Chavali
2024-04-09Done TODO: Comment coverage > lib > base.hAryadev Chavali
Pretty simple
2024-04-09Fixed code in vm_pop_hword DWORD -> DHWORDAryadev Chavali
Though practically this would work, as the storage for the half word is not limited in any way, nevertheless it isn't syntactically right and it's better to fix now.
2024-04-09Completed TODO: Rigid EndianAryadev Chavali
Just used the endian.h functions to convert host endian to and from big endian.
2024-04-09Added todo to force an endian conventionAryadev Chavali
I've flip flopped a bit on this but I believe the virtual machine bytecode format must have a convention on endianness. This is because of the issue stated in the TODO which may very well happen.
2024-04-08Added better documentation to TODO listAryadev Chavali
2024-04-07Changed limit for examples/factorial.asmAryadev Chavali
Did some analysis and found that 21! takes above 64 bit integers to store hence set the limit to 20 instead.
2023-11-29Use a limit on $I rather than on $B for examples/fib.asmAryadev Chavali
2023-11-29Fixed issues with getting and setting words for heap pagesAryadev Chavali
Because I was using the hword macros instead of word macros, this causes truncation of bytes when I didn't want it.
2023-11-29Fixed logs in vm/runtimeAryadev Chavali
Just changing some messages and the format of heap printing
2023-11-29Cleaned up logs in assembler/parserAryadev Chavali
2023-11-29Easier to read documentation in examplesAryadev Chavali
2023-11-29Fixed incorrect free of tokens in error for preprocess_use_blocksAryadev Chavali
Also error now points to the correct place in the file.
2023-11-29Report some stats of the actual program when workingAryadev Chavali
2023-11-29Refactored preprocessor to preprocess_(use|macro)_blocks and process_presultsAryadev Chavali
We have distinct functions for the use blocks and the macro blocks, which each generate wholesale new token streams via `token_copy` so we don't run into weird errors around ownership of the internal strings of each token. Furthermore, process_presults now uses the stream index in each presult to report errors when stuff goes wrong.
2023-11-29Refactored presult_t to include a stream pointerAryadev Chavali
So when a presult_t is constructed it holds an index to where it was constructed in terms of the token stream. This will be useful when implementing an error checker in the preprocessing or result parsing stages.
2023-11-29Added parse errors for %USE callsAryadev Chavali
So %USE <STRING> is the expected call pattern, so there's an error if there isn't a string after %USE. The other two errors are file I/O errors i.e. nonexistent files or errors in parsing the other file. We don't report specifics about the other file, that should be up to the user to check themselves.
2023-11-29Fixed tokenise_string_literalAryadev Chavali
Forgot to increment buffer->used and memcpy call was just incorrect.
2023-11-29Added function to copy tokensAryadev Chavali
This essentially just copies the internal string of the token into a new buffer.
2023-11-29Added TOKEN_PP_USE to lexer with implementationAryadev Chavali
2023-11-29Moved preprocessor>Constants to Completed and started work on %USEAryadev Chavali
2023-11-29Added todo for preprocessor "%MACRO"Aryadev Chavali
This is different to "%CONST" in that it can take token parameters and use them. This allows the construction of user code at compile time, which can be very useful for a variety of use cases.
2023-11-29Added todo for preprocessor "%USE" blocksAryadev Chavali
Essentially importing another file *literally* into the file. This would happen before parse results are gathered, similar to how "%CONST" is implemented currently.
2023-11-29Cleaned up todos standard library a bit moreAryadev Chavali
2023-11-11Added string literals in tokeniserAryadev Chavali
Doesn't do much, invalid for most operations.
2023-11-09Use constants in examples where possibleAryadev Chavali
Stuff like numeric limits can be codified in constants which act self documenting.
2023-11-09Mark off constants as done in TODO.orgAryadev Chavali
2023-11-08Makefile now assembles and interprets instruction-test.asm example firstAryadev Chavali
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-08Added log in assembler for reading a certain number of bytesAryadev Chavali
2023-11-08Lexer symbols now recognise macro constants and referencesAryadev Chavali
2023-11-08Fixed issue where, on error, runtime would show wrong instructionAryadev Chavali
When an error occurred, because prog->ptr was incremented beforehand the trace would show the next instruction as the culprit rather than the actual instruction. This commit fixes that by incrementing the program if and only if the command was run successfully.
2023-11-06Current work on preprocessorAryadev Chavali
2023-11-05Current work on preprocessor implementationAryadev Chavali
Lots to refactor and test
2023-11-05Redefined proposed syntax for preprocessor in TODO.orgAryadev Chavali
2023-11-04Added TODO for inlining labelsAryadev Chavali
2023-11-04Added tags for TODO.orgAryadev Chavali
2023-11-04Did some more work on the specAryadev Chavali
2023-11-04Fixed up example comments and some assemblyAryadev Chavali
2023-11-03Added steps to creating an in memory instance of the VMAryadev Chavali
This would be useful when writing an interpreted language where the "assembly" and the "execution" occur within the same executable.
2023-11-03Updated LOCAryadev Chavali
2023-11-03Cleaned up How to build section of READMEAryadev Chavali
2023-11-03Added Makefile recipe to interpret all examplesAryadev Chavali