Translate source register operand to SMT expr.
492656
def _translate_src_register_oprnd(self, operand):
        
        reg_info = self._arch_alias_mapper.get(operand.name, None)

        if reg_info:
            var_base_name, offset = reg_info

            var_size = self._arch_regs_size[var_base_name]
        else:
            var_base_name = operand.name
            var_size = operand.size

        var_name = self._get_var_name(var_base_name)
        ret_val = self.make_bitvec(var_size, var_name)

        if reg_info:
            ret_val = smtfunction.extract(ret_val, offset, operand.size)

        return ret_val
1160518
@SuppressWarnings("unchecked")
	public Expr translateExpression(WyilFile.Expr expr, Integer selector, LocalEnvironment environment) {
		Expr result;
		try {
			switch (expr.getOpcode()) {
			case WyilFile.EXPR_constant:
				result = translateConstant((WyilFile.Expr.Constant) expr, environment);
				break;
			case WyilFile.EXPR_cast:
				result = translateConvert((WyilFile.Expr.Cast) expr, environment);
				break;
			case WyilFile.EXPR_recordaccess:
			case WyilFile.EXPR_recordborrow:
				result = translateFieldLoad((WyilFile.Expr.RecordAccess) expr, environment);
				break;
			case WyilFile.EXPR_indirectinvoke:
				result = translateIndirectInvoke((WyilFile.Expr.IndirectInvoke) expr, environment);
				break;
			case WyilFile.EXPR_invoke:
				result = translateInvoke((WyilFile.Expr.Invoke) expr, selector, environment);
				break;
			case WyilFile.DECL_lambda:
				result = translateLambda((WyilFile.Decl.Lambda) expr, environment);
				break;
			case WyilFile.EXPR_lambdaaccess:
				result = translateLambda((WyilFile.Expr.LambdaAccess) expr, environment);
				break;
			case WyilFile.EXPR_logicalexistential:
			case WyilFile.EXPR_logicaluniversal:
				result = translateQuantifier((WyilFile.Expr.Quantifier) expr, environment);
				break;
			case WyilFile.EXPR_variablemove:
			case WyilFile.EXPR_variablecopy:
				result = translateVariableAccess((WyilFile.Expr.VariableAccess) expr, environment);
				break;
			case WyilFile.EXPR_staticvariable:
				result = translateStaticVariableAccess((WyilFile.Expr.StaticVariableAccess) expr, environment);
				break;
			case WyilFile.EXPR_logicalnot:
				result = translateNotOperator((WyilFile.Expr.LogicalNot) expr, environment);
				break;
			case WyilFile.EXPR_integernegation:
				result = translateArithmeticNegation((WyilFile.Expr.IntegerNegation) expr, environment);
				break;
			case WyilFile.EXPR_integeraddition:
			case WyilFile.EXPR_integersubtraction:
			case WyilFile.EXPR_integermultiplication:
			case WyilFile.EXPR_integerdivision:
			case WyilFile.EXPR_integerremainder:
			case WyilFile.EXPR_equal:
			case WyilFile.EXPR_notequal:
			case WyilFile.EXPR_integerlessthan:
			case WyilFile.EXPR_integerlessequal:
			case WyilFile.EXPR_integergreaterthan:
			case WyilFile.EXPR_integergreaterequal:
			case WyilFile.EXPR_logiaclimplication:
			case WyilFile.EXPR_logicaliff:
				result = translateBinaryOperator((WyilFile.Expr.BinaryOperator) expr, environment);
				break;
			case WyilFile.EXPR_logicaland:
			case WyilFile.EXPR_logicalor:
				result = translateNaryOperator((WyilFile.Expr.NaryOperator) expr, environment);
				break;
			case WyilFile.EXPR_is:
				result = translateIs((WyilFile.Expr.Is) expr, environment);
				break;
			case WyilFile.EXPR_arrayaccess:
			case WyilFile.EXPR_arrayborrow:
				result = translateArrayIndex((WyilFile.Expr.ArrayAccess) expr, environment);
				break;
			case WyilFile.EXPR_arrayinitialiser:
				result = translateArrayInitialiser((WyilFile.Expr.ArrayInitialiser) expr, environment);
				break;
			case WyilFile.EXPR_arraygenerator:
				result = translateArrayGenerator((WyilFile.Expr.ArrayGenerator) expr, environment);
				break;
			case WyilFile.EXPR_recordinitialiser:
				result = translateRecordInitialiser((WyilFile.Expr.RecordInitialiser) expr, environment);
				break;
			case WyilFile.EXPR_arraylength:
				result = translateArrayLength((WyilFile.Expr.ArrayLength) expr, environment);
				break;
			case WyilFile.EXPR_dereference:
				result = translateDereference((WyilFile.Expr.Dereference) expr, environment);
				break;
			case WyilFile.EXPR_bitwiseshr:
			case WyilFile.EXPR_bitwiseshl:
			case WyilFile.EXPR_bitwiseand:
			case WyilFile.EXPR_bitwiseor:
			case WyilFile.EXPR_bitwisexor:
			case WyilFile.EXPR_bitwisenot:
			case WyilFile.EXPR_new:
				result = translateAsUnknown(expr, environment);
				break;
			default:
				throw new RuntimeException("Deadcode reached (" + expr.getClass().getName() + ")");
			}
		} catch (SyntacticException e) {
			throw e;
		} catch (Throwable e) {
			throw new SyntacticException(e.getMessage(), ((WyilFile) expr.getHeap()).getEntry(), expr, e);
		}
		return allocate(result, expr.getParent(WyilFile.Attribute.Span.class));
	}
1127037
def p_expr_include(p):
    ''
    p[0] = ast.Include(p[2], False, lineno=p.lineno(1))
73200
def compile_expression(source):
    

    # FORCE MODULES TO BE IN NAMESPACE
    _ = coalesce
    _ = listwrap
    _ = Date
    _ = convert
    _ = Log
    _ = Data
    _ = EMPTY_DICT
    _ = re
    _ = wrap_leaves
    _ = is_data

    fake_locals = {}
    try:
        exec(
"""
def output(row, rownum=None, rows=None):
    _source = """ + convert.value2quote(source) + """
    try:
        return """ + source + """
    except Exception as e:
        Log.error("Problem with dynamic function {{func|quote}}",  func=_source, cause=e)
""",
            globals(),
            fake_locals
        )
    except Exception as e:
        Log.error("Bad source: {{source}}", source=source, cause=e)
    return fake_locals['output']
1101771
def translate(self, instruction):
        
        try:
            trans_instrs = self.__translate(instruction)
        except NotImplementedError:
            unkn_instr = self._builder.gen_unkn()
            unkn_instr.address = instruction.address << 8 | (0x0 & 0xff)
            trans_instrs = [unkn_instr]

            self._log_not_supported_instruction(instruction)
        except Exception:
            self._log_translation_exception(instruction)

            raise

        return trans_instrs
1235090
def _translate_src_oprnd(self, operand):
        
        if isinstance(operand, ReilRegisterOperand):
            return self._translate_src_register_oprnd(operand)
        elif isinstance(operand, ReilImmediateOperand):
            return smtsymbol.Constant(operand.size, operand.immediate)
        else:
            raise Exception("Invalid operand type")
573044
private RValue executeConvert(Expr.Cast expr, CallStack frame) {
		RValue operand = executeExpression(ANY_T, expr.getOperand(), frame);
		return operand.convert(expr.getType());
	}
317962
def expect(instr, expected, context):
    
    if not isinstance(instr, expected):
        raise DecompilationError(
            "Expected a {expected} instruction {context}. Got {instr}.".format(
                instr=instr, expected=expected, context=context,
            )
        )
    return instr
1360056
def to_risc(compiler)
      const_reg = @right.to_register(compiler , original_source)
      left_slots = @left.slots
      case @left.known_object
      when Symbol
        sym_to_risc(compiler , const_reg)
      when Parfait::CacheEntry
        left = compiler.use_reg( :CacheEntry )
        compiler.add_code Risc.load_constant(original_source, @left.known_object , left)
        compiler.add_code Risc.reg_to_slot(original_source, const_reg , left, left_slots.first)
      else
        raise "We have left #{@left.known_object}"
      end
      compiler.reset_regs
    end
707803
def expressionToAST(ex):
    
    return ASTNode(ex.astType, ex.astKind, ex.value,
                   [expressionToAST(c) for c in ex.children])
753631
def wrap_expr(self, src: str, dfltChaining: bool) -> str:
        """"""
        diff_binding = self.op_man.diff_binding()
        if diff_binding < 0 or diff_binding == 0 and not dfltChaining:
            return self.parenthesize(src)
        else:
            return src
1290669
void emitX86(INST_CODE code, Operand o1, Operand o2) {
        _emitX86(code, o1, o2, _none);
    }
187393
def p_expr_pre_incdec(p):
    ''''''
    p[0] = ast.PreIncDecOp(p[1], p[2], lineno=p.lineno(1))
296831
def parse_expr(tokens, options):
    """"""
    seq = parse_seq(tokens, options)
    if tokens.current() != '|':
        return seq
    result = [Required(*seq)] if len(seq) > 1 else seq
    while tokens.current() == '|':
        tokens.move()
        seq = parse_seq(tokens, options)
        result += [Required(*seq)] if len(seq) > 1 else seq
    return [Either(*result)] if len(result) > 1 else result
197399
def stmt_lambda_proc(self, inputstring, **kwargs):
        """"""
        regexes = []
        for i in range(len(self.stmt_lambdas)):
            name = self.stmt_lambda_name(i)
            regex = compile_regex(r"\b%s\b" % (name,))
            regexes.append(regex)
        out = []
        for line in inputstring.splitlines():
            for i, regex in enumerate(regexes):
                if regex.search(line):
                    indent, line = split_leading_indent(line)
                    out.append(indent + self.stmt_lambdas[i])
            out.append(line)
        return "\n".join(out)
231781
def translate(self):
        """"""
        ident = self.ident
        expr = ex_rvalue(VARIABLE_PREFIX + ident)
        return [expr], set([ident]), set()
740332
def p_call_expr(self, p):
        
        if len(p) == 3:
            p[0] = self.asttypes.FunctionCall(p[1], p[2])
            p[0].setpos(p)  # require yacc_tracking
        elif len(p) == 4:
            p[0] = self.asttypes.DotAccessor(p[1], p[3])
            p[0].setpos(p, 2)
        else:
            p[0] = self.asttypes.BracketAccessor(p[1], p[3])
            p[0].setpos(p, 2)