oh I had a similar problem when decoding powerpc instructions. What I ended up 
with was a macro which among other things "unrolled" the branches using a 
table. This would look kind off like this for your example:
    
    
    const offsets: array[Sym, int] = [ord(high(Sym))+1, 0, 0, #[ecetera]#]
    
    case ord(a.kind) + offsets[a.kind]
    # all the cases which can be decoded based on the first part
    of 0: discard
    of 1: discard
    # …
    of ord(high(Sym))+1: # when a.kind == symNumber and b.kind == symNumber:
      discard
    of ord(high(Sym))+2: # when a.kind == symNumber and b.kind == symSymbol:
      discard
    
    
    Run

Another advantage this brought me was that I could use computed goto for the 
interpreter.

Reply via email to