@@ -10,7 +10,7 @@ class Translator
1010 Translator ();
1111 ~Translator ();
1212protected:
13- #define SIZE_serviceWord 11
13+ #define SIZE_serviceWord 12
1414#define SIZE_separators 9
1515#define SIZE_operation 20
1616#define SIZE_columns 2
@@ -26,7 +26,8 @@ class Translator
2626 {" #include" ," W8" },
2727 {" malloc" ," W9" },
2828 {" sizeof" ," W10" },
29- {" return" ," W11" }
29+ {" return" ," W11" },
30+ {" for" ," W12" }
3031 };
3132 std::string const separators[SIZE_separators][SIZE_columns] =
3233 {
@@ -67,6 +68,29 @@ class Translator
6768 std::map<std::string, std::string> identifier;
6869 std::map<std::string, std::string> numberConst;
6970 std::map<std::string, std::string> symbolsConst;
71+ std::map<std::string, int > priority =
72+ {
73+ // if ( [ ÀÝÌ Ô while for
74+ {" W5" ,0 }, { " R3" ,0 },{ " R1" ,0 },{ " ÀÝÌ" ,0 },{ " Ô" ,0 },{" W7" , 0 },{" W12" , 0 },
75+ // { , ; ) ] else
76+ {" R5" , 1 },{ " R8" ,1 },{ " R7" ,1 },{ " R3" ,1 },{" R2" , 1 },{" W6" , 1 },
77+ // =
78+ {" O5" , 2 },
79+ // |
80+ {" |" , 3 },
81+ // &
82+ {" &" , 4 },
83+ // not
84+ {" not" , 5 },
85+ // < > <= >= == != && ||
86+ {" O8" , 6 },{" O7" , 6 },{" O12" , 6 },{" O11" , 6 },{" O9" , 6 },{" O10" , 6 },{" O17" , 6 },{" O18" , 6 },
87+ // + - ++ -- -= += *= /=
88+ {" O1" , 7 },{" O2" , 7 },{" O20" , 7 },{" O19" , 7 },{" O15" , 7 },{" O14" , 7 },{" O16" , 7 },{" O13" , 7 },
89+ // * / %
90+ {" O3" , 8 },{" O4" , 8 },{" O6" , 8 },
91+ // : }
92+ {" :" , 9 },{" R6" , 9 },{" W11" , 9 }
93+ };
7094};
7195
7296#endif
0 commit comments