Arithmetic and constant-chains
It should be possible to calculate values from constants and dependent symbols automatically. We also need to support parenthesis and various bit-operations. It's a rather big feature, but necessary for any serious work.
Step 1: Parse tokens. Any parenthesis is treated as a calculation that could be optimized leaving only constants and labels.
OK: (label + 0x44)
Wrong. label + 0x44
The tokenizer is not smart enough for the second one yet.
Step 2: Any constant used that contains symbols should be automatically solved by scheduling it for when the symbol value is revealed.
Step 3: When calling the scheduled ops, the constant will be resolved and written into the binary from a lambda that has all the necessary context.
This method avoids re-parsing the assembly, but perhaps it's better to rethink the strategy.