/* private static expression_node char_to_int(location call_location,expression_node[] expr) { if (expr.Length != 1) { return null; } if (expr[0].type != char_type) { return null; } char_const_node ccn = expr[0] as char_const_node; if (ccn == null) { return null; } return new int_const_node((int)ccn.constant_value, ccn.location); } */ private static basic_function_node create_emty_function(type_node ret_type, string name) { basic_function_node bfn = new basic_function_node(SemanticTree.basic_function_type.none, ret_type, true, name); basic_parameter par = new basic_parameter(compiler_string_consts.unary_param_name, ret_type, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par); bfn.compile_time_executor = delegated_empty_method; add_stand_type(SemanticTree.basic_function_type.none, bfn); return bfn; }
public static basic_function_node make_generated_type_conversion(type_node from, type_node to, type_compare tc, SemanticTree.basic_function_type bft, bool is_implicit) { basic_function_node conv_method = new basic_function_node(bft, to, false); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, from, SemanticTree.parameter_type.value, conv_method); conv_method.parameters.AddElement(bp); type_table.add_generated_type_conversion_from_defined(from, to, conv_method, tc, is_implicit); return conv_method; }
private static basic_function_node create_oti_method(SemanticTree.basic_function_type bft, type_node type, SemanticTree.parameter_type pt) { basic_function_node bfn = new basic_function_node(bft, type, true); basic_parameter cp = new basic_parameter(compiler_string_consts.unary_param_name, type, pt, bfn); bfn.parameters.AddElement(cp); //TODO: Важен порядок вызовов. add_stand_type(bft, bfn); return bfn; }
public static basic_function_node make_unary_operator(string operator_name, type_node to, SemanticTree.basic_function_type bft, type_node ret_value_type) { basic_function_node bfn = new basic_function_node(bft, ret_value_type,true); basic_parameter par = new basic_parameter(compiler_string_consts.unary_param_name, to, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par); to.add_name(operator_name, new SymbolInfo(bfn)); add_stand_type(bft, bfn); return bfn; }
public static basic_function_node make_type_conversion(type_node from, type_node to, type_compare tc, SemanticTree.basic_function_type bft, bool is_implicit) { basic_function_node conv_method = new basic_function_node(bft, to,false); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, from, SemanticTree.parameter_type.value, conv_method); conv_method.parameters.AddElement(bp); type_table.add_type_conversion_from_defined(from, to, conv_method, tc, is_implicit); //type_intersection_node inter_node = new type_intersection_node(tc); //inter_node.this_to_another = new type_conversion(conv_method,!is_implicit); //from.add_intersection_node(to, inter_node); add_stand_type(bft, conv_method); return conv_method; }
private static basic_function_node make_unary_function(type_node param_type, SemanticTree.basic_function_type bft,type_node ret_val_type) { basic_function_node bfn = new basic_function_node(bft, ret_val_type, true); basic_parameter bpar = new basic_parameter(compiler_string_consts.unary_param_name, param_type, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(bpar); add_stand_type(bft, bfn); return bfn; }
public static basic_function_node make_common_binary_operation(string operator_name, type_node def_type,type_node left,type_node right, SemanticTree.basic_function_type bft,type_node ret_value_type) { basic_function_node bfn = new basic_function_node(bft, ret_value_type,true,operator_name); basic_parameter par_left = new basic_parameter(compiler_string_consts.left_param_name, left, SemanticTree.parameter_type.value, bfn); basic_parameter par_right = new basic_parameter(compiler_string_consts.right_param_name, right, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par_left); bfn.parameters.AddElement(par_right); def_type.add_name(operator_name, new SymbolInfo(bfn)); add_stand_type(bft, bfn); return bfn; }
private static basic_function_node make_object_operator(type_node ctn, SemanticTree.basic_function_type bas_ft, string name, type_node ret_type, SemanticTree.parameter_type first_parameter_type) { basic_function_node bfn = new basic_function_node(bas_ft, ret_type,true,name); basic_parameter to = new basic_parameter(compiler_string_consts.left_param_name, ctn, first_parameter_type, bfn); basic_parameter from = new basic_parameter(compiler_string_consts.right_param_name, ctn, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(to); bfn.parameters.AddElement(from); ctn.add_name(name, new SymbolInfo(bfn)); add_stand_type(bas_ft, bfn); return bfn; }
private static void add_stand_type(SemanticTree.basic_function_type bft, basic_function_node bfn) { ht[bft] = bfn; }
/*public static void Reset() { (string_type as compiled_type_node).reinit_scope(); }*/ //TODO: Замечание к TODO перед этим классом. Просто сохранить ссылки на все объекты, которые мы здесь получаем. private static void initialize_types() { //TODO: (??? подумать над именами!!) /* bit Shortint signed 8 Byte unsigned 8 Smallint signed 16 Word unsigned 16 Integer signed 32 Cardinal unsigned 32 Longint signed 64 ULongint unsigned 64 Decimal signed 128 */ _byte_type = compiled_type_node.get_type_node(typeof(byte), symtab); _byte_type.SetName(compiler_string_consts.byte_type_name); _sbyte_type = compiled_type_node.get_type_node(typeof(sbyte), symtab); _sbyte_type.SetName(compiler_string_consts.sbyte_type_name); _short_type = compiled_type_node.get_type_node(typeof(short), symtab); _short_type.SetName(compiler_string_consts.short_type_name); _ushort_type = compiled_type_node.get_type_node(typeof(ushort), symtab); _ushort_type.SetName(compiler_string_consts.ushort_type_name); _integer_type = compiled_type_node.get_type_node(typeof(int), symtab); _integer_type.SetName(compiler_string_consts.integer_type_name); _uint_type = compiled_type_node.get_type_node(typeof(uint), symtab); _uint_type.SetName(compiler_string_consts.uint_type_name); _int64_type = compiled_type_node.get_type_node(typeof(long), symtab); _int64_type.SetName(compiler_string_consts.long_type_name); _uint64_type = compiled_type_node.get_type_node(typeof(ulong), symtab); _uint64_type.SetName(compiler_string_consts.ulong_type_name); _icloneable_interface = compiled_type_node.get_type_node(typeof(ICloneable), symtab); _ilist_interface = compiled_type_node.get_type_node(typeof(IList), symtab); _icollection_interface = compiled_type_node.get_type_node(typeof(ICollection)); _ienumerable_interface = compiled_type_node.get_type_node(typeof(IEnumerable)); _ilist1_interface = compiled_type_node.get_type_node(typeof(IList<>)); _icollection1_interface = compiled_type_node.get_type_node(typeof(ICollection<>)); _ienumerable1_interface = compiled_type_node.get_type_node(typeof(IEnumerable<>)); _assert_method = compiled_function_node.get_compiled_method(typeof(System.Diagnostics.Debug).GetMethod("Assert",new Type[1]{typeof(bool)})); _decimal_type = compiled_type_node.get_type_node(typeof(decimal), symtab); //_decimal_type.SetName(compiler_string_consts.decimal_type_name); make_assign_operator(_decimal_type, SemanticTree.basic_function_type.objassign); _bool_type = compiled_type_node.get_type_node(typeof(bool), symtab); _bool_type.SetName(compiler_string_consts.bool_type_name); _double_type = compiled_type_node.get_type_node(typeof(double), symtab); _double_type.SetName(compiler_string_consts.real_type_name); _float_type = compiled_type_node.get_type_node(typeof(float), symtab); _float_type.SetName(compiler_string_consts.float_type_name); _char_type = compiled_type_node.get_type_node(typeof(char), symtab); _char_type.SetName(compiler_string_consts.char_type_name); _string_type = compiled_type_node.get_type_node(typeof(string), symtab); _string_type.SetName(compiler_string_consts.string_type_name); _pointer_type = compiled_type_node.get_type_node(NetHelper.NetHelper.void_ptr_type, symtab); _pointer_type.SetName(compiler_string_consts.pointer_type_name); _object_type = compiled_type_node.get_type_node(typeof(object), symtab); _object_type.SetName(compiler_string_consts.object_type_name); _enum_base_type = compiled_type_node.get_type_node(typeof(System.Enum), symtab); _delegate_base_type = compiled_type_node.get_type_node(typeof(System.MulticastDelegate), symtab); _delegate_base_type.SetName(compiler_string_consts.base_delegate_type_name); _system_delegate_type = compiled_type_node.get_type_node(typeof(System.Delegate), symtab); _array_base_type = compiled_type_node.get_type_node(typeof(System.Array), symtab); _array_base_type.SetName(compiler_string_consts.base_array_type_name); _void_type = compiled_type_node.get_type_node(typeof(void), symtab); _value_type = compiled_type_node.get_type_node(typeof(ValueType),symtab); Type delegate_type = typeof(System.Delegate); Type[] arr_params=new Type[2]; arr_params[0]=delegate_type; arr_params[1]=delegate_type; _delegate_combine_method = compiled_function_node.get_compiled_method(delegate_type.GetMethod(compiler_string_consts.combine_method_name, arr_params)); _delegate_remove_method = compiled_function_node.get_compiled_method(delegate_type.GetMethod(compiler_string_consts.remove_method_name, arr_params)); _object_equals_method = compiled_function_node.get_compiled_method(typeof(object).GetMethod(compiler_string_consts.object_equals_name, new Type[2] { typeof(object), typeof(object) })); //Это для прикола. Убрать! //make_common_binary_operation(compiler_string_consts.plus_name, _integer_type, _integer_type, _byte_type, SemanticTree.basic_function_type.badd, _byte_type); //Это нормально? (чтобы работало i:=+15;) /* make_unary_operator(compiler_string_consts.plus_name, _byte_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _integer_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _long_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _real_type, SemanticTree.basic_function_type.none); */ //integer type //Преобразования типов. _int_to_byte = make_type_conversion(_integer_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.itob); _int_to_sbyte = make_type_conversion(_integer_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.itosb); _int_to_short = make_type_conversion(_integer_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.itos); _int_to_ushort = make_type_conversion(_integer_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.itous); _int_to_uint = make_type_conversion(_integer_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.itoui); _int_to_long = make_type_conversion(_integer_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.itol); _int_to_ulong = make_type_conversion(_integer_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.itoul); _int_to_char = make_type_conversion(_integer_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.itochar, false); _int_to_double=make_type_conversion(_integer_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.itod); //make_type_conversion(_integer_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.itol); _int_to_float = make_type_conversion(_integer_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.itof); //Присваивание для integer. _int_assign=make_assign_operator(_integer_type, SemanticTree.basic_function_type.iassign); //Унарные операции. _int_unmin=make_unary_operator(compiler_string_consts.minus_name, _integer_type, SemanticTree.basic_function_type.iunmin); _int_not = make_unary_operator(compiler_string_consts.not_name, _integer_type, SemanticTree.basic_function_type.inot); make_unary_empty_operator(compiler_string_consts.plus_name, _integer_type, _integer_type); //Арифметические операции. _int_add = make_binary_operator(compiler_string_consts.plus_name, _integer_type, SemanticTree.basic_function_type.iadd); _int_sub = make_binary_operator(compiler_string_consts.minus_name, _integer_type, SemanticTree.basic_function_type.isub); _int_mul=make_binary_operator(compiler_string_consts.mul_name, _integer_type, SemanticTree.basic_function_type.imul); _int_idiv=make_binary_operator(compiler_string_consts.idiv_name, _integer_type, SemanticTree.basic_function_type.idiv); _int_mod=make_binary_operator(compiler_string_consts.mod_name, _integer_type, SemanticTree.basic_function_type.imod); //Операция / для integer. _int_div = make_common_binary_operation(compiler_string_consts.div_name, _integer_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //_int_div = make_common_binary_operation(compiler_string_consts.div_name, _integer_type, _integer_type, _integer_type, // SemanticTree.basic_function_type.ddiv, _real_type); //Опрерации сравнения. _int_gr=make_binary_operator(compiler_string_consts.gr_name, _integer_type, SemanticTree.basic_function_type.igr, _bool_type); _int_greq=make_binary_operator(compiler_string_consts.greq_name, _integer_type, SemanticTree.basic_function_type.igreq, _bool_type); _int_sm=make_binary_operator(compiler_string_consts.sm_name, _integer_type, SemanticTree.basic_function_type.ism, _bool_type); _int_smeq=make_binary_operator(compiler_string_consts.smeq_name, _integer_type, SemanticTree.basic_function_type.ismeq, _bool_type); _int_eq=make_binary_operator(compiler_string_consts.eq_name, _integer_type, SemanticTree.basic_function_type.ieq, _bool_type); _int_noteq=make_binary_operator(compiler_string_consts.noteq_name, _integer_type, SemanticTree.basic_function_type.inoteq, _bool_type); //Логические опреции. _int_and=make_binary_operator(compiler_string_consts.and_name, _integer_type, SemanticTree.basic_function_type.iand); _int_or=make_binary_operator(compiler_string_consts.or_name, _integer_type, SemanticTree.basic_function_type.ior); _int_xor=make_binary_operator(compiler_string_consts.xor_name, _integer_type, SemanticTree.basic_function_type.ixor); _int_shl=make_binary_operator(compiler_string_consts.shl_name, _integer_type, SemanticTree.basic_function_type.ishl); _int_shr=make_binary_operator(compiler_string_consts.shr_name, _integer_type, SemanticTree.basic_function_type.ishr); //byte type. //Assign. _byte_assign = make_assign_operator(_byte_type, SemanticTree.basic_function_type.bassign); //Преобразования типов. _byte_to_sbyte = make_type_conversion(_byte_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.btosb); _byte_to_short = make_type_conversion(_byte_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.btos); _byte_to_ushort = make_type_conversion(_byte_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.btous); _byte_to_uint = make_type_conversion(_byte_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.btoui); _byte_to_long = make_type_conversion(_byte_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.btol); _byte_to_ulong = make_type_conversion(_byte_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.btoul); _byte_to_int = make_type_conversion(_byte_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.btoi); _byte_to_char = make_type_conversion(_byte_type, _char_type, type_compare.less_type, SemanticTree.basic_function_type.btochar,false); _byte_to_float = make_type_conversion(_byte_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.btof); _byte_to_double = make_type_conversion(_byte_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.btod); //Унарные операции. _byte_unmin = make_unary_operator(compiler_string_consts.minus_name, _byte_type, SemanticTree.basic_function_type.bunmin, _integer_type); _byte_not = make_unary_operator(compiler_string_consts.not_name, _byte_type, SemanticTree.basic_function_type.bnot); make_unary_empty_operator(compiler_string_consts.plus_name, _byte_type, _byte_type); //Опрерации сравнения. /* _byte_gr = make_binary_operator(compiler_string_consts.gr_name, _byte_type, SemanticTree.basic_function_type.bgr, _bool_type); _byte_greq = make_binary_operator(compiler_string_consts.greq_name, _byte_type, SemanticTree.basic_function_type.bgreq, _bool_type); _byte_sm = make_binary_operator(compiler_string_consts.sm_name, _byte_type, SemanticTree.basic_function_type.bsm, _bool_type); _byte_smeq = make_binary_operator(compiler_string_consts.smeq_name, _byte_type, SemanticTree.basic_function_type.bsmeq, _bool_type); _byte_eq = make_binary_operator(compiler_string_consts.eq_name, _byte_type, SemanticTree.basic_function_type.beq, _bool_type); _byte_noteq = make_binary_operator(compiler_string_consts.noteq_name, _byte_type, SemanticTree.basic_function_type.bnoteq, _bool_type); */ add_function_to_type(compiler_string_consts.not_name, _byte_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _byte_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _byte_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _byte_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _byte_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _byte_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _byte_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _byte_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _byte_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _byte_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _byte_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _byte_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _byte_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _byte_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _byte_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _byte_type, _int_xor);*/ //Арифметические операции. //_byte_add = make_common_binary_operation(compiler_string_consts.plus_name, _byte_type, _byte_type,_byte_type, SemanticTree.basic_function_type.badd, _integer_type); /* _byte_sub = make_common_binary_operation(compiler_string_consts.minus_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bsub, _integer_type); _byte_mul = make_common_binary_operation(compiler_string_consts.mul_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bmul, _integer_type); _byte_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bdiv, _integer_type); _byte_mod = make_common_binary_operation(compiler_string_consts.mod_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bmod, _integer_type); */ //Операция / для byte. _byte_div = make_common_binary_operation(compiler_string_consts.div_name, _byte_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _byte_and = make_common_binary_operation(compiler_string_consts.and_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.band, _byte_type); _byte_or = make_common_binary_operation(compiler_string_consts.or_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bor, _byte_type); _byte_xor = make_common_binary_operation(compiler_string_consts.xor_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bxor, _byte_type); add_function_to_type(compiler_string_consts.shl_name, _byte_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _byte_type, _int_shr); //_byte_shl = make_binary_operator(compiler_string_consts.shl_name, _byte_type, SemanticTree.basic_function_type.bshl); //_byte_shr = make_binary_operator(compiler_string_consts.shr_name, _byte_type, SemanticTree.basic_function_type.bshr); //sbyte type. //Assign. _sbyte_assign = make_assign_operator(_sbyte_type, SemanticTree.basic_function_type.sbassign); //Преобразования sbyteов. _sbyte_to_byte = make_type_conversion(_sbyte_type, _byte_type, type_compare.less_type, SemanticTree.basic_function_type.sbtob); _sbyte_to_short = make_type_conversion(_sbyte_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.sbtos); _sbyte_to_ushort = make_type_conversion(_sbyte_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.sbtous); _sbyte_to_uint = make_type_conversion(_sbyte_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoui); _sbyte_to_long = make_type_conversion(_sbyte_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.sbtol); _sbyte_to_ulong = make_type_conversion(_sbyte_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoul); _sbyte_to_int = make_type_conversion(_sbyte_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoi); _sbyte_to_char = make_type_conversion(_sbyte_type, _char_type, type_compare.less_type, SemanticTree.basic_function_type.sbtochar,false); _sbyte_to_float = make_type_conversion(_sbyte_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.sbtof); _sbyte_to_double = make_type_conversion(_sbyte_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.sbtod); //Унарные операции. _sbyte_unmin = make_unary_operator(compiler_string_consts.minus_name, _sbyte_type, SemanticTree.basic_function_type.sbunmin, _integer_type); _sbyte_not = make_unary_operator(compiler_string_consts.not_name, _sbyte_type, SemanticTree.basic_function_type.sbnot); make_unary_empty_operator(compiler_string_consts.plus_name, _sbyte_type, _sbyte_type); add_function_to_type(compiler_string_consts.not_name, _sbyte_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _sbyte_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _sbyte_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _sbyte_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _sbyte_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _sbyte_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _sbyte_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _sbyte_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _sbyte_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _sbyte_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _sbyte_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _sbyte_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _sbyte_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _sbyte_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _sbyte_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _sbyte_type, _int_xor);*/ //Опрерации сравнения. /* _sbyte_gr = make_binary_operator(compiler_string_consts.gr_name, _sbyte_type, SemanticTree.basic_function_type.sbgr, _bool_type); _sbyte_greq = make_binary_operator(compiler_string_consts.greq_name, _sbyte_type, SemanticTree.basic_function_type.sbgreq, _bool_type); _sbyte_sm = make_binary_operator(compiler_string_consts.sm_name, _sbyte_type, SemanticTree.basic_function_type.sbsm, _bool_type); _sbyte_smeq = make_binary_operator(compiler_string_consts.smeq_name, _sbyte_type, SemanticTree.basic_function_type.sbsmeq, _bool_type); _sbyte_eq = make_binary_operator(compiler_string_consts.eq_name, _sbyte_type, SemanticTree.basic_function_type.sbeq, _bool_type); _sbyte_noteq = make_binary_operator(compiler_string_consts.noteq_name, _sbyte_type, SemanticTree.basic_function_type.sbnoteq, _bool_type); */ //Арифметические операции. /* _sbyte_add = make_common_binary_operation(compiler_string_consts.plus_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbadd, _integer_type); _sbyte_sub = make_common_binary_operation(compiler_string_consts.minus_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbsub, _integer_type); _sbyte_mul = make_common_binary_operation(compiler_string_consts.mul_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbmul, _integer_type); _sbyte_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbdiv, _integer_type); _sbyte_mod = make_common_binary_operation(compiler_string_consts.mod_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbmod, _integer_type); */ //Операция / для byte. _sbyte_div = make_common_binary_operation(compiler_string_consts.div_name, _sbyte_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _sbyte_and = make_common_binary_operation(compiler_string_consts.and_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sband, _sbyte_type); _sbyte_or = make_common_binary_operation(compiler_string_consts.or_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbor, _sbyte_type); _sbyte_xor = make_common_binary_operation(compiler_string_consts.xor_name, _sbyte_type,_sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbxor, _sbyte_type); add_function_to_type(compiler_string_consts.shl_name, _sbyte_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _sbyte_type, _int_shr); //short type. //Assign. _short_assign = make_assign_operator(_short_type, SemanticTree.basic_function_type.sassign); //Преобразования shortов. _short_to_byte = make_type_conversion(_short_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.stob); _short_to_sbyte = make_type_conversion(_short_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.stosb); _short_to_ushort = make_type_conversion(_short_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.stous); _short_to_uint = make_type_conversion(_short_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.stoui); _short_to_long = make_type_conversion(_short_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.stol); _short_to_ulong = make_type_conversion(_short_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.stoul); _short_to_int = make_type_conversion(_short_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.stoi); _short_to_char = make_type_conversion(_short_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.stochar,false); _short_to_float = make_type_conversion(_short_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.stof); _short_to_double = make_type_conversion(_short_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.stod); //Унарные операции. _short_unmin = make_unary_operator(compiler_string_consts.minus_name, _short_type, SemanticTree.basic_function_type.sunmin,_integer_type); _short_not = make_unary_operator(compiler_string_consts.not_name, _short_type, SemanticTree.basic_function_type.snot); make_unary_empty_operator(compiler_string_consts.plus_name, _short_type, _short_type); add_function_to_type(compiler_string_consts.not_name, _short_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _short_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _short_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _short_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _short_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _short_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _short_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _short_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _short_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _short_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _short_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _short_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _short_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _short_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _short_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _short_type, _int_xor);*/ //Опрерации сравнения. /* _short_gr = make_binary_operator(compiler_string_consts.gr_name, _short_type, SemanticTree.basic_function_type.sgr, _bool_type); _short_greq = make_binary_operator(compiler_string_consts.greq_name, _short_type, SemanticTree.basic_function_type.sgreq, _bool_type); _short_sm = make_binary_operator(compiler_string_consts.sm_name, _short_type, SemanticTree.basic_function_type.ssm, _bool_type); _short_smeq = make_binary_operator(compiler_string_consts.smeq_name, _short_type, SemanticTree.basic_function_type.ssmeq, _bool_type); _short_eq = make_binary_operator(compiler_string_consts.eq_name, _short_type, SemanticTree.basic_function_type.seq, _bool_type); _short_noteq = make_binary_operator(compiler_string_consts.noteq_name, _short_type, SemanticTree.basic_function_type.snoteq, _bool_type); */ //Арифметические операции. /* _short_add = make_common_binary_operation(compiler_string_consts.plus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sadd, _integer_type); _short_sub = make_common_binary_operation(compiler_string_consts.minus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.ssub, _integer_type); _short_mul = make_common_binary_operation(compiler_string_consts.mul_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smul, _integer_type); _short_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sdiv, _integer_type); _short_mod = make_common_binary_operation(compiler_string_consts.mod_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smod, _integer_type); */ //Операция / для byte. _short_div = make_common_binary_operation(compiler_string_consts.div_name, _short_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _short_and = make_common_binary_operation(compiler_string_consts.and_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sand, _short_type); _short_or = make_common_binary_operation(compiler_string_consts.or_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sor, _short_type); _short_xor = make_common_binary_operation(compiler_string_consts.xor_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sxor, _short_type); add_function_to_type(compiler_string_consts.shl_name, _short_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _short_type, _int_shr); //ushort type. //Assign. _ushort_assign = make_assign_operator(_ushort_type, SemanticTree.basic_function_type.usassign); //Преобразования ushortов. _ushort_to_byte = make_type_conversion(_ushort_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ustob); _ushort_to_sbyte = make_type_conversion(_ushort_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ustosb); _ushort_to_short = make_type_conversion(_ushort_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.ustos); _ushort_to_uint = make_type_conversion(_ushort_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.ustoui); _ushort_to_long = make_type_conversion(_ushort_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.ustol); _ushort_to_ulong = make_type_conversion(_ushort_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.ustoul); _ushort_to_int = make_type_conversion(_ushort_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.ustoi); _ushort_to_char = make_type_conversion(_ushort_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ustochar,false); _ushort_to_float = make_type_conversion(_ushort_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ustof); _ushort_to_double = make_type_conversion(_ushort_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ustod); //Унарные операции. _ushort_unmin = make_unary_operator(compiler_string_consts.minus_name, _ushort_type, SemanticTree.basic_function_type.usunmin, _integer_type); _ushort_not = make_unary_operator(compiler_string_consts.not_name, _ushort_type, SemanticTree.basic_function_type.usnot); make_unary_empty_operator(compiler_string_consts.plus_name, _ushort_type, _ushort_type); add_function_to_type(compiler_string_consts.not_name, _ushort_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _ushort_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _ushort_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _ushort_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _ushort_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _ushort_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _ushort_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _ushort_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _ushort_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _ushort_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _ushort_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _ushort_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _ushort_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _ushort_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _ushort_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _ushort_type, _int_xor);*/ //Опрерации сравнения. /* _ushort_gr = make_binary_operator(compiler_string_consts.gr_name, _ushort_type, SemanticTree.basic_function_type.usgr, _bool_type); _ushort_greq = make_binary_operator(compiler_string_consts.greq_name, _ushort_type, SemanticTree.basic_function_type.usgreq, _bool_type); _ushort_sm = make_binary_operator(compiler_string_consts.sm_name, _ushort_type, SemanticTree.basic_function_type.ussm, _bool_type); _ushort_smeq = make_binary_operator(compiler_string_consts.smeq_name, _ushort_type, SemanticTree.basic_function_type.ussmeq, _bool_type); _ushort_eq = make_binary_operator(compiler_string_consts.eq_name, _ushort_type, SemanticTree.basic_function_type.useq, _bool_type); _ushort_noteq = make_binary_operator(compiler_string_consts.noteq_name, _ushort_type, SemanticTree.basic_function_type.usnoteq, _bool_type); */ //Арифметические операции. /* _ushort_add = make_common_binary_operation(compiler_string_consts.plus_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usadd, _integer_type); _ushort_sub = make_common_binary_operation(compiler_string_consts.minus_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.ussub, _integer_type); _ushort_mul = make_common_binary_operation(compiler_string_consts.mul_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usmul, _integer_type); _ushort_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usdiv, _integer_type); _ushort_mod = make_common_binary_operation(compiler_string_consts.mod_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usmod, _integer_type); */ //Операция / для byte. _ushort_div = make_common_binary_operation(compiler_string_consts.div_name, _ushort_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _ushort_and = make_common_binary_operation(compiler_string_consts.and_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usand, _ushort_type); _ushort_or = make_common_binary_operation(compiler_string_consts.or_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usor, _ushort_type); _ushort_xor = make_common_binary_operation(compiler_string_consts.xor_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usxor, _ushort_type); add_function_to_type(compiler_string_consts.shl_name, _ushort_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _ushort_type, _int_shr); /* //short type. //Assign. _short_assign = make_assign_operator(_short_type, SemanticTree.basic_function_type.sassign); //Преобразования shortов. _short_to_byte = make_type_conversion(_short_type, _byte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stob, false); _short_to_sbyte = make_type_conversion(_short_type, _sbyte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stosb, false); _short_to_ushort = make_type_conversion(_short_type, _ushort_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stous); _short_to_uint = make_type_conversion(_short_type, _uint_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stoui,false); _short_to_long = make_type_conversion(_short_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.stol); _short_to_ulong = make_type_conversion(_short_type, _ulong_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stoul); _short_to_int = make_type_conversion(_short_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.stoi); _short_to_char = make_type_conversion(_short_type, _char_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stochar, false); _short_to_float = make_type_conversion(_short_type, _real_type, type_compare.less_type, SemanticTree.basic_function_type.stof); _short_to_double = make_type_conversion(_short_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.stod); //Унарные операции. _short_unmin = make_unary_operator(compiler_string_consts.minus_name, _short_type, SemanticTree.basic_function_type.sunmin); _short_not = make_unary_operator(compiler_string_consts.not_name, _short_type, SemanticTree.basic_function_type.snot); make_unary_empty_operator(compiler_string_consts.plus_name, _short_type, _short_type); //Опрерации сравнения. _short_gr = make_binary_operator(compiler_string_consts.gr_name, _short_type, SemanticTree.basic_function_type.sgr, _bool_type); _short_greq = make_binary_operator(compiler_string_consts.greq_name, _short_type, SemanticTree.basic_function_type.sgreq, _bool_type); _short_sm = make_binary_operator(compiler_string_consts.sm_name, _short_type, SemanticTree.basic_function_type.ssm, _bool_type); _short_smeq = make_binary_operator(compiler_string_consts.smeq_name, _short_type, SemanticTree.basic_function_type.ssmeq, _bool_type); _short_eq = make_binary_operator(compiler_string_consts.eq_name, _short_type, SemanticTree.basic_function_type.seq, _bool_type); _short_noteq = make_binary_operator(compiler_string_consts.noteq_name, _short_type, SemanticTree.basic_function_type.snoteq, _bool_type); //Арифметические операции. _short_add = make_common_binary_operation(compiler_string_consts.plus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sadd, _integer_type); _short_sub = make_common_binary_operation(compiler_string_consts.minus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.ssub, _integer_type); _short_mul = make_common_binary_operation(compiler_string_consts.mul_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smul, _integer_type); _short_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sdiv, _integer_type); _short_mod = make_common_binary_operation(compiler_string_consts.mod_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smod, _integer_type); //Операция / для byte. _short_div = make_common_binary_operation(compiler_string_consts.div_name, _short_type, _real_type, _real_type, SemanticTree.basic_function_type.ddiv, _real_type); //Логические опреции. _short_and = make_common_binary_operation(compiler_string_consts.and_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sand, _integer_type); _short_or = make_common_binary_operation(compiler_string_consts.or_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sor, _integer_type); _short_xor = make_common_binary_operation(compiler_string_consts.xor_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sxor, _integer_type); add_funtion_to_type(compiler_string_consts.shl_name, _short_type, _int_shl); add_funtion_to_type(compiler_string_consts.shr_name, _short_type, _int_shr); */ //uint type. //Assign. _uint_assign = make_assign_operator(_uint_type, SemanticTree.basic_function_type.uiassign); //Преобразования uintов. _uint_to_byte = make_type_conversion(_uint_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.uitob); _uint_to_sbyte = make_type_conversion(_uint_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.uitosb); _uint_to_short = make_type_conversion(_uint_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.uitos); _uint_to_ushort = make_type_conversion(_uint_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.uitous); _uint_to_long = make_type_conversion(_uint_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.uitol); _uint_to_ulong = make_type_conversion(_uint_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.uitoul); _uint_to_int = make_type_conversion(_uint_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.uitoi); _uint_to_char = make_type_conversion(_uint_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.uitochar,false); _uint_to_float = make_type_conversion(_uint_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.uitof); _uint_to_double = make_type_conversion(_uint_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.uitod); //Унарные операции. _uint_unmin = make_unary_operator(compiler_string_consts.minus_name, _uint_type, SemanticTree.basic_function_type.uiunmin, _int64_type); _uint_not = make_unary_operator(compiler_string_consts.not_name, _uint_type, SemanticTree.basic_function_type.uinot); make_unary_empty_operator(compiler_string_consts.plus_name, _uint_type, _uint_type); //Опрерации сравнения. _uint_gr = make_binary_operator(compiler_string_consts.gr_name, _uint_type, SemanticTree.basic_function_type.uigr, _bool_type); _uint_greq = make_binary_operator(compiler_string_consts.greq_name, _uint_type, SemanticTree.basic_function_type.uigreq, _bool_type); _uint_sm = make_binary_operator(compiler_string_consts.sm_name, _uint_type, SemanticTree.basic_function_type.uism, _bool_type); _uint_smeq = make_binary_operator(compiler_string_consts.smeq_name, _uint_type, SemanticTree.basic_function_type.uismeq, _bool_type); _uint_eq = make_binary_operator(compiler_string_consts.eq_name, _uint_type, SemanticTree.basic_function_type.uieq, _bool_type); _uint_noteq = make_binary_operator(compiler_string_consts.noteq_name, _uint_type, SemanticTree.basic_function_type.uinoteq, _bool_type); //Арифметические операции. /*_uint_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiadd, _uint_type); _uint_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uisub, _uint_type); _uint_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimul, _uint_type); _uint_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uidiv, _uint_type); _uint_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimod, _uint_type); //Операция / для byte. _uint_div = make_common_binary_operation(compiler_string_consts.div_name, _uint_type, _real_type, _real_type, SemanticTree.basic_function_type.ddiv, _real_type); //Логические опреции. _uint_and = make_common_binary_operation(compiler_string_consts.and_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiand, _uint_type); _uint_or = make_common_binary_operation(compiler_string_consts.or_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uior, _uint_type); _uint_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uixor, _uint_type); //add_funtion_to_type(compiler_string_consts.shl_name, _uint_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _uint_type, _int_shr); _uint_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishl,_uint_type); _uint_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishr, _uint_type);*/ _uint_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiadd, _int64_type); _uint_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uisub, _int64_type); _uint_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimul, _int64_type); _uint_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uidiv, _int64_type); _uint_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimod, _int64_type); //Операция / для byte. _uint_div = make_common_binary_operation(compiler_string_consts.div_name, _uint_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _uint_and = make_common_binary_operation(compiler_string_consts.and_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiand, _uint_type); _uint_or = make_common_binary_operation(compiler_string_consts.or_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uior, _uint_type); _uint_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uixor, _uint_type); //add_funtion_to_type(compiler_string_consts.shl_name, _uint_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _uint_type, _int_shr); _uint_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishl,_uint_type); _uint_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishr, _uint_type); /*make_function_comparison(_int_add, _uint_add, function_compare.greater); make_function_comparison(_int_sub, _uint_sub, function_compare.greater); make_function_comparison(_int_mul, _uint_mul, function_compare.greater); make_function_comparison(_int_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_int_mod, _uint_mod, function_compare.greater); make_function_comparison(_int_gr, _uint_gr, function_compare.greater); make_function_comparison(_int_greq, _uint_greq, function_compare.greater); make_function_comparison(_int_sm, _uint_sm, function_compare.greater); make_function_comparison(_int_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_int_eq, _uint_eq, function_compare.greater); make_function_comparison(_int_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_int_and, _uint_and, function_compare.greater); make_function_comparison(_int_or, _uint_or, function_compare.greater); make_function_comparison(_int_xor, _uint_xor, function_compare.greater);*/ make_function_comparison(_int_add, _uint_add, function_compare.less); make_function_comparison(_int_sub, _uint_sub, function_compare.less); make_function_comparison(_int_mul, _uint_mul, function_compare.less); make_function_comparison(_int_idiv, _uint_idiv, function_compare.less); make_function_comparison(_int_mod, _uint_mod, function_compare.less); make_function_comparison(_int_gr, _uint_gr, function_compare.less); make_function_comparison(_int_greq, _uint_greq, function_compare.less); make_function_comparison(_int_sm, _uint_sm, function_compare.less); make_function_comparison(_int_smeq, _uint_smeq, function_compare.less); make_function_comparison(_int_eq, _uint_eq, function_compare.less); make_function_comparison(_int_noteq, _uint_noteq, function_compare.less); make_function_comparison(_int_and, _uint_and, function_compare.less); make_function_comparison(_int_or, _uint_or, function_compare.less); make_function_comparison(_int_xor, _uint_xor, function_compare.less); //long type. //Assign. _long_assign = make_assign_operator(_int64_type, SemanticTree.basic_function_type.lassign); //Преобразования longов. _long_to_byte = make_type_conversion(_int64_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ltob); _long_to_sbyte = make_type_conversion(_int64_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ltosb); _long_to_short = make_type_conversion(_int64_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.ltos); _long_to_ushort = make_type_conversion(_int64_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ltous); _long_to_uint = make_type_conversion(_int64_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoui); _long_to_ulong = make_type_conversion(_int64_type, _uint64_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoul); _long_to_int = make_type_conversion(_int64_type, _integer_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoi); _long_to_char = make_type_conversion(_int64_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ltochar,false); _long_to_float = make_type_conversion(_int64_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ltof); _long_to_double = make_type_conversion(_int64_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ltod); //Унарные операции. _long_unmin = make_unary_operator(compiler_string_consts.minus_name, _int64_type, SemanticTree.basic_function_type.lunmin); _long_not = make_unary_operator(compiler_string_consts.not_name, _int64_type, SemanticTree.basic_function_type.lnot); make_unary_empty_operator(compiler_string_consts.plus_name, _int64_type, _int64_type); //Опрерации сравнения. _long_gr = make_binary_operator(compiler_string_consts.gr_name, _int64_type, SemanticTree.basic_function_type.lgr, _bool_type); _long_greq = make_binary_operator(compiler_string_consts.greq_name, _int64_type, SemanticTree.basic_function_type.lgreq, _bool_type); _long_sm = make_binary_operator(compiler_string_consts.sm_name, _int64_type, SemanticTree.basic_function_type.lsm, _bool_type); _long_smeq = make_binary_operator(compiler_string_consts.smeq_name, _int64_type, SemanticTree.basic_function_type.lsmeq, _bool_type); _long_eq = make_binary_operator(compiler_string_consts.eq_name, _int64_type, SemanticTree.basic_function_type.leq, _bool_type); _long_noteq = make_binary_operator(compiler_string_consts.noteq_name, _int64_type, SemanticTree.basic_function_type.lnoteq, _bool_type); //Арифметические операции. _long_add = make_common_binary_operation(compiler_string_consts.plus_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.ladd, _int64_type); _long_sub = make_common_binary_operation(compiler_string_consts.minus_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lsub, _int64_type); _long_mul = make_common_binary_operation(compiler_string_consts.mul_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lmul, _int64_type); _long_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.ldiv, _int64_type); _long_mod = make_common_binary_operation(compiler_string_consts.mod_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lmod, _int64_type); //Операция / для byte. _long_div = make_common_binary_operation(compiler_string_consts.div_name, _int64_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _long_and = make_common_binary_operation(compiler_string_consts.and_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.land, _int64_type); _long_or = make_common_binary_operation(compiler_string_consts.or_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lor, _int64_type); _long_xor = make_common_binary_operation(compiler_string_consts.xor_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lxor, _int64_type); //add_funtion_to_type(compiler_string_consts.shl_name, _long_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _long_type, _int_shr); _long_shl = make_common_binary_operation(compiler_string_consts.shl_name, _int64_type, _int64_type, _integer_type, SemanticTree.basic_function_type.lshl, _int64_type); _long_shr = make_common_binary_operation(compiler_string_consts.shr_name, _int64_type, _int64_type, _integer_type, SemanticTree.basic_function_type.lshr, _int64_type); make_function_comparison(_long_add, _uint_add, function_compare.greater); make_function_comparison(_long_sub, _uint_sub, function_compare.greater); make_function_comparison(_long_mul, _uint_mul, function_compare.greater); make_function_comparison(_long_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_long_mod, _uint_mod, function_compare.greater); make_function_comparison(_long_gr, _uint_gr, function_compare.greater); make_function_comparison(_long_greq, _uint_greq, function_compare.greater); make_function_comparison(_long_sm, _uint_sm, function_compare.greater); make_function_comparison(_long_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_long_eq, _uint_eq, function_compare.greater); make_function_comparison(_long_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_long_and, _uint_and, function_compare.greater); make_function_comparison(_long_or, _uint_or, function_compare.greater); make_function_comparison(_long_xor, _uint_xor, function_compare.greater); make_function_comparison(_long_add, _int_add, function_compare.greater); make_function_comparison(_long_sub, _int_sub, function_compare.greater); make_function_comparison(_long_mul, _int_mul, function_compare.greater); make_function_comparison(_long_idiv, _int_idiv, function_compare.greater); make_function_comparison(_long_mod, _int_mod, function_compare.greater); make_function_comparison(_long_gr, _int_gr, function_compare.greater); make_function_comparison(_long_greq, _int_greq, function_compare.greater); make_function_comparison(_long_sm, _int_sm, function_compare.greater); make_function_comparison(_long_smeq, _int_smeq, function_compare.greater); make_function_comparison(_long_eq, _int_eq, function_compare.greater); make_function_comparison(_long_noteq, _int_noteq, function_compare.greater); make_function_comparison(_long_and, _int_and, function_compare.greater); make_function_comparison(_long_or, _int_or, function_compare.greater); make_function_comparison(_long_xor, _int_xor, function_compare.greater); //ulong type. //Assign. _ulong_assign = make_assign_operator(_uint64_type, SemanticTree.basic_function_type.ulassign); //Преобразования ulongов. _ulong_to_byte = make_type_conversion(_uint64_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultob); _ulong_to_sbyte = make_type_conversion(_uint64_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultosb); _ulong_to_short = make_type_conversion(_uint64_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.ultos); _ulong_to_ushort = make_type_conversion(_uint64_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ultous); _ulong_to_uint = make_type_conversion(_uint64_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ultoui); _ulong_to_long = make_type_conversion(_uint64_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.ultol); _ulong_to_int = make_type_conversion(_uint64_type, _integer_type, type_compare.greater_type, SemanticTree.basic_function_type.ultoi); _ulong_to_char = make_type_conversion(_uint64_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ultochar,false); _ulong_to_float = make_type_conversion(_uint64_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ultof); _ulong_to_double = make_type_conversion(_uint64_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ultod); //Унарные операции. _ulong_unmin = make_unary_operator(compiler_string_consts.minus_name, _uint64_type, SemanticTree.basic_function_type.ulunmin, _uint64_type); _ulong_not = make_unary_operator(compiler_string_consts.not_name, _uint64_type, SemanticTree.basic_function_type.ulnot); make_unary_empty_operator(compiler_string_consts.plus_name, _uint64_type, _uint64_type); //Опрерации сравнения. _ulong_gr = make_binary_operator(compiler_string_consts.gr_name, _uint64_type, SemanticTree.basic_function_type.ulgr, _bool_type); _ulong_greq = make_binary_operator(compiler_string_consts.greq_name, _uint64_type, SemanticTree.basic_function_type.ulgreq, _bool_type); _ulong_sm = make_binary_operator(compiler_string_consts.sm_name, _uint64_type, SemanticTree.basic_function_type.ulsm, _bool_type); _ulong_smeq = make_binary_operator(compiler_string_consts.smeq_name, _uint64_type, SemanticTree.basic_function_type.ulsmeq, _bool_type); _ulong_eq = make_binary_operator(compiler_string_consts.eq_name, _uint64_type, SemanticTree.basic_function_type.uleq, _bool_type); _ulong_noteq = make_binary_operator(compiler_string_consts.noteq_name, _uint64_type, SemanticTree.basic_function_type.ulnoteq, _bool_type); //Арифметические операции. _ulong_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uladd, _uint64_type); _ulong_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulsub, _uint64_type); _ulong_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulmul, _uint64_type); _ulong_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uldiv, _uint64_type); _ulong_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulmod, _uint64_type); //Операция / для byte. _ulong_div = make_common_binary_operation(compiler_string_consts.div_name, _uint64_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _ulong_and = make_common_binary_operation(compiler_string_consts.and_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uland, _uint64_type); _ulong_or = make_common_binary_operation(compiler_string_consts.or_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulor, _uint64_type); _ulong_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulxor, _uint64_type); //add_funtion_to_type(compiler_string_consts.shl_name, _ulong_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _ulong_type, _int_shr); _ulong_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint64_type, _uint64_type, _integer_type, SemanticTree.basic_function_type.ulshl, _uint64_type); _ulong_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint64_type, _uint64_type, _integer_type, SemanticTree.basic_function_type.ulshr, _uint64_type); /*make_function_comparison(_long_add, _ulong_add, function_compare.greater); make_function_comparison(_long_sub, _ulong_sub, function_compare.greater); make_function_comparison(_long_mul, _ulong_mul, function_compare.greater); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.greater); make_function_comparison(_long_mod, _ulong_mod, function_compare.greater); make_function_comparison(_long_gr, _ulong_gr, function_compare.greater); make_function_comparison(_long_greq, _ulong_greq, function_compare.greater); make_function_comparison(_long_sm, _ulong_sm, function_compare.greater); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_long_eq, _ulong_eq, function_compare.greater); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_long_and, _ulong_and, function_compare.greater); make_function_comparison(_long_or, _ulong_or, function_compare.greater); make_function_comparison(_long_xor, _ulong_xor, function_compare.greater);*/ make_function_comparison(_long_add, _ulong_add, function_compare.less); make_function_comparison(_long_sub, _ulong_sub, function_compare.less); make_function_comparison(_long_mul, _ulong_mul, function_compare.less); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_long_mod, _ulong_mod, function_compare.less); make_function_comparison(_long_gr, _ulong_gr, function_compare.less); make_function_comparison(_long_greq, _ulong_greq, function_compare.less); make_function_comparison(_long_sm, _ulong_sm, function_compare.less); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_long_eq, _ulong_eq, function_compare.less); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_long_and, _ulong_and, function_compare.less); make_function_comparison(_long_or, _ulong_or, function_compare.less); make_function_comparison(_long_xor, _ulong_xor, function_compare.less); make_function_comparison(_int_add, _ulong_add, function_compare.less); make_function_comparison(_int_sub, _ulong_sub, function_compare.less); make_function_comparison(_int_mul, _ulong_mul, function_compare.less); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_int_mod, _ulong_mod, function_compare.less); make_function_comparison(_int_gr, _ulong_gr, function_compare.less); make_function_comparison(_int_greq, _ulong_greq, function_compare.less); make_function_comparison(_int_sm, _ulong_sm, function_compare.less); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_int_eq, _ulong_eq, function_compare.less); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_int_and, _ulong_and, function_compare.less); make_function_comparison(_int_or, _ulong_or, function_compare.less); make_function_comparison(_int_xor, _ulong_xor, function_compare.less); /*make_function_comparison(_int_add, _ulong_add, function_compare.greater); make_function_comparison(_int_sub, _ulong_sub, function_compare.greater); make_function_comparison(_int_mul, _ulong_mul, function_compare.greater); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.greater); make_function_comparison(_int_gr, _ulong_gr, function_compare.greater); make_function_comparison(_int_greq, _ulong_greq, function_compare.greater); make_function_comparison(_int_sm, _ulong_sm, function_compare.greater); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_int_eq, _ulong_eq, function_compare.greater); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_int_and, _ulong_and, function_compare.greater); make_function_comparison(_int_or, _ulong_or, function_compare.greater); make_function_comparison(_int_xor, _ulong_xor, function_compare.greater);*/ /*make_function_comparison(_long_add, _ulong_add, function_compare.non_comparable); make_function_comparison(_long_sub, _ulong_sub, function_compare.non_comparable); make_function_comparison(_long_mul, _ulong_mul, function_compare.non_comparable); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.non_comparable); make_function_comparison(_long_mod, _ulong_mod, function_compare.non_comparable); make_function_comparison(_long_gr, _ulong_gr, function_compare.greater); make_function_comparison(_long_greq, _ulong_greq, function_compare.greater); make_function_comparison(_long_sm, _ulong_sm, function_compare.greater); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_long_eq, _ulong_eq, function_compare.greater); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_long_and, _ulong_and, function_compare.greater); make_function_comparison(_long_or, _ulong_or, function_compare.greater); make_function_comparison(_long_xor, _ulong_xor, function_compare.greater); make_function_comparison(_int_add, _ulong_add, function_compare.non_comparable); make_function_comparison(_int_sub, _ulong_sub, function_compare.non_comparable); make_function_comparison(_int_mul, _ulong_mul, function_compare.non_comparable); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.non_comparable); make_function_comparison(_int_gr, _ulong_gr, function_compare.greater); make_function_comparison(_int_greq, _ulong_greq, function_compare.greater); make_function_comparison(_int_sm, _ulong_sm, function_compare.greater); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_int_eq, _ulong_eq, function_compare.greater); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_int_and, _ulong_and, function_compare.greater); make_function_comparison(_int_or, _ulong_or, function_compare.greater); make_function_comparison(_int_xor, _ulong_xor, function_compare.greater); make_common_binary_operation(compiler_string_consts.plus_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.uladd, _ulong_type); make_common_binary_operation(compiler_string_consts.minus_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulsub, _ulong_type); make_common_binary_operation(compiler_string_consts.mul_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulmul, _ulong_type); make_common_binary_operation(compiler_string_consts.idiv_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.uldiv, _ulong_type); make_common_binary_operation(compiler_string_consts.mod_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulmod, _ulong_type); make_common_binary_operation(compiler_string_consts.plus_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.uladd, _ulong_type); make_common_binary_operation(compiler_string_consts.minus_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulsub, _ulong_type); make_common_binary_operation(compiler_string_consts.mul_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulmul, _ulong_type); make_common_binary_operation(compiler_string_consts.idiv_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.uldiv, _ulong_type); make_common_binary_operation(compiler_string_consts.mod_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulmod, _ulong_type);*/ /*make_function_comparison(_ushort_add, _ulong_add, function_compare.less); make_function_comparison(_ushort_sub, _ulong_sub, function_compare.less); make_function_comparison(_ushort_mul, _ulong_mul, function_compare.less); make_function_comparison(_ushort_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_ushort_gr, _ulong_gr, function_compare.less); make_function_comparison(_ushort_greq, _ulong_greq, function_compare.less); make_function_comparison(_ushort_sm, _ulong_sm, function_compare.less); make_function_comparison(_ushort_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_ushort_eq, _ulong_eq, function_compare.less); make_function_comparison(_ushort_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_ushort_and, _ulong_and, function_compare.less); make_function_comparison(_ushort_or, _ulong_or, function_compare.less); make_function_comparison(_ushort_xor, _ulong_xor, function_compare.less); make_function_comparison(_byte_add, _ulong_add, function_compare.less); make_function_comparison(_byte_sub, _ulong_sub, function_compare.less); make_function_comparison(_byte_mul, _ulong_mul, function_compare.less); make_function_comparison(_byte_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_byte_gr, _ulong_gr, function_compare.less); make_function_comparison(_byte_greq, _ulong_greq, function_compare.less); make_function_comparison(_byte_sm, _ulong_sm, function_compare.less); make_function_comparison(_byte_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_byte_eq, _ulong_eq, function_compare.less); make_function_comparison(_byte_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_byte_and, _ulong_and, function_compare.less); make_function_comparison(_byte_or, _ulong_or, function_compare.less); make_function_comparison(_byte_xor, _ulong_xor, function_compare.less);*/ make_function_comparison(_ulong_add, _uint_add, function_compare.greater); make_function_comparison(_ulong_sub, _uint_sub, function_compare.greater); make_function_comparison(_ulong_mul, _uint_mul, function_compare.greater); make_function_comparison(_ulong_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_ulong_mod, _uint_mod, function_compare.greater); make_function_comparison(_ulong_gr, _uint_gr, function_compare.greater); make_function_comparison(_ulong_greq, _uint_greq, function_compare.greater); make_function_comparison(_ulong_sm, _uint_sm, function_compare.greater); make_function_comparison(_ulong_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_ulong_eq, _uint_eq, function_compare.greater); make_function_comparison(_ulong_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_ulong_and, _uint_and, function_compare.greater); make_function_comparison(_ulong_or, _uint_or, function_compare.greater); make_function_comparison(_ulong_xor, _uint_xor, function_compare.greater); //real type. //Assign. _real_assign=make_assign_operator(_double_type, SemanticTree.basic_function_type.dassign); /* _real_to_byte = make_type_conversion(_ulong_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultob); _real_to_sbyte = make_type_conversion(_ulong_type, _sbyte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultosb); _real_to_short = make_type_conversion(_ulong_type, _short_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultos); _real_to_ushort = make_type_conversion(_ulong_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ultous); _real_to_uint = make_type_conversion(_ulong_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ului); _real_to_long = make_type_conversion(_ulong_type, _long_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultol); _real_to_ulong = make_type_conversion(_ulong_type, _long_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultol); _real_to_int = make_type_conversion(_ulong_type, _integer_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultoi); _real_to_char = make_type_conversion(_ulong_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ultochar); */ _double_to_float = make_type_conversion(_double_type, _float_type, type_compare.greater_type, SemanticTree.basic_function_type.dtof); //Унарные операции. _real_unmin=make_unary_operator(compiler_string_consts.minus_name, _double_type, SemanticTree.basic_function_type.dunmin); //make_empty_operator(compiler_string_consts.plus_name, _real_type); make_unary_empty_operator(compiler_string_consts.plus_name, _double_type, _double_type); //Арифметические операции. _real_add=make_binary_operator(compiler_string_consts.plus_name, _double_type, SemanticTree.basic_function_type.dadd); _real_sub=make_binary_operator(compiler_string_consts.minus_name, _double_type, SemanticTree.basic_function_type.dsub); _real_mul=make_binary_operator(compiler_string_consts.mul_name, _double_type, SemanticTree.basic_function_type.dmul); _real_div=make_binary_operator(compiler_string_consts.div_name, _double_type, SemanticTree.basic_function_type.ddiv); //Опрерации сравнения. _real_gr=make_binary_operator(compiler_string_consts.gr_name, _double_type, SemanticTree.basic_function_type.dgr, _bool_type); _real_greq=make_binary_operator(compiler_string_consts.greq_name, _double_type, SemanticTree.basic_function_type.dgreq, _bool_type); _real_sm=make_binary_operator(compiler_string_consts.sm_name, _double_type, SemanticTree.basic_function_type.dsm, _bool_type); _real_smeq=make_binary_operator(compiler_string_consts.smeq_name, _double_type, SemanticTree.basic_function_type.dsmeq, _bool_type); _real_eq=make_binary_operator(compiler_string_consts.eq_name, _double_type, SemanticTree.basic_function_type.deq, _bool_type); _real_noteq=make_binary_operator(compiler_string_consts.noteq_name, _double_type, SemanticTree.basic_function_type.dnoteq, _bool_type); //float type _float_assign = make_assign_operator(_float_type, SemanticTree.basic_function_type.fassign); _float_to_double = make_type_conversion(_float_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ftod); //Унарные операции. _float_unmin = make_unary_operator(compiler_string_consts.minus_name, _float_type, SemanticTree.basic_function_type.funmin); //make_empty_operator(compiler_string_consts.plus_name, _real_type); make_unary_empty_operator(compiler_string_consts.plus_name, _float_type, _float_type); //Арифметические операции. _float_add = make_binary_operator(compiler_string_consts.plus_name, _float_type, SemanticTree.basic_function_type.fadd); _float_sub = make_binary_operator(compiler_string_consts.minus_name, _float_type, SemanticTree.basic_function_type.fsub); _float_mul = make_binary_operator(compiler_string_consts.mul_name, _float_type, SemanticTree.basic_function_type.fmul); _float_div = make_binary_operator(compiler_string_consts.div_name, _float_type, SemanticTree.basic_function_type.fdiv); //Опрерации сравнения. _float_gr = make_binary_operator(compiler_string_consts.gr_name, _float_type, SemanticTree.basic_function_type.fgr, _bool_type); _float_greq = make_binary_operator(compiler_string_consts.greq_name, _float_type, SemanticTree.basic_function_type.fgreq, _bool_type); _float_sm = make_binary_operator(compiler_string_consts.sm_name, _float_type, SemanticTree.basic_function_type.fsm, _bool_type); _float_smeq = make_binary_operator(compiler_string_consts.smeq_name, _float_type, SemanticTree.basic_function_type.fsmeq, _bool_type); _float_eq = make_binary_operator(compiler_string_consts.eq_name, _float_type, SemanticTree.basic_function_type.feq, _bool_type); _float_noteq = make_binary_operator(compiler_string_consts.noteq_name, _float_type, SemanticTree.basic_function_type.fnoteq, _bool_type); make_function_comparison(_real_add, _float_add, function_compare.greater); make_function_comparison(_real_sub, _float_sub, function_compare.greater); make_function_comparison(_real_mul, _float_mul, function_compare.greater); make_function_comparison(_real_gr, _float_gr, function_compare.greater); make_function_comparison(_real_greq, _float_greq, function_compare.greater); make_function_comparison(_real_sm, _float_sm, function_compare.greater); make_function_comparison(_real_smeq, _float_smeq, function_compare.greater); make_function_comparison(_real_eq, _float_eq, function_compare.greater); make_function_comparison(_real_noteq, _float_noteq, function_compare.greater); //char type. //Assign. _char_assign = make_assign_operator(_char_type, SemanticTree.basic_function_type.charassign); _char_to_byte = make_type_conversion(_char_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.chartob,false); _char_to_sbyte = make_type_conversion(_char_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.chartosb,false); _char_to_short = make_type_conversion(_char_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.chartos,false); _char_to_ushort = make_type_conversion(_char_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.chartous,false); _char_to_uint = make_type_conversion(_char_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.chartoui,false); _char_to_long = make_type_conversion(_char_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.chartol,false); _char_to_ulong = make_type_conversion(_char_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.chartoul,false); _char_to_int = make_type_conversion(_char_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.chartoi, false); _char_to_float = make_type_conversion(_char_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.chartof, false); _char_to_double = make_type_conversion(_char_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.chartod, false); //Опрерации сравнения. _char_gr = make_binary_operator(compiler_string_consts.gr_name, _char_type, SemanticTree.basic_function_type.chargr, _bool_type); _char_greq = make_binary_operator(compiler_string_consts.greq_name, _char_type, SemanticTree.basic_function_type.chargreq, _bool_type); _char_sm = make_binary_operator(compiler_string_consts.sm_name, _char_type, SemanticTree.basic_function_type.charsm, _bool_type); _char_smeq = make_binary_operator(compiler_string_consts.smeq_name, _char_type, SemanticTree.basic_function_type.charsmeq, _bool_type); _char_eq = make_binary_operator(compiler_string_consts.eq_name, _char_type, SemanticTree.basic_function_type.chareq, _bool_type); _char_noteq = make_binary_operator(compiler_string_consts.noteq_name, _char_type, SemanticTree.basic_function_type.charnoteq, _bool_type); //boolean type. //Assign. _bool_assign=make_assign_operator(_bool_type, SemanticTree.basic_function_type.boolassign); //Логические операции. //Унарные операции. _bool_not=make_unary_operator(compiler_string_consts.not_name, _bool_type, SemanticTree.basic_function_type.boolnot); //Логическме операции. _bool_and=make_binary_operator(compiler_string_consts.and_name, _bool_type, SemanticTree.basic_function_type.booland); _bool_or=make_binary_operator(compiler_string_consts.or_name, _bool_type, SemanticTree.basic_function_type.boolor); _bool_xor=make_binary_operator(compiler_string_consts.xor_name, _bool_type, SemanticTree.basic_function_type.boolxor); //Опрерации сравнения. _bool_gr=make_binary_operator(compiler_string_consts.gr_name, _bool_type, SemanticTree.basic_function_type.boolgr); _bool_greq=make_binary_operator(compiler_string_consts.greq_name, _bool_type, SemanticTree.basic_function_type.boolgreq); _bool_sm=make_binary_operator(compiler_string_consts.sm_name, _bool_type, SemanticTree.basic_function_type.boolsm); _bool_smeq=make_binary_operator(compiler_string_consts.smeq_name, _bool_type, SemanticTree.basic_function_type.boolsmeq); _bool_eq=make_binary_operator(compiler_string_consts.eq_name, _bool_type, SemanticTree.basic_function_type.booleq); _bool_noteq=make_binary_operator(compiler_string_consts.noteq_name, _bool_type, SemanticTree.basic_function_type.boolnoteq); _bool_to_int=make_type_conversion(_bool_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.booltoi, false); _bool_to_byte = make_type_conversion(_bool_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.booltob, false); _bool_to_sbyte = make_type_conversion(_bool_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.booltosb, false); _bool_to_short = make_type_conversion(_bool_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.booltos, false); _bool_to_ushort = make_type_conversion(_bool_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.booltous, false); _bool_to_uint = make_type_conversion(_bool_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.booltoui, false); _bool_to_long = make_type_conversion(_bool_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.booltol, false); _bool_to_ulong = make_type_conversion(_bool_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.booltoul, false); _obj_to_obj=make_unary_function(_object_type, SemanticTree.basic_function_type.objtoobj, _object_type); //TODO: Закончить с инициализацией строк. make_assign_operator(_string_type, SemanticTree.basic_function_type.objassign); _string_add = make_binary_compiled_operator(_string_type, compiler_string_consts.string_concat_method_name, compiler_string_consts.plus_name); _char_add = make_binary_compiled_operator(_string_type, _char_type, compiler_string_consts.string_concat_method_name, compiler_string_consts.plus_name, _char_type); init_reference_type(_object_type); //mark_byte_as_ordinal(); //mark_int_as_ordinal(); //mark_char_as_ordinal(); //+= -= *= /= _byte_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _byte_type); _byte_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _byte_type); _byte_multassign = make_binary_operator(compiler_string_consts.multassign_name, _byte_type); _byte_divassign = make_binary_operator(compiler_string_consts.divassign_name, _byte_type); _sbyte_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _sbyte_type); _sbyte_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _sbyte_type); _sbyte_multassign = make_binary_operator(compiler_string_consts.multassign_name, _sbyte_type); _sbyte_divassign = make_binary_operator(compiler_string_consts.divassign_name, _sbyte_type); _short_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _short_type); _short_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _short_type); _short_multassign = make_binary_operator(compiler_string_consts.multassign_name, _short_type); _short_divassign = make_binary_operator(compiler_string_consts.divassign_name, _short_type); _ushort_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _ushort_type); _ushort_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _ushort_type); _ushort_multassign = make_binary_operator(compiler_string_consts.multassign_name, _ushort_type); _ushort_divassign = make_binary_operator(compiler_string_consts.divassign_name, _ushort_type); _int_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _integer_type); _int_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _integer_type); _int_multassign = make_binary_operator(compiler_string_consts.multassign_name, _integer_type); _int_divassign = make_binary_operator(compiler_string_consts.divassign_name, _integer_type); _uint_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _uint_type); _uint_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _uint_type); _uint_multassign = make_binary_operator(compiler_string_consts.multassign_name, _uint_type); _uint_divassign = make_binary_operator(compiler_string_consts.divassign_name, _uint_type); _long_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _int64_type); _long_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _int64_type); _long_multassign = make_binary_operator(compiler_string_consts.multassign_name, _int64_type); _long_divassign = make_binary_operator(compiler_string_consts.divassign_name, _int64_type); _ulong_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _uint64_type); _ulong_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _uint64_type); _ulong_multassign = make_binary_operator(compiler_string_consts.multassign_name, _uint64_type); _ulong_divassign = make_binary_operator(compiler_string_consts.divassign_name, _uint64_type); _float_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _float_type); _float_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _float_type); _float_multassign = make_binary_operator(compiler_string_consts.multassign_name, _float_type); _float_divassign = make_binary_operator(compiler_string_consts.divassign_name, _float_type); _double_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _double_type); _double_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _double_type); _double_multassign = make_binary_operator(compiler_string_consts.multassign_name, _double_type); _double_divassign = make_binary_operator(compiler_string_consts.divassign_name, _double_type); mark_type_as_ordinal(_integer_type, SemanticTree.basic_function_type.iinc, SemanticTree.basic_function_type.idec, SemanticTree.basic_function_type.isinc, SemanticTree.basic_function_type.isdec, new int_const_node(int.MinValue,null), new int_const_node(int.MaxValue,null), create_emty_function(_integer_type,null), int_to_int); mark_type_as_ordinal(_uint_type, SemanticTree.basic_function_type.uiinc, SemanticTree.basic_function_type.uidec, SemanticTree.basic_function_type.uisinc, SemanticTree.basic_function_type.uisdec, new uint_const_node(uint.MinValue, null), new uint_const_node(uint.MaxValue, null), _uint_to_int, uint_to_int); mark_type_as_ordinal(_int64_type, SemanticTree.basic_function_type.linc, SemanticTree.basic_function_type.ldec, SemanticTree.basic_function_type.lsinc, SemanticTree.basic_function_type.lsdec, new long_const_node(long.MinValue, null), new long_const_node(long.MaxValue, null), _long_to_int, long_to_int); mark_type_as_ordinal(_uint64_type, SemanticTree.basic_function_type.ulinc, SemanticTree.basic_function_type.uldec, SemanticTree.basic_function_type.ulsinc, SemanticTree.basic_function_type.ulsdec, new ulong_const_node(ulong.MinValue, null), new ulong_const_node(ulong.MaxValue, null), _ulong_to_int, ulong_to_int); mark_type_as_ordinal(_byte_type, SemanticTree.basic_function_type.binc, SemanticTree.basic_function_type.bdec, SemanticTree.basic_function_type.bsinc, SemanticTree.basic_function_type.bsdec, new byte_const_node(byte.MinValue, null), new byte_const_node(byte.MaxValue, null), _byte_to_int, byte_to_int); mark_type_as_ordinal(_sbyte_type, SemanticTree.basic_function_type.sbinc, SemanticTree.basic_function_type.sbdec, SemanticTree.basic_function_type.sbsinc, SemanticTree.basic_function_type.sbsdec, new sbyte_const_node(sbyte.MinValue, null), new sbyte_const_node(sbyte.MaxValue, null), _sbyte_to_int, sbyte_to_int); mark_type_as_ordinal(_short_type, SemanticTree.basic_function_type.sinc, SemanticTree.basic_function_type.sdec, SemanticTree.basic_function_type.ssinc, SemanticTree.basic_function_type.ssdec, new short_const_node(short.MinValue, null), new short_const_node(short.MaxValue, null), _short_to_int, short_to_int); mark_type_as_ordinal(_ushort_type, SemanticTree.basic_function_type.usinc, SemanticTree.basic_function_type.usdec, SemanticTree.basic_function_type.ussinc, SemanticTree.basic_function_type.ussdec, new ushort_const_node(ushort.MinValue, null), new ushort_const_node(ushort.MaxValue, null), _ushort_to_int, ushort_to_int); mark_type_as_ordinal(_char_type, SemanticTree.basic_function_type.cinc, SemanticTree.basic_function_type.cdec, SemanticTree.basic_function_type.csinc, SemanticTree.basic_function_type.csdec, new char_const_node(char.MinValue, null), new char_const_node(char.MaxValue, null), _char_to_int, char_to_int); mark_type_as_ordinal(_bool_type, SemanticTree.basic_function_type.boolinc, SemanticTree.basic_function_type.booldec, SemanticTree.basic_function_type.boolsinc, SemanticTree.basic_function_type.boolsdec, new bool_const_node(false, null), new bool_const_node(true, null), _bool_to_int, bool_to_int); _empty_string = new string_const_node(string.Empty, null); _dllimport_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.DllImportAttribute)); _flags_attribute_type = compiled_type_node.get_type_node(typeof(System.FlagsAttribute)); _usage_attribute_type = compiled_type_node.get_type_node(typeof(AttributeUsageAttribute)); _comimport_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.ComImportAttribute)); _attribute_type = compiled_type_node.get_type_node(typeof(Attribute)); _field_offset_attribute_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.FieldOffsetAttribute)); _struct_layout_attribute_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.StructLayoutAttribute)); string[] s=new string[0]; _array_of_string = compiled_type_node.get_type_node(s.GetType()); make_type_conversion_use_ctor(_float_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_double_type, _decimal_type, type_compare.less_type, true); //это преобразование есть явно в decimal //make_type_conversion_use_ctor(_integer_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_uint_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_uint64_type, _decimal_type, type_compare.less_type, true); writable_in_typed_files_types.Clear(); writable_in_typed_files_types.Add(_bool_type, _bool_type); writable_in_typed_files_types.Add(_byte_type, _byte_type); writable_in_typed_files_types.Add(_sbyte_type, _sbyte_type); writable_in_typed_files_types.Add(_short_type, _short_type); writable_in_typed_files_types.Add(_ushort_type, _ushort_type); writable_in_typed_files_types.Add(_integer_type, _integer_type); writable_in_typed_files_types.Add(_uint_type, _uint_type); writable_in_typed_files_types.Add(_int64_type, _int64_type); writable_in_typed_files_types.Add(_uint64_type, _uint64_type); writable_in_typed_files_types.Add(_double_type, _double_type); writable_in_typed_files_types.Add(_char_type, _char_type); writable_in_typed_files_types.Add(_float_type, _float_type); foreach (type_node tn in wait_add_ref_list) init_reference_type(tn); wait_add_ref_list.Clear(); _exception_base_type = compiled_type_node.get_type_node(typeof(System.Exception), symtab); _exception_base_type.SetName(compiler_string_consts.base_exception_class_name); }
/*public static void RestoreStandartNames() { _bool_type.SetName(compiler_string_consts.bool_type_name); _byte_type.SetName(compiler_string_consts.byte_type_name); _sbyte_type.SetName(compiler_string_consts.sbyte_type_name); _short_type.SetName(compiler_string_consts.short_type_name); _ushort_type.SetName(compiler_string_consts.ushort_type_name); _integer_type.SetName(compiler_string_consts.integer_type_name); ; _uint_type.SetName(compiler_string_consts.uint_type_name); _int64_type.SetName(compiler_string_consts.long_type_name); _uint64_type.SetName(compiler_string_consts.ulong_type_name); _double_type.SetName(compiler_string_consts.real_type_name); _float_type.SetName(compiler_string_consts.float_type_name); _char_type.SetName(compiler_string_consts.char_type_name); _string_type.SetName(compiler_string_consts.string_type_name); _object_type.SetName(compiler_string_consts.object_type_name); _exception_base_type.SetName(compiler_string_consts.base_exception_class_name); _array_base_type.SetName(compiler_string_consts.base_array_type_name); _delegate_base_type.SetName(compiler_string_consts.base_delegate_type_name); _enum_base_type.SetName(compiler_string_consts.base_enum_class_name); _pointer_type.SetName(compiler_string_consts.pointer_type_name); _void_type.SetName(compiler_string_consts.void_class_name); }*/ private static void make_methods() { _empty_method = new basic_function_node(SemanticTree.basic_function_type.none, null, true); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, null, SemanticTree.parameter_type.value, _empty_method); _empty_method.parameters.AddElement(bp); _empty_method.compile_time_executor = delegated_empty_method; //(ssyy) Убрать подмену параметров?! Type arr_type = typeof(System.Array); System.Reflection.MethodInfo resize_func_mi = arr_type.GetMethod("Resize"); _resize_func = compiled_function_node.get_compiled_method(resize_func_mi); _resize_func.parameters.clear(); common_parameter par0 = new common_parameter("Array", _object_type, SemanticTree.parameter_type.value, null, concrete_parameter_type.cpt_none, null, null); common_parameter par1 = new common_parameter("Length", _integer_type, SemanticTree.parameter_type.value, null, concrete_parameter_type.cpt_none, null, null); _resize_func.parameters.AddElement(par0); _resize_func.parameters.AddElement(par1); resize_func.compile_time_executor = set_length_compile_time_executor; }
public static function_node get_empty_conversion(type_node from_type, type_node to_type, bool with_compile_time_executor) { basic_function_node bfn = null; /*if (to_type == SystemLibrary.SystemLibrary.object_type && from_type.is_value_type) { bfn = new basic_function_node(SemanticTree.basic_function_type.objtoobj, from_type, false); with_compile_time_executor = false; } else*/ bfn = new basic_function_node(SemanticTree.basic_function_type.none, to_type, false); bfn.parameters.AddElement(new basic_parameter("expr", from_type, SemanticTree.parameter_type.value, bfn)); if (with_compile_time_executor) bfn.compile_time_executor = SystemLibrary.SystemLibrary.delegated_empty_method; return bfn; }
//TODO: Вообще нужен-ли этот набор методов (create_..._function_call)? private basic_function_call create_basic_function_call(basic_function_node bfn,SemanticTree.ILocation loc,params expression_node[] exprs) { basic_function_call bfc=new basic_function_call(bfn,loc_to_loc(loc)); bfc.parameters.AddRange(exprs); return bfc; }
public SymbolInfo(basic_function_node value) { //_name_information_type=name_information_type.nit_basic_function; _sym_info=value; _access_level=access_level.al_public; _symbol_kind=get_function_kind(value); }
private static void init_temp_methods_and_consts(common_namespace_node system_namespace,SymbolTable.Scope where_add, initialization_properties initialization_properties,location system_unit_location) { //SymbolTable.Scope sc = system_namespace.scope; SymbolTable.Scope sc = where_add; namespace_constant_definition _true_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SystemLibrary.true_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_true_constant_definition); namespace_constant_definition _false_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SystemLibrary.false_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_false_constant_definition); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_true_constant_definition)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_false_constant_definition)); //TODO: Сделано по быстрому. Переделать. Можно просто один раз сериализовать модуль system и не инициализировать его всякий раз подобным образом. Неплохо-бы использовать NetHelper.GetMethod. Type tp = typeof(Console); compiled_function_node cfn; System.Type[] arr = new System.Type[1]; System.Reflection.MethodInfo mi; //TODO: Сделать узел или базовый метод создания и удаления объекта. common_namespace_function_node cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.New; _NewProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _NewProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _NewProcedureDecl = cnfn; sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.dispose_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); _DisposeProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _DisposeProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _DisposeProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _DisposeProcedureDecl = cnfn; cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.Dispose; sc.AddSymbol(TreeConverter.compiler_string_consts.dispose_procedure_name, _DisposeProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_array_procedure_name, compiled_type_node.get_type_node(typeof(Array)), null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("t", compiled_type_node.get_type_node(typeof(Type)), SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.parameters.AddElement(new common_parameter("n", SystemLibrary.integer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.NewArray; _NewArrayProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewArrayProcedureDecl = cnfn; //sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); basic_function_node break_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true); break_procedure.compile_time_executor = initialization_properties.break_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(break_procedure)); basic_function_node continue_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true); continue_procedure.compile_time_executor = initialization_properties.continue_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(continue_procedure)); basic_function_node exit_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true); exit_procedure.compile_time_executor = initialization_properties.exit_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(exit_procedure)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.resize_func, PascalABCCompiler.TreeConverter.access_level.al_public, PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function)); }
public basic_parameter(string name,type_node type,SemanticTree.parameter_type par_type, basic_function_node cont_function) : base(name,type) { _cont_function=cont_function; _par_type=par_type; }