stage4/generate_iec/generate_iec.cc
changeset 71 c2c867171c07
parent 46 fc1b78ea6d84
child 87 b97f9ad7b2c6
equal deleted inserted replaced
70:e1f0ebd2d9ec 71:c2c867171c07
  1116 void *visit(timed_qualifier_c *symbol) {
  1116 void *visit(timed_qualifier_c *symbol) {
  1117   print_token(symbol);
  1117   print_token(symbol);
  1118   return NULL;
  1118   return NULL;
  1119 }
  1119 }
  1120 
  1120 
  1121 /* TRANSITION [transition_name] ['(' 'PRIORITY' ':=' integer ')']
  1121 /* TRANSITION [transition_name] ['(''PRIORITY'':='integer')']
  1122  *   FROM steps TO steps 
  1122  *   FROMstepsTO steps 
  1123  *   ':' simple_instr_list | ':=' expression
  1123  *   ':' simple_instr_list | ':=' expression
  1124  * END_TRANSITION
  1124  * END_TRANSITION
  1125  */
  1125  */
  1126 void *visit(transition_c *symbol) {
  1126 void *visit(transition_c *symbol) {
  1127   s4o.print(s4o.indent_spaces);
  1127   s4o.print(s4o.indent_spaces);
  1506 
  1506 
  1507 /* | function_name '(' eol_list [il_param_list] ')' */
  1507 /* | function_name '(' eol_list [il_param_list] ')' */
  1508 void *visit(il_formal_funct_call_c *symbol) {
  1508 void *visit(il_formal_funct_call_c *symbol) {
  1509   symbol->function_name->accept(*this);
  1509   symbol->function_name->accept(*this);
  1510   s4o.print("(");
  1510   s4o.print("(");
       
  1511   s4o.print("\n");
  1511   if (symbol->il_param_list != NULL) {
  1512   if (symbol->il_param_list != NULL) {
  1512     s4o.print("\n");
       
  1513     s4o.indent_right();
  1513     s4o.indent_right();
  1514     symbol->il_param_list->accept(*this);
  1514     symbol->il_param_list->accept(*this);
  1515     s4o.print(")");
  1515     s4o.print(")");
       
  1516     s4o.indent_left();
  1516   }
  1517   }
  1517   return NULL;
  1518   return NULL;
  1518 }
  1519 }
  1519 
  1520 
  1520 
  1521 
  1521 /* | il_operand_list ',' il_operand */
  1522 /* | il_operand_list ',' il_operand */
  1522 void *visit(il_operand_list_c *symbol) {return print_list(symbol, "", ", ");}
  1523 void *visit(il_operand_list_c *symbol) {
       
  1524   return print_list(symbol, "", ", ");
       
  1525 }
  1523 
  1526 
  1524 /* | simple_instr_list il_simple_instruction */
  1527 /* | simple_instr_list il_simple_instruction */
  1525 void *visit(simple_instr_list_c *symbol) {
  1528 void *visit(simple_instr_list_c *symbol) {
  1526   return print_list(symbol,  s4o.indent_spaces, "\n" + s4o.indent_spaces, "\n");
  1529   return print_list(symbol,  s4o.indent_spaces, "\n" + s4o.indent_spaces, "\n");
  1527 }
  1530 }
  1528 
  1531 
  1529 /* | il_initial_param_list il_param_instruction */
  1532 /* | il_initial_param_list il_param_instruction */
  1530 void *visit(il_param_list_c *symbol) {return print_list(symbol);}
  1533 void *visit(il_param_list_c *symbol) {
       
  1534 // return print_list(symbol);
       
  1535   return print_list(symbol,  s4o.indent_spaces, ",\n" + s4o.indent_spaces, "\n" + s4o.indent_spaces);
       
  1536 }
  1531 
  1537 
  1532 /*  il_assign_operator il_operand
  1538 /*  il_assign_operator il_operand
  1533  * | il_assign_operator '(' eol_list simple_instr_list ')'
  1539  * | il_assign_operator '(' eol_list simple_instr_list ')'
  1534  */
  1540  */
  1535 void *visit(il_param_assignment_c *symbol) {
  1541 void *visit(il_param_assignment_c *symbol) {
  1536   symbol->il_assign_operator->accept(*this);
  1542   symbol->il_assign_operator->accept(*this);
  1537   s4o.print(" ");
  1543   s4o.print(" := ");
  1538   if (symbol->il_operand != NULL)
  1544   if (symbol->il_operand != NULL)
  1539     symbol->il_operand->accept(*this);
  1545     symbol->il_operand->accept(*this);
  1540   if (symbol->simple_instr_list != NULL) {
  1546   if (symbol->simple_instr_list != NULL) {
  1541     s4o.print("(\n");
  1547     s4o.print("(\n");
  1542     s4o.indent_right();
  1548     s4o.indent_right();
  1543     symbol->simple_instr_list->accept(*this);
  1549     symbol->simple_instr_list->accept(*this);
  1544     s4o.print(s4o.indent_spaces);
  1550     s4o.print(s4o.indent_spaces);
       
  1551     s4o.print(")");
  1545     s4o.indent_left();
  1552     s4o.indent_left();
  1546     s4o.print(")");
       
  1547   }
  1553   }
  1548   return NULL;
  1554   return NULL;
  1549 }
  1555 }
  1550 
  1556 
  1551 /*  il_assign_out_operator variable */
  1557 /*  il_assign_out_operator variable */
  1552 void *visit(il_param_out_assignment_c *symbol) {
  1558 void *visit(il_param_out_assignment_c *symbol) {
  1553   symbol->il_assign_out_operator->accept(*this);
  1559   symbol->il_assign_out_operator->accept(*this);
       
  1560   s4o.print(" => ");
  1554   symbol->variable->accept(*this);
  1561   symbol->variable->accept(*this);
  1555   return NULL;
  1562   return NULL;
  1556 }
  1563 }
  1557 
  1564 
  1558 
  1565