summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix reported source location in symbol redefinition errorsBen Bridle2024-10-31
| | | | | | | | | | | | | | The reported location of the original definition of a redefined symbol was incorrect. The index stored alongside a redefined symbol was the ID of the source unit which owns the original definition, but in the error printing code it was being treated as the index of the original definition of that symbol in the definitions list of the resolver. This was causing the reported location of the original definition to be that of an unrelated symbol. To fix this issue, the index stored alongside a redefined symbol is now the index of the original definition of that symbol in the definitions list of the resolver.
* Ensure the root source unit is always merged lastBen Bridle2024-10-31
| | | | | | | | | | This is to prevent the main source of another zero-dependency source unit from being merged before the main source of the root source unit, which would cause a program to immediately enter into library code when run. The root source unit is always the main source code, and other source units are library code.
* Implement an intelligent source merging strategyBen Bridle2024-10-30
| | | | | | | | | | | | | | | | | | | The previous source merging strategy was to concatenate source units in the reverse order that they were added to the resolver, which generally only worked when each source unit had at most one macro-resolving parent. An issue arose when some macros in a source unit were resolved by a source unit which had been added earlier in the order, as the required macro definitions would then be merged after they were referenced, preventing the program from assembling. The new source merging strategy finds an optimal merge order by first recording for a given source unit the ID of each unit which resolves a macro referenced by the given unit, and then only merging those source units whose macro-defining dependencies have already been merged. In the case that a cycle is detected, where two or more source units depend on one another, a message is printed and the assembly is aborted.
* Write line and column information to symbols fileBen Bridle2024-10-29
| | | | | Previously only the path to the source file was being written, not the location of the symbol within the file.
* Rewrite assemblerBen Bridle2024-10-28
| | | | | | | | | | This is an almost complete rewrite of the entire assembler from the ground up, with a different parsing strategy and a whole new symbol resolution mechanism for automatically including library files. The assembly syntax has also been slightly modified, with padding tokens now being prefixed with '#' instead of '$', and a block-style anonymous-label syntax which uses the '{' and '}' characters.
* Update instruction set to match final specificationBen Bridle2024-09-03
|
* Add mnemonics for alternate debug instructionsBen Bridle2024-06-09
|
* Change instruction names to match updated Bedrock specificationv2.0.0Ben Bridle2024-01-20
| | | | | | | | | - The LKD and SKD operations have been removed - SHF/SHC have been moved to after LDD/STD - SWP/ROT/DUP/OVR have been rearranged to be DUP/OVR/SWP/ROT - NOT/AND have been rearranged to be AND/NOT - PSK has been added, placed after PSH - SPL has been added, placed after POP
* Report program size as a percentageBen Bridle2024-01-09
| | | | | | | The assembler previously reported only the length of the generated bytecode in bytes. It now also reports the program size as a percentage of the maximum program size of 64KB, to give the user an idea of how close they are to hitting the program size limit.
* Print better error message when unable to output bytecodeBen Bridle2023-12-24
| | | | | Don't print the internal error representation to the console when an error occurs while trying to write the assembled bytecode to stdout.
* Change op-codes for JMP and JCN instructionsBen Bridle2023-12-19
| | | | | | The JMP and JSR op-codes no longer include a * character, and the double-mode JCN op-codes have been changed to JSN to reflect a change in the instruction set of the Bedrock processor.
* Report unused label definitionsBen Bridle2023-12-19
| | | | | | When the assembler successfully assembles a program, it will now report the names of all label definitions for which there are no label references. This is to aid the user in finding dead code within their programs.
* Report preceding label name on assembly errorBen Bridle2023-12-19
| | | | | | | | | | | | When the assembler encounters an error, the erroneous line and the line number are output in order to help the user to find where in the input file the error occurred. This is useful for single-file inputs, but the line number is generally not helpful if the input file was generated by concatenating multiple files. In order to help the user to determine where in the program source the error occurred, the assembler now reports the name of the label which directly precedes the erroneous line.
* Implement null-terminated stringsBen Bridle2023-11-26
| | | | | | Double-quoted strings are automatically terminated by null bytes, with single-quoted strings maintaining the prior non-terminated string behaviour.
* Tidy up code and commentsBen Bridle2023-11-26
|
* Implement name-spaced macrosBen Bridle2023-11-26
|
* Change operation mnemonics to reflect spec changesBen Bridle2023-11-26
|
* Improve reading and writing from stdin/stdoutBen Bridle2023-11-26
| | | | | Previously, attempting to write large amounts of bytecode to stdout would often result in only the first n bytes being written.
* Exit with status 1 on assembly errorBen Bridle2023-11-26
| | | | | This will break unix pipelines in order to prevent any emulator down the pipeline from attempting to run a malassembled program.
* Implement string literalsBen Bridle2023-11-26
|
* Added detection of cyclic macro references, and made assembler binary usableBen Bridle2023-05-08
|
* About to refactor parser to be a struct with a method for each stageBen Bridle2023-05-06