Commit Graph

22 Commits

Author SHA1 Message Date
d73c5b2e5d main.rs: Basic TUI experience: line numbers, better errors 2023-09-15 18:21:01 -05:00
417ef03e41 0.2.0: Feature update and Refactor
- Each major module (lexer, parser, assembler) has its own error type
  - These error types are somewhat interconnected, but their
    dependency relationships are one-way and well defined
- The AST is no longer responsible for assembling itself
  - The Assembler (assembler::Assembler) will now visit every AST node
    and accumulate words
  - Words are assumed to be little-endian.
- There are now a set of assembler directives that affect the
  generated output:
  - .word <Number>: inserts a single word in the output
  - .words [<Number>,*]: inserts multiple words in the output
  - .byte <Number>: Alias for .word
  - .bytes [<Number>,*]: Alias for .words
  - .string "String": inserts a null-terminated UTF-8 encoded string
  - .strings ["String",*]: "" multiple strings
  - Data is always word-aligned at the moment.
- There are now assembler directives that affect the AST during
  parsing:
  - .include "path/to/file": Parses the contents of a file directly
    into the AST
    - Included files have their own defines, but *share* labels.
      This is because .defines are a tokenizer construct, and
      including a file creates a new buffer and tokenizer.
    - Circular includes are NOT checked for at the moment.
      It is very easy to exhaust the stack.
- General cleanup of several functions, comments, TODOs, etc.
- main.rs was moved to make room for upcoming improvements to the UI

TODO:
- REPL mode is only partially compatible with .define directive
- Branching to a label will branch to the data AT the label,
  not the label itself. I doubt this is correct behavior.
  - In case br <label> is meant to use the absolute address,
    I've created a .org directive (currently unimplemented)
    for specifying the load address of the program.
2023-09-05 01:54:50 -05:00
f79d7716c5 docs: Improve documentation comments somewhat 2023-08-25 03:05:42 -05:00
82420f0665 lexer: Overhaul to support token substitution 2023-08-25 03:01:53 -05:00
53f1f765f1 docs: Don't link to private components 2023-08-23 02:25:43 -05:00
8ba781bf69 Improve error messages and doc comments 2023-08-23 02:15:10 -05:00
7286d93e63 encoding.rs: Fix example in doc comment 2023-08-23 00:32:25 -05:00
0a4313bd1b parser.rs: Remove obtrusive debug printing 2023-08-23 00:27:09 -05:00
4314f8ee30 register.rs: store context in error after str::parse() 2023-08-23 00:25:10 -05:00
938b7d2af2 opcode.rs: Use Parsable trait for opcode parsing 2023-08-23 00:23:46 -05:00
2f867a67ad *_operand.rs: Directly delegate when possible in Display 2023-08-23 00:21:54 -05:00
7901c24d80 *_operand.rs: Improve clarity of expectation-failure errors 2023-08-23 00:19:17 -05:00
8ea41b46f8 number.rs: Allow Plus-sign before radix marker 2023-08-23 00:16:39 -05:00
8c2f53f950 parser.rs: Give priority to instruction parsing 2023-08-23 00:15:47 -05:00
b5fd49b0b4 parser: Improve module-level doc comments 2023-08-23 00:13:52 -05:00
8230d73495 token.rs: Lex numbers of arbitrary length, for better errors 2023-08-23 00:00:28 -05:00
b3af047d3a error.rs: Document errors & error messages 2023-08-22 23:59:17 -05:00
32c44fd311 Add readme.md 2023-08-20 00:53:35 -05:00
8947521181 token.rs: Allow one-character identifiers 2023-08-19 23:56:26 -05:00
f89d2ddfdd Update gitignore 2023-08-19 23:55:41 -05:00
d283043440 main.rs: Cleanup dead and commented-out code 2023-08-19 23:35:14 -05:00
a9ee7d3bc9 msp430-asm: init repo with proof-of-concept code 2023-08-19 23:02:24 -05:00