def _exp_sub(code: Code, exp): left = exp['left'] right = exp['right'] left_type = exp['left']['type'] _expression(code, left) _expression(code, right) if isinstance(left_type, TypeInt): code.add_int() elif isinstance(left_type, TypeReal): code.add_double() else: raise NotImplementedError()
def _exp_plus(code: Code, exp): left = exp['left'] right = exp['right'] left_type = exp['left']['type'] _expression(code, left) _expression(code, right) if isinstance(left_type, TypeInt): code.add_int() elif isinstance(left_type, TypeReal): code.add_double() elif isinstance(left_type, TypeStr): code.invoke_virtual(*JM_STRING_CONCAT) else: raise NotImplementedError()