summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Raise an error if recursion depth exceeds a maximum valueBen Bridle36 hours
| | | | | | This is preferable to having the assembler crash with a stack overflow error, because the user can now see which invocation caused the overflow.
* Fix incorrect first segment addressBen Bridle36 hours
| | | | | | Previously, if the first intermediate token in a program was a pinned address, the address was being discarded and address zero was being pinned instead.
* Remove string-style argument syntax from error messageBen Bridle36 hours
| | | | | | The string-style argument syntax is no longer supported, it has been replaced with a list-style syntax (using square brackets instead of double-quotes).
* Change version messageBen Bridle36 hours
|
* Add debug operator for expressionsBen Bridle38 hours
| | | | | | The <dbg> operator will print the value that is currently at the top of the expression stack as an info-level log message, to help with debugging complex expressions.
* Fix panic caused by dividing by zero in an expressionBen Bridle38 hours
|
* Implement new bytecode stageBen Bridle2 days
| | | | | This completes the Torque version 3 rewrite, other than some extensive testing that is yet to be done.
* Implement new intermediate stageBen Bridle2 days
| | | | | | | | Massive improvement. Label references can be used anywhere in the program, with the program being assembled repeatedly until all labels have stabilised. The bytecode stage will just be a tiny stage tacked onto the end, rather than the old bytecode stage that would resolve labels and expressions.
* Rename the <tal> operator to <sum>Ben Bridle2 days
| | | | | This is a more memorable name, and can be implemented for lists in the future as well.
* Track more information with SymbolParserBen Bridle2 days
| | | | | | | | | To be able to re-use the symbol parser code in the intermediate stage in order to quickly find all symbol definitions and invocations in the program (in particular now that macro definitions are indistinguishable from label definitions, since they can both follow references), the symbol parser now tracks additional information about each symbol (argument count, torque-specific role, and parent macro definition).
* Implement lists as a first-class typeBen Bridle2 days
| | | | | | | | | | Previously, strings were implemented as lists of integers, but there was no way to create an arbitrary list of integers to pass to a macro invocation. This commit extends the []-delimited expression syntax, treating expressions that contain only integers and invocations as lists of integers. Strings are implemented as a sub-type of list.
* Change string argument syntax to list argument syntaxBen Bridle2 days
| | | | | Changes string arguments from "name" to [name], to prepare for generic lists in the language. Doesn't compile.
* Allow a macro invocation to precede the macro definitionBen Bridle2 days
| | | | | There is no longer any reason to enforce this restriction. This will allow the use of more complex macro recursion by programs.
* Include argument count in the signature of a symbolBen Bridle2 days
| | | | | This is done by suffixing the argument count to the symbol name using the ':' separator character, which can't normally be used in a symbol.
* Update wording of syntactic and semantic errorsBen Bridle2 days
|
* Rename labels/sublabels to global/local labelsBen Bridle3 days
| | | | This terminology has been used in the manual for a long time now.
* Fix initial indentation when printing semantic tokensBen Bridle3 days
| | | | | | Al non-macro-definition semantic tokens were being printed starting from indentation level zero, instead of from the provided indentation value.
* Add a specific error for nested macro definitionsBen Bridle3 days
| | | | | | This case was previously being reported with the message "The macro definition was not terminated, add a ';' character to terminate", which was not very helpful.
* Update help textBen Bridle4 days
|
* Implement <abs> operator for expressionsBen Bridle2025-04-27
| | | | The <abs> operator returns the absolute value of an integer.
* Update assembler and log librariesBen Bridle2025-04-27
| | | | | | This update replaces all uses of the ansi library with the new inked library. This means that terminal colours will now be handled correctly under Windows.
* Allow label references in pinned address calculationsBen Bridle2025-04-26
| | | | | | | | | | | | | | | | This is a relaxation of the rule where a label reference could not be used in any context that could change the length of an assembled program. We implement this in the bytecode stage by naively calculating an initial address for each label as before. If a pinned address is calculated from a label reference, some of the calculated addresses could be incorrect. We then attempt to run the bytecode stage, which will calculate a more accurate address for each label based on how pinned addresses are calculated. If the address of any label was changed by running this stage, we re-run the stage up to three more times until all labels stabilise. If the labels fail to stabilise, we return an error.
* Implement first-class string literalsBen Bridle2025-04-26
| | | | | | | | | | | This feature promotes strings to a first-class type in the language. If a string is passed to an invocation via the new string-type argument, the string will be passed as a whole value. String arguments can still be passed to an invocation via an integer-type argument, in which case they'll be broken apart into individual characters with the macro being invoked once per character. String-type macro arguments are declared like "name".
* Fix misleading error messageBen Bridle2025-04-26
| | | | | | The code here is really expecting a block value, but has received an integer value. This catches the case where an integer value is incorrectly included in a macro definition body alongside block tokens.
* Implement <tal> operator for expressionsBen Bridle2025-04-26
| | | | | | The <tal> operator returns the number of set bits in the binary representation of an integer. For negative numbers, only a single sign bit is counted in the result.
* Allow a macro to invoke itself safelyBen Bridle2025-04-18
| | | | | | | A macro can now invoke itself if the invocation is inside a conditional block that will eventually return false. The assembler stack can still overflow if the macro recurses too deeply, or if a macro calls itself without a conditional block.
* Allow a macro to invoke itselfBen Bridle2025-04-18
| | | | | This will currently cause the assembler to hang in all situations where it is used.
* Implement <len> operator for expressionsBen Bridle2025-04-18
| | | | | The <len> operator returns the width of an integer in bits, using the same calculation as for packing an integer into a bit field.
* Implement octal literalsBen Bridle2025-04-17
| | | | Octal literals use the prefix '0o'.
* Remove brackets from format names in program help textBen Bridle2025-04-12
| | | | | These could be misleading, they could incorrectly indicate that the brackets are part of the format name.
* Add the cmd format to the list in program help textBen Bridle2025-04-12
|
* Fix width checks for negative integersBen Bridle2025-04-12
| | | | | | | | | | | | The width of a negative integer was previously being counted in the same way as for a positive integer, by inverting the bits to make it a positive integer and then finding the placement of the highest-order 1 bit. The actual width of a negative integer will always be one greater than this value however, because the highest-order 1 bit of an inverted negative integer will always have directly above it a significant 0 bit used as the sign bit.
* Implement negative integer literalsBen Bridle2025-04-12
| | | | | Negative literals take the forms -29, -0x1D, and -0b11101 for decimal, hexadecimal, and binary.
* Add support for the CP/M CMD file module formatBen Bridle2025-04-11
|
* Improve help textBen Bridle2025-03-31
|
* Report token without prefix in invalid literal errorsBen Bridle2025-03-23
| | | | | | | Previously, the token quoted in the error message for an invalid literal error included the radix prefix. This is already visible in the highlighted source report, and implied by the named radix in the error message.
* Change extension positional argument to a switchBen Bridle2025-03-18
| | | | | It makes no sense for the file extension to be a positional argument, it'll barely be used anyway.
* Update assembler dependencyBen Bridle2025-03-18
| | | | torque-asm now uses the Compiler type provided by the assembler library.
* Tidy codyBen Bridle2025-03-18
| | | | | | | - Rename tokens field on SyntacticMacroDefinition to body - Rename push_err! macro to err! - Create macros for character-matching logic in syntactic parsing - Replace .as_bytes().to_vec() pattern with .into_bytes()
* Rewrite entire assemblerBen Bridle2025-03-11
| | | | | | | | | | | | The language is now more general, the code is better structured, error reporting is more detailed, and many new language features have been implemented: - conditional blocks - first-class strings - more expression operators - binary literals - negative values - invocations in constant expressions
* Implement <= and >= operators for constant expressionsBen Bridle2025-03-01
|
* Change binary name to tqBen Bridle2025-03-01
|
* Implement inhx formatBen Bridle2025-02-28
| | | | inhx is the original Intel hex format.
* Implement string literalsBen Bridle2025-02-28
| | | | | | | | String literals are treated as integers. If a string is passed as an integer argument to a packed binary literal, a new instance of the packed binary literal is invoked for every character in the string, with each character being passed to the packed binary literal as a Unicode character value.
* Finish first working version of TorqueBen Bridle2025-02-27
| | | | | This is a huge and messy commit, worked on piecemeal while traveling and while the language was still being designed.
* Implement semantic error reportingBen Bridle2025-02-15
|
* Implement semantic parsingBen Bridle2025-02-14
|
* Separate syntactic and semantic token types by namespaceBen Bridle2025-02-12
| | | | This will allow type names to be shared by both types of token.
* Define semantic typesBen Bridle2025-02-11
|
* Initial commitBen Bridle2025-02-11