Suppose somebody completely misunderstands how assembly language works and, instead of writing:
load s1, s2
load s0, s1
He writes:
load (load s0, s1), s2
How do you output a proper error message in that case?
For this invalid program:
address 0
load (load s0, s1), s2
The assembler in my PicoBlaze Assembler and Emulator in JavaScript outputs this error message:
Internal compiler error: The assembly-lanaguage expression in line 2 doesn't end with a new-line token!
The user is unlikely to understand what his error was from that error message. So, how can I detect such situations (where somebody tries to embed one assembly language instruction into another) in the parser and warn about them?
(load s0, s1)
shouldn't be permissible as an argument forload
- think carefully about why not. For example, would you allow other parenthesized expressions in this position? Would you allow parenthesized expressions anywhere in the assembly? $\endgroup$