The assembler I am writing supports a number of addressing modes,
expressed like:
GET D0.0,[D0.1+D0.2] ; D0.0 <- mem[base(D0.1)+offset(D0.2)]
GET D0.0,[D0.1+#20] ; D0.0 <- mem[base(D0.1)+offset(20)]
I have specified these a separate instrucions, e.g.:
(dni ...
"GET $DataReg1,[$DataReg2+$DataReg3]"
...
)
(dni ...
"GET $DataReg1,[$DataReg2+#$Immed]"
...
)
The immediate form is parsed by my custom parser, which returns it's
error message. However, it seems that cgen goes on to attempt to parse
the immediate as a register name, which fails with "unrecognized
keyword". Is there a way to control this behaviour? Once I have hit the
hash I would like to treat the value as always an immediate.