stage1_2/iec.y
changeset 73 0e623bbdee95
parent 68 b0a43002dcac
child 74 85af9521bf63
equal deleted inserted replaced
72:328b794f8922 73:0e623bbdee95
   204 
   204 
   205 
   205 
   206 /*****************************/
   206 /*****************************/
   207 /* Prelimenary constructs... */
   207 /* Prelimenary constructs... */
   208 /*****************************/
   208 /*****************************/
       
   209 /* A token used to identify the very end of the input file
       
   210  * after all includes have already been processed.
       
   211  *
       
   212  * Flex automatically returns the token with value 0
       
   213  * at the end of the file. We therefore specify
       
   214  * a token with that exact same value here.
       
   215  */
       
   216 %token END_OF_INPUT 0
       
   217 
   209 /* A bogus token that, in principle, flex MUST NEVER generate */
   218 /* A bogus token that, in principle, flex MUST NEVER generate */
   210 /* USE 1:
   219 /* USE 1:
   211  * ======
   220  * ======
   212  * This token is currently also being used as the default
   221  * This token is currently also being used as the default
   213  * initialisation value of the token_id member in
   222  * initialisation value of the token_id member in
  1382 	  tree_root = new library_c();
  1391 	  tree_root = new library_c();
  1383 	 $$ = (list_c *)tree_root;
  1392 	 $$ = (list_c *)tree_root;
  1384 	}
  1393 	}
  1385 | library library_element_declaration
  1394 | library library_element_declaration
  1386 	{$$ = $1; $$->add_element($2);}
  1395 	{$$ = $1; $$->add_element($2);}
  1387 | library error
  1396 | library error END_OF_INPUT
  1388 	{$$ = NULL;
  1397 	{$$ = NULL;
  1389 	 print_err_msg(current_filename, @2.first_line, "unknown error.");
  1398 	 print_err_msg(current_filename, @2.first_line, "unknown error.");
  1390 	 yyerrok;
  1399 	 yyerrok;
  1391 	}
  1400 	}
  1392 ;
  1401 ;
  1515 /*  Make sure that all tokens (names) not defined as keywords are included here...
  1524 /*  Make sure that all tokens (names) not defined as keywords are included here...
  1516  * I (Mario) have already done this, but if any changes are made to this file,
  1525  * I (Mario) have already done this, but if any changes are made to this file,
  1517  * this list MUST be kept consistent!!
  1526  * this list MUST be kept consistent!!
  1518  */
  1527  */
  1519 /**/
  1528 /**/
       
  1529 /*
  1520 | PRIORITY		{$$ = new identifier_c(strdup("PRIORITY"), locloc(@$));}
  1530 | PRIORITY		{$$ = new identifier_c(strdup("PRIORITY"), locloc(@$));}
  1521 | SINGLE		{$$ = new identifier_c(strdup("SINGLE"), locloc(@$));}
  1531 | SINGLE		{$$ = new identifier_c(strdup("SINGLE"), locloc(@$));}
  1522 | INTERVAL		{$$ = new identifier_c(strdup("INTERVAL"), locloc(@$));}
  1532 | INTERVAL		{$$ = new identifier_c(strdup("INTERVAL"), locloc(@$));}
       
  1533 */
  1523 /**/
  1534 /**/
       
  1535 /* NOTE: AND, NOT, MOD, OR and XOR are keywords, so should not appear on this list... */
       
  1536 /*
  1524 | LD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1537 | LD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1525 | LDN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1538 | LDN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1526 | ST_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1539 | ST_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1527 | STN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1540 | STN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1528 | S_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1541 | S_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1534 | CD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1547 | CD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1535 | PV_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1548 | PV_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1536 | IN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1549 | IN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1537 | PT_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1550 | PT_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1538 | ANDN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1551 | ANDN_operator		{$$ = il_operator_c_2_identifier_c($1);}
       
  1552 */
  1539 /* NOTE: ANDN2_operator corresponds to the string '&N' in the source code!
  1553 /* NOTE: ANDN2_operator corresponds to the string '&N' in the source code!
  1540  *       This is __not__ a valid name, so it is omitted from this list!!
  1554  *       This is __not__ a valid name, so it is omitted from this list!!
  1541  *| ANDN2_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1555  *| ANDN2_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1542  */
  1556  */
  1543 /* NOTE: 'AND' is a keyword, so should not appear on this list... */
  1557 /*
  1544 | ORN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1558 | ORN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1545 | XORN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1559 | XORN_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1546 | ADD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1560 | ADD_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1547 | SUB_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1561 | SUB_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1548 | MUL_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1562 | MUL_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1560 | RETC_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1574 | RETC_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1561 | RETCN_operator	{$$ = il_operator_c_2_identifier_c($1);}
  1575 | RETCN_operator	{$$ = il_operator_c_2_identifier_c($1);}
  1562 | JMP_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1576 | JMP_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1563 | JMPC_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1577 | JMPC_operator		{$$ = il_operator_c_2_identifier_c($1);}
  1564 | JMPCN_operator	{$$ = il_operator_c_2_identifier_c($1);}
  1578 | JMPCN_operator	{$$ = il_operator_c_2_identifier_c($1);}
       
  1579 */
  1565 ;
  1580 ;
  1566 
  1581 
  1567 /*********************/
  1582 /*********************/
  1568 /* B 1.2 - Constants */
  1583 /* B 1.2 - Constants */
  1569 /*********************/
  1584 /*********************/
  5367 #include "standard_function_names.c"
  5382 #include "standard_function_names.c"
  5368 
  5383 
  5369 const char *standard_function_block_names[] = {
  5384 const char *standard_function_block_names[] = {
  5370 // 2.5.2.3.1  Bistable elements
  5385 // 2.5.2.3.1  Bistable elements
  5371 //   Table 34 - Standard bistable function blocks
  5386 //   Table 34 - Standard bistable function blocks
  5372 //"SR","RS",
  5387 "SR","RS",
  5373 // 2.5.2.3.2  Edge detection
  5388 // 2.5.2.3.2  Edge detection
  5374 //   Table 35 - Standard edge detection function blocks
  5389 //   Table 35 - Standard edge detection function blocks
  5375 "R_TRIG","F_TRIG",
  5390 "R_TRIG","F_TRIG",
  5376 // 2.5.2.3.3  Counters
  5391 // 2.5.2.3.3  Counters
  5377 //   Table 36 - Standard counter function blocks
  5392 //   Table 36 - Standard counter function blocks