1011 void *visit(program_declaration_c *symbol) { |
1011 void *visit(program_declaration_c *symbol) { |
1012 s4o.print("PROGRAM "); |
1012 s4o.print("PROGRAM "); |
1013 symbol->program_type_name->accept(*this); |
1013 symbol->program_type_name->accept(*this); |
1014 s4o.print("\n"); |
1014 s4o.print("\n"); |
1015 s4o.indent_right(); |
1015 s4o.indent_right(); |
1016 s4o.print(s4o.indent_spaces); |
|
1017 symbol->var_declarations->accept(*this); |
1016 symbol->var_declarations->accept(*this); |
1018 s4o.print("\n"); |
1017 s4o.print("\n"); |
1019 symbol->function_block_body->accept(*this); |
1018 symbol->function_block_body->accept(*this); |
1020 s4o.indent_left(); |
1019 s4o.indent_left(); |
1021 s4o.print("\n"); |
|
1022 s4o.print("END_PROGRAM\n\n\n"); |
1020 s4o.print("END_PROGRAM\n\n\n"); |
1023 return NULL; |
1021 return NULL; |
1024 } |
1022 } |
1025 |
1023 |
1026 /***********************************/ |
1024 /***********************************/ |
1027 /* B 1.6 Sequential Function Chart */ |
1025 /* B 1.6 Sequential Function Chart */ |
1028 /***********************************/ |
1026 /***********************************/ |
1029 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1030 |
|
1031 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1032 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1033 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1034 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1035 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1036 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1037 |
|
1038 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
1027 |
1043 /* sequential_function_chart {sfc_network} */ |
1028 /* sequential_function_chart {sfc_network} */ |
1044 void *visit(sequential_function_chart_c *symbol) { |
1029 void *visit(sequential_function_chart_c *symbol) { |
1045 print_list(symbol, "", "\n\n", ""); |
1030 print_list(symbol, "", "\n", ""); |
1046 return NULL; |
1031 return NULL; |
1047 } |
1032 } |
1048 |
1033 |
1049 /* sfc_network {step | transition | action} */ |
1034 /* sfc_network {step | transition | action} */ |
1050 void *visit(sfc_network_c *symbol) { |
1035 void *visit(sfc_network_c *symbol) { |
1051 print_list(symbol, "", "\n\n", ""); |
1036 print_list(symbol, "", "\n", ""); |
1052 return NULL; |
1037 return NULL; |
1053 } |
1038 } |
1054 |
1039 |
1055 /* INITIAL_STEP step_name ':' [action_association_list] END_STEP */ |
1040 /* INITIAL_STEP step_name ':' [action_association_list] END_STEP */ |
1056 void *visit(initial_step_c *symbol) { |
1041 void *visit(initial_step_c *symbol) { |
1057 s4o.print(s4o.indent_spaces); |
1042 s4o.print(s4o.indent_spaces); |
1058 s4o.print("INITIAL_STEP "); |
1043 s4o.print("INITIAL_STEP "); |
1059 symbol->step_name->accept(*this); |
1044 symbol->step_name->accept(*this); |
1060 s4o.print(" :\n"); |
1045 s4o.print(":\n"); |
1061 s4o.indent_right(); |
1046 s4o.indent_right(); |
1062 symbol->action_association_list->accept(*this); |
1047 symbol->action_association_list->accept(*this); |
1063 s4o.print("\n"); |
1048 s4o.print("\n"); |
1064 s4o.indent_left(); |
1049 s4o.indent_left(); |
1065 s4o.print(s4o.indent_spaces); |
1050 s4o.print(s4o.indent_spaces); |
1066 s4o.print("END_STEP "); |
1051 s4o.print("END_STEP\n"); |
1067 return NULL; |
1052 return NULL; |
1068 } |
1053 } |
1069 |
1054 |
1070 /* STEP step_name ':' [action_association_list] END_STEP */ |
1055 /* STEP step_name ':' [action_association_list] END_STEP */ |
1071 void *visit(step_c *symbol) { |
1056 void *visit(step_c *symbol) { |
1072 s4o.print(s4o.indent_spaces); |
1057 s4o.print(s4o.indent_spaces); |
1073 s4o.print("STEP "); |
1058 s4o.print("STEP "); |
1074 symbol->step_name->accept(*this); |
1059 symbol->step_name->accept(*this); |
1075 s4o.print(" :\n"); |
1060 s4o.print(":\n"); |
1076 s4o.indent_right(); |
1061 s4o.indent_right(); |
1077 symbol->action_association_list->accept(*this); |
1062 symbol->action_association_list->accept(*this); |
1078 s4o.print("\n"); |
1063 s4o.print("\n"); |
1079 s4o.indent_left(); |
1064 s4o.indent_left(); |
1080 s4o.print(s4o.indent_spaces); |
1065 s4o.print(s4o.indent_spaces); |
1081 s4o.print("END_STEP "); |
1066 s4o.print("END_STEP\n"); |
1082 return NULL; |
1067 return NULL; |
1083 } |
1068 } |
1084 |
1069 |
1085 /* action_association_list {action_association} */ |
1070 /* action_association_list {action_association} */ |
1086 void *visit(action_association_list_c *symbol) { |
1071 void *visit(action_association_list_c *symbol) { |
1088 return NULL; |
1073 return NULL; |
1089 } |
1074 } |
1090 |
1075 |
1091 /* action_name '(' [action_qualifier] [indicator_name_list] ')' */ |
1076 /* action_name '(' [action_qualifier] [indicator_name_list] ')' */ |
1092 void *visit(action_association_c *symbol) { |
1077 void *visit(action_association_c *symbol) { |
1093 if(symbol->action_qualifier != NULL){ |
1078 s4o.print(s4o.indent_spaces); |
1094 symbol->action_name->accept(*this); |
1079 symbol->action_name->accept(*this); |
1095 } |
1080 s4o.print("("); |
1096 s4o.print(" ("); |
|
1097 if(symbol->action_qualifier != NULL){ |
1081 if(symbol->action_qualifier != NULL){ |
1098 symbol->action_qualifier->accept(*this); |
1082 symbol->action_qualifier->accept(*this); |
1099 } |
1083 } |
1100 s4o.print(" "); |
|
1101 if(symbol->indicator_name_list != NULL){ |
1084 if(symbol->indicator_name_list != NULL){ |
1102 symbol->indicator_name_list->accept(*this); |
1085 symbol->indicator_name_list->accept(*this); |
1103 } |
1086 } |
1104 s4o.print(" )"); |
1087 s4o.print(");"); |
1105 return NULL; |
1088 return NULL; |
1106 } |
1089 } |
1107 |
1090 |
1108 /* indicator_name_list ',' indicator_name */ |
1091 /* indicator_name_list ',' indicator_name */ |
1109 void *visit(indicator_name_list_c *symbol) { |
1092 void *visit(indicator_name_list_c *symbol) { |
1110 print_list(symbol, "", ", ", ""); |
1093 print_list(symbol, ", ", ", ", ""); |
1111 return NULL; |
1094 return NULL; |
1112 } |
1095 } |
1113 |
1096 |
1114 /* action_qualifier [',' action_time] */ |
1097 /* action_qualifier [',' action_time] */ |
1115 void *visit(action_qualifier_c *symbol) { |
1098 void *visit(action_qualifier_c *symbol) { |
1150 symbol->integer->accept(*this); |
1133 symbol->integer->accept(*this); |
1151 s4o.print(") "); |
1134 s4o.print(") "); |
1152 } |
1135 } |
1153 s4o.print("FROM "); |
1136 s4o.print("FROM "); |
1154 symbol->from_steps->accept(*this); |
1137 symbol->from_steps->accept(*this); |
1155 s4o.print("TO "); |
1138 s4o.print(" TO "); |
1156 symbol->to_steps->accept(*this); |
1139 symbol->to_steps->accept(*this); |
1157 s4o.indent_right(); |
1140 s4o.indent_right(); |
1158 s4o.print(s4o.indent_spaces); |
|
1159 if (symbol->transition_condition_il != NULL) { |
1141 if (symbol->transition_condition_il != NULL) { |
1160 symbol->transition_condition_il->accept(*this); |
1142 symbol->transition_condition_il->accept(*this); |
1161 } |
1143 } |
1162 if (symbol->transition_condition_st != NULL) { |
1144 if (symbol->transition_condition_st != NULL) { |
1163 symbol->transition_condition_st->accept(*this); |
1145 symbol->transition_condition_st->accept(*this); |
1164 } |
1146 } |
1165 s4o.indent_left(); |
1147 s4o.indent_left(); |
1166 s4o.print(s4o.indent_spaces); |
1148 s4o.print(s4o.indent_spaces); |
1167 s4o.print("END_TRANSITION"); |
1149 s4o.print("END_TRANSITION\n"); |
1168 return NULL; |
1150 return NULL; |
1169 } |
1151 } |
1170 |
1152 |
1171 /* step_name | step_name_list */ |
1153 /* step_name | step_name_list */ |
1172 void *visit(steps_c *symbol) { |
1154 void *visit(steps_c *symbol) { |
1173 if(symbol->step_name != NULL){ |
1155 if(symbol->step_name != NULL){ |
1174 symbol->step_name->accept(*this); |
1156 symbol->step_name->accept(*this); |
1175 s4o.print(" "); |
|
1176 } |
1157 } |
1177 if(symbol->step_name_list != NULL){ |
1158 if(symbol->step_name_list != NULL){ |
1178 symbol->step_name_list->accept(*this); |
1159 symbol->step_name_list->accept(*this); |
1179 } |
1160 } |
1180 return NULL; |
1161 return NULL; |
1206 /* ACTION action_name ':' function_block_body END_ACTION */ |
1186 /* ACTION action_name ':' function_block_body END_ACTION */ |
1207 void *visit(action_c *symbol) { |
1187 void *visit(action_c *symbol) { |
1208 s4o.print(s4o.indent_spaces); |
1188 s4o.print(s4o.indent_spaces); |
1209 s4o.print("ACTION "); |
1189 s4o.print("ACTION "); |
1210 symbol->action_name->accept(*this); |
1190 symbol->action_name->accept(*this); |
1211 s4o.print(": "); |
1191 s4o.print(":\n"); |
1212 s4o.indent_right(); |
1192 s4o.indent_right(); |
|
1193 symbol->function_block_body->accept(*this); |
|
1194 s4o.indent_left(); |
1213 s4o.print(s4o.indent_spaces); |
1195 s4o.print(s4o.indent_spaces); |
1214 symbol->function_block_body->accept(*this); |
1196 s4o.print("END_ACTION\n"); |
1215 s4o.print("\n "); |
|
1216 s4o.indent_left(); |
|
1217 s4o.print(s4o.indent_spaces); |
|
1218 s4o.print("END_ACTION"); |
|
1219 return NULL; |
1197 return NULL; |
1220 } |
1198 } |
1221 |
1199 |
1222 |
1200 |
1223 |
1201 |
1551 /* | il_operand_list ',' il_operand */ |
1530 /* | il_operand_list ',' il_operand */ |
1552 void *visit(il_operand_list_c *symbol) {return print_list(symbol, "", ", ");} |
1531 void *visit(il_operand_list_c *symbol) {return print_list(symbol, "", ", ");} |
1553 |
1532 |
1554 /* | simple_instr_list il_simple_instruction */ |
1533 /* | simple_instr_list il_simple_instruction */ |
1555 void *visit(simple_instr_list_c *symbol) { |
1534 void *visit(simple_instr_list_c *symbol) { |
1556 return print_list(symbol, s4o.indent_spaces, "\n" + s4o.indent_spaces, "\n" + s4o.indent_spaces); |
1535 return print_list(symbol, s4o.indent_spaces, "\n" + s4o.indent_spaces, "\n"); |
1557 } |
1536 } |
1558 |
1537 |
1559 /* | il_initial_param_list il_param_instruction */ |
1538 /* | il_initial_param_list il_param_instruction */ |
1560 void *visit(il_param_list_c *symbol) {return print_list(symbol);} |
1539 void *visit(il_param_list_c *symbol) {return print_list(symbol);} |
1561 |
1540 |