1 # Pep/8 instructions are not reserved as keywords. It is common
2 # that the identifier of an instruction will be used for a label.
3 # For this reason, we cannot create precise instruction nodes with
6 # This module manually creates the expected subclass with an additionnal
9 module suffixed_instructions
11 import rich_instructions
16 abstract class ARegisterSuffixed
19 fun register
: Char do return n_id
.text
.to_upper
.last
22 abstract class ADigitSuffixed
25 fun digit
: Int do return n_id
.text
.last
.to_i
26 fun digit_max
: Int is abstract
31 # Other classification
33 redef class AUnaryNopInstruction
35 redef fun digit_max
do return (1 << 2)-1
38 redef class ANotInstruction
39 super ARegisterSuffixed
42 redef class ANegInstruction
43 super ARegisterSuffixed
46 redef class AShiftInstruction
47 super ARegisterSuffixed
50 redef class ARetInstruction
52 redef fun digit_max
do return (1 << 3)-1
55 redef abstract class AArithmeticInstruction
56 super ARegisterSuffixed
59 redef abstract class ALoadInstruction
60 super ARegisterSuffixed
63 redef abstract class AStoreInstruction
64 super ARegisterSuffixed