def cb_deref_imm_reg(tokens): if len(tokens) == 1: return AstMem(tokens[0], 32) elif len(tokens) == 2: return AstMem(tokens[1] + tokens[0], 32) else: raise NotImplementedError('len(tokens) > 2')
def cb_regreg(tokens): assert len(tokens) == 2 result = AstMem(tokens[0] + tokens[1], 32) return result
def cb_postinc(tokens): assert len(tokens) == 1 result = AstMem(AstOp('postinc', tokens[0]), 32) return result
def cb_predec(tokens): assert len(tokens) == 1 result = AstMem(AstOp('predec', tokens[0]), 32) return result
def cb_deref_mem(tokens): assert len(tokens) == 1 result = AstMem(tokens[0], 32) return result
def cb_deref_off(tokens): assert len(tokens) == 2 result = AstMem(tokens[1] + tokens[0], 16) return result
def cb_deref_nooff(tokens): assert len(tokens) == 1 result = AstMem(tokens[0], 16) return result
def cb_deref_nooff(tokens): if len(tokens) != 3: raise NotImplementedError("TODO") return AstMem(tokens[1], 32)
def cb_deref(tokens): if len(tokens) != 4: raise NotImplementedError("TODO") return AstMem(tokens[2] + tokens[0], 32)