You define an enum of 10 values and then each of the next 10 identifiers (e.g. PUSH, POP) get defined relative to the first identifier (which is 0). Thus, we end up with PUSH=0, POP=1, etc... up to JZ=11.
Sounds great, but too much of a breaking change for the rewrite, which I want to keep very close to the current version. I'll think about it for the potential calc= v2.
If you want to design a VM in
calc=
and are laying out your opcode definitions, you end up with code looking like this:However, this can be easily simplified with a new enum declaration which is identical to the former code in function but more elegant in structure:
You define an
enum
of 10 values and then each of the next 10 identifiers (e.g.PUSH
,POP
) get defined relative to the first identifier (which is 0). Thus, we end up withPUSH
=0,POP
=1, etc... up toJZ
=11.