Instead of supporting the r[i] syntax for registers, have users specify a custom function mapping input strings to unique register identifiers. This allows for custom register descriptors.
For example, to support x86 register descriptors:
getRegByDescriptor = str ->
case str
when "%ebx" then 0
when "%eax" then 1
# so on...
(It doesn't matter what they map to so long as you're consistent in your use of the register)
This change has a few good effects:
- the
decode function will be simplified a bit as we'll only grab the ID of the reg and not the reg object itself
- because of that, we can more easily implement an assembler (to do this currently, I had to add a field to the register to get its ID)
- you can have custom register descriptors (yay!)
Instead of supporting the
r[i]syntax for registers, have users specify a custom function mapping input strings to unique register identifiers. This allows for custom register descriptors.For example, to support x86 register descriptors:
(It doesn't matter what they map to so long as you're consistent in your use of the register)
This change has a few good effects:
decodefunction will be simplified a bit as we'll only grab the ID of the reg and not the reg object itself