aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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
2023-11-03Symbols may now include digits in lexerAryadev Chavali
This is mostly so labels get to have digits. This won't affect number tokens as that happens before symbols.
2023-11-03Removed tabs from VERBOSE logs in asm/main.cAryadev Chavali
2023-11-03Used more subroutines in fib.asm to make code clearerAryadev Chavali
Looks way more high level but parses down to a very simple bytecode. However, because of lack of inline code processing, it relies on the call stack quite heavily. With inline labels this would be a much more compact bytecode.
2023-11-03Use label features and entry points for examplesAryadev Chavali
2023-11-03Added note in TODO.orgAryadev Chavali
Implementing start points has made features necessary for a standard library setup easier to see.
2023-11-03Completed start points TODOAryadev Chavali
2023-11-03Fixed bug where labels were off by oneAryadev Chavali
Was used in a previous fix but not necessary anymore
2023-11-03Fixed bug where runtime would not start program at the right placeAryadev Chavali
In vm_execute_all set the program pointer to the start address in the header of the program payload.
2023-11-03Added memory-print.asm to examples list in MakefileAryadev Chavali
2023-11-03Refactor assembler to use prog_t structureAryadev Chavali
Set the program structure correctly with a header using the parsed global instruction.
2023-11-03Refactor vm/main to use refactor to program structureAryadev Chavali
2023-11-03Use program structure for runtimeAryadev Chavali
Very barebones, essentially a simple refactor. I need to introduce a feature to append to a program as well, but as it's a flexible structure it will likely have to be functional.
2023-11-03Defined a `program` structureAryadev Chavali
Essentially a "program header", followed by a count, followed by instructions. Provides a stronger format for bytecode files and allows for better bounds checking on instructions.
2023-11-03Added a start address (equivalent to `main`) to assemblerAryadev Chavali
Creates a jump address to the label delegated by "global" so program starts at that point.
2023-11-03Added todo for making a standard libraryAryadev Chavali
Some considerations as to how to do this (dynamic or static linking) and changes needed in VM/assembler for this to work.
2023-11-03Added todo to make a "main routine" specification in assemblerAryadev Chavali
2023-11-03Mark off completed tasks in todo.orgAryadev Chavali
2023-11-03Started work on spec for data storage types in VMAryadev Chavali
2023-11-03Added TODO and WIP tags for specAryadev Chavali
2023-11-03Made test.asm an example asm programAryadev Chavali
2023-11-02Added comments to test.asmAryadev Chavali
2023-11-02Update spec footnotesAryadev Chavali