2020-02-20 23:40:10 +00:00
|
|
|
#define INTERNAL_TYPES_NUM 17
|
2020-02-15 20:01:48 +00:00
|
|
|
|
|
|
|
class CInternalType
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
U8 type,size,name[8];
|
2020-02-15 20:01:48 +00:00
|
|
|
} internal_types_table[INTERNAL_TYPES_NUM]={
|
2020-02-23 06:44:01 +00:00
|
|
|
{RT_I0, 0, "I0i"},
|
|
|
|
{RT_I0, 0, "I0"},
|
|
|
|
{RT_U0, 0, "U0i"},
|
|
|
|
{RT_U0, 0, "U0"},
|
|
|
|
{RT_I8, 1, "I8i"},
|
|
|
|
{RT_I8, 1, "I8"},
|
|
|
|
{RT_I8, 1, "Bool"},
|
|
|
|
{RT_U8, 1, "U8i"},
|
|
|
|
{RT_U8, 1, "U8"},
|
|
|
|
{RT_I16, 2, "I16i"},
|
|
|
|
{RT_U16, 2, "U16i"},
|
|
|
|
{RT_I32, 4, "I32i"},
|
|
|
|
{RT_U32, 4, "U32i"},
|
|
|
|
{RT_I64, 8, "I64i"},
|
|
|
|
{RT_U64, 8, "U64i"},
|
|
|
|
{RT_F64, 8, "F64i"},
|
|
|
|
{RT_F64, 8, "F64"},
|
2020-02-15 20:01:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CIntermediateStruct intermediate_code_table[IC_ICS_NUM]={
|
2020-02-20 23:40:10 +00:00
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP1"},
|
|
|
|
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END_EXP"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP2"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LABEL"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_START"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END2"},
|
|
|
|
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL2"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_I64"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_F64"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"STR_CONST"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ABS_ADDR"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR_IMPORT"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLBL"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SIZEOF"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"TYPE"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"GET_LABEL"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RBP"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"REG"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"FS"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_FS"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GS"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_GS"},
|
|
|
|
{IS_0_ARG,1,IST_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
|
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHL_CONST"},
|
|
|
|
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHR_CONST"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"POWER"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"MUL"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"DIV"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"MOD"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ADD"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SUB"},
|
|
|
|
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"ADD_CONST"},
|
|
|
|
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SUB_CONST"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"EQU_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"NOT_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER"},
|
|
|
|
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS_EQU"},
|
|
|
|
{IS_0_ARG,1,IST_NULL,FALSE,FALS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|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SWITCH"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOBOUND_SWITCH"},
|
|
|
|
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP"},
|
|
|
|
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP1"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ENTER"},
|
|
|
|
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"PUSH_REGS"},
|
|
|
|
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"POP_REGS"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LEAVE"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RET"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT2"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_IMPORT"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_EXTERN"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"ASM"},
|
|
|
|
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PUSH"},
|
|
|
|
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"POP"},
|
|
|
|
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CLFLUSH"},
|
|
|
|
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"INVLPG"},
|
|
|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BR_GREATER_EQU"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2EQU_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2NOT_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER_EQU"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER"},
|
|
|
|
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS_EQU"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_NOT_ZERO"},
|
|
|
|
{IS_1_ARG,0,IST_DEREF,FALSE,TRUE,0,0,0,"BR_MM_ZERO"},
|
|
|
|
{IS_1_ARG,0,IST_DEREF,FALSE,TRUE,0,0,0,"BR_MM_NOT_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_NOT_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_NOT_ZERO"},
|
|
|
|
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BT"},
|
|
|
|
{IS_2_ARG,0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,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRU64"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQR"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ABS"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQRT"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SIN"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"COS"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"TAN"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"},
|
|
|
|
{IS_1_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"POPCNT"},
|
2020-02-15 20:01:48 +00:00
|
|
|
};
|
|
|
|
|
2020-02-15 23:38:06 +00:00
|
|
|
U0 CompLoadDefines()
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
DefineListLoad("ST_RAW_TYPES",
|
2020-03-01 01:59:50 +00:00
|
|
|
" \0"
|
|
|
|
" \0"
|
2020-02-23 06:44:01 +00:00
|
|
|
"I0\0"
|
|
|
|
"U0\0"
|
|
|
|
"I8\0"
|
|
|
|
"U8\0"
|
|
|
|
"I16\0"
|
|
|
|
"U16\0"
|
|
|
|
"I32\0"
|
|
|
|
"U32\0"
|
|
|
|
"I64\0"
|
|
|
|
"U64\0"
|
|
|
|
"F32\0"
|
|
|
|
"UF32\0"
|
|
|
|
"F64\0"
|
|
|
|
"UF64\0");
|
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
DefineListLoad("ST_NATURAL_TYPES",
|
2020-02-23 06:44:01 +00:00
|
|
|
"I8\0"
|
|
|
|
"U8\0"
|
|
|
|
"I16\0"
|
|
|
|
"U16\0"
|
|
|
|
"I32\0"
|
|
|
|
"U32\0"
|
|
|
|
"I64\0"
|
|
|
|
"U64\0"
|
|
|
|
"F64\0"
|
|
|
|
"String\0");
|
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
DefineListLoad("ST_INT_SIZE_TYPES",
|
2020-02-23 06:44:01 +00:00
|
|
|
"I8\0"
|
|
|
|
"U8\0"
|
|
|
|
"I16\0"
|
|
|
|
"U16\0"
|
|
|
|
"I32\0"
|
|
|
|
"U32\0"
|
|
|
|
"I64\0"
|
|
|
|
"U64\0");
|
|
|
|
|
|
|
|
DefineListLoad("ST_TY_TYPES",
|
|
|
|
"NULL\0"
|
|
|
|
"STACK\0"
|
|
|
|
"IMM\0"
|
|
|
|
"REG\0"
|
|
|
|
"DISP\0"
|
|
|
|
"SIB\0"
|
|
|
|
"RIP\0");
|
|
|
|
|
|
|
|
DefineListLoad("ST_U8_REGS",
|
|
|
|
"AL\0"
|
|
|
|
"CL\0"
|
|
|
|
"DL\0"
|
|
|
|
"BL\0"
|
|
|
|
"AH\0"
|
|
|
|
"CH\0"
|
|
|
|
"DH\0"
|
|
|
|
"BH\0"
|
|
|
|
"R8u8\0"
|
|
|
|
"R9u8\0"
|
|
|
|
"R10u8\0"
|
|
|
|
"R11u8\0"
|
|
|
|
"R12u8\0"
|
|
|
|
"R13u8\0"
|
|
|
|
"R14u8\0"
|
|
|
|
"R15u8\0");
|
|
|
|
|
|
|
|
DefineListLoad("ST_U8_REX_REGS",
|
|
|
|
"AL\0"
|
|
|
|
"CL\0"
|
|
|
|
"DL\0"
|
|
|
|
"BL\0"
|
|
|
|
"RSPu8\0"
|
|
|
|
"RBPu8\0"
|
|
|
|
"RSIu8\0"
|
|
|
|
"RDIu8\0"
|
|
|
|
"R8u8\0"
|
|
|
|
"R9u8\0"
|
|
|
|
"R10u8\0"
|
|
|
|
"R11u8\0"
|
|
|
|
"R12u8\0"
|
|
|
|
"R13u8\0"
|
|
|
|
"R14u8\0"
|
|
|
|
"R15u8\0");
|
|
|
|
|
|
|
|
DefineListL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|
|
|
"STI\0"
|
|
|
|
"MM\0"
|
|
|
|
"MM32\0"
|
|
|
|
"MM64\0"
|
|
|
|
"XMM\0"
|
2020-02-28 05:58:31 +00:00
|
|
|
"XMM0\0"
|
2020-02-23 06:44:01 +00:00
|
|
|
"XMM64\0"
|
2020-02-28 05:58:31 +00:00
|
|
|
"XMM128\0");
|
2020-02-23 06:44:01 +00:00
|
|
|
|
|
|
|
DefineListLoad("ST_SEG_REGS",
|
|
|
|
"ES\0"
|
|
|
|
"CS\0"
|
|
|
|
"SS\0"
|
|
|
|
"DS\0"
|
|
|
|
"FS\0"
|
|
|
|
"GS\0");
|
|
|
|
|
|
|
|
DefineListLoad("ST_FSTACK_REGS",
|
|
|
|
"ST0\0"
|
|
|
|
"ST1\0"
|
|
|
|
"ST2\0"
|
|
|
|
"ST3\0"
|
|
|
|
"ST4\0"
|
|
|
|
"ST5\0"
|
|
|
|
"ST6\0"
|
|
|
|
"ST7\0");
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 23:38:06 +00:00
|
|
|
U0 CompFillTables()
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
I64 i;
|
|
|
|
U32 *d;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.to_reg_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
|
|
|
|
comp.num_reg_vars=0;
|
|
|
|
comp.reg_vars_mask=REGG_LOCAL_VARS;
|
2020-02-20 23:40:10 +00:00
|
|
|
for (i=0;i<REG_REGS_NUM;i++)
|
2020-02-28 05:58:31 +00:00
|
|
|
if (Bt(&comp.reg_vars_mask,i))
|
|
|
|
comp.to_reg_vars_map[comp.num_reg_vars++]=i;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.non_ptr_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
|
|
|
|
comp.num_non_ptr_vars=0;
|
|
|
|
comp.non_ptr_vars_mask=REGG_LOCAL_NON_PTR_VARS;
|
2020-02-20 23:40:10 +00:00
|
|
|
for (i=0;i<REG_REGS_NUM;i++)
|
2020-02-28 05:58:31 +00:00
|
|
|
if (Bt(&comp.non_ptr_vars_mask,i))
|
|
|
|
comp.non_ptr_vars_map[comp.num_non_ptr_vars++]=i;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.dual_U16_tokens1=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
2020-02-20 23:40:10 +00:00
|
|
|
d['!']=TK_NOT_EQU<<16+'=';
|
|
|
|
d['&']=TK_AND_AND<<16+'&';
|
|
|
|
d['*']=TK_MUL_EQU<<16+'=';
|
|
|
|
d['+']=TK_PLUS_PLUS<<16+'+';
|
|
|
|
d['-']=TK_DEREFERENCE<<16+'>';
|
|
|
|
d['/']='*';
|
|
|
|
d[':']=TK_DBL_COLON<<16+':';
|
|
|
|
d['<']=TK_LESS_EQU<<16+'=';
|
|
|
|
d['=']=TK_EQU_EQU<<16+'=';
|
|
|
|
d['>']=TK_GREATER_EQU<<16+'=';
|
|
|
|
d['^']=TK_XOR_EQU<<16+'=';
|
|
|
|
d['|']=TK_OR_OR<<16+'|';
|
|
|
|
d['%']=TK_MOD_EQU<<16+'=';
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.dual_U16_tokens2=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
2020-02-20 23:40:10 +00:00
|
|
|
d['&']=TK_AND_EQU<<16+'=';
|
|
|
|
d['+']=TK_ADD_EQU<<16+'=';
|
|
|
|
d['-']=TK_MINUS_MINUS<<16+'-';
|
|
|
|
d['/']='/';
|
|
|
|
d['<']=TK_SHL<<16+'<';
|
|
|
|
d['>']=TK_SHR<<16+'>';
|
|
|
|
d['^']=TK_XOR_XOR<<16+'^';
|
|
|
|
d['|']=TK_OR_EQU<<16+'=';
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.dual_U16_tokens3=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
2020-02-20 23:40:10 +00:00
|
|
|
d['-']=TK_SUB_EQU<<16+'=';
|
|
|
|
d['/']=TK_DIV_EQU<<16+'=';
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-28 05:58:31 +00:00
|
|
|
comp.binary_ops=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
2020-02-20 23:40:10 +00:00
|
|
|
d['`'] =(PREC_EXP+ASSOCF_RIGHT)<<16+IC_POWER;
|
|
|
|
d[TK_SHL]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHL;
|
|
|
|
d[TK_SHR]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHR;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['*']=PREC_MUL<<16+IC_MUL;
|
|
|
|
d['/']=(PREC_MUL+ASSOCF_LEFT)<<16+IC_DIV;
|
|
|
|
d['%']=(PREC_MUL+ASSOCF_LEFT)<<16+IC_MOD;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['&']=PREC_AND<<16+IC_AND;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['^']=PREC_XOR<<16+IC_XOR;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['|']=PREC_OR<<16+IC_OR;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['+']=PREC_ADD<<16+IC_ADD;
|
|
|
|
d['-']=(PREC_ADD+ASSOCF_LEFT)<<16+IC_SUB;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['<'] =PREC_CMP<<16+IC_LESS;
|
|
|
|
d['>'] =PREC_CMP<<16+IC_GREATER;
|
|
|
|
d[TK_LESS_EQU] =PREC_CMP<<16+IC_LESS_EQU;
|
|
|
|
d[TK_GREATER_EQU] =PREC_CMP<<16+IC_GREATER_EQU;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d[TK_EQU_EQU] =PREC_CMP2<<16+IC_EQU_EQU;
|
|
|
|
d[TK_NOT_EQU] =PREC_CMP2<<16+IC_NOT_EQU;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d[TK_AND_AND] =PREC_AND_AND<<16+IC_AND_AND;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d[TK_XOR_XOR] =PREC_XOR_XOR<<16+IC_XOR_XOR;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d[TK_OR_OR] =PREC_OR_OR<<16+IC_OR_OR;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
d['='] =(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_ASSIGN;
|
|
|
|
d[TK_SHL_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SHL_EQU;
|
|
|
|
d[TK_SHR_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SHR_EQU;
|
|
|
|
d[TK_MUL_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_MUL_EQU;
|
|
|
|
d[TK_DIV_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_DIV_EQU;
|
|
|
|
d[TK_MOD_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_MOD_EQU;
|
|
|
|
d[TK_AND_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_AND_EQU;
|
|
|
|
d[TK_OR_EQU] =(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_OR_EQU;
|
|
|
|
d[TK_XOR_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_XOR_EQU;
|
|
|
|
d[TK_ADD_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_ADD_EQU;
|
|
|
|
d[TK_SUB_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SUB_EQU;
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|