stage1_2/iec.y
changeset 257 90782e241346
parent 202 da1a8186f86f
child 258 d7d92b2f87e9
equal deleted inserted replaced
204:8ffa211b7f9a 257:90782e241346
   324 
   324 
   325 /*********************/
   325 /*********************/
   326 /* B 1.2 - Constants */
   326 /* B 1.2 - Constants */
   327 /*********************/
   327 /*********************/
   328 %type <leaf>	constant
   328 %type <leaf>	constant
   329 /* a helper symbol for expression */
   329 %type <leaf>	non_negative_constant
   330 %type  <leaf> non_negative_constant
       
   331 
       
   332 
   330 
   333 /******************************/
   331 /******************************/
   334 /* B 1.2.1 - Numeric Literals */
   332 /* B 1.2.1 - Numeric Literals */
   335 /******************************/
   333 /******************************/
   336 /* Done totally within flex...
   334 /* Done totally within flex...
   337   bit
   335   bit
   338 */
   336 */
   339 %type  <leaf> numeric_literal
   337 %type  <leaf> numeric_literal
   340 /* helper symbol for non_negative_constant */
       
   341 %type  <leaf> non_negative_numeric_literal
       
   342 %type  <leaf> integer_literal
   338 %type  <leaf> integer_literal
   343 %type  <leaf> signed_integer
   339 %type  <leaf> signed_integer
   344 /* a helper symbol for non_negative_constant */
       
   345 %type  <leaf> non_negative_signed_integer
       
   346 %token <ID>   integer_token
   340 %token <ID>   integer_token
   347 %type  <leaf> integer
   341 %type  <leaf> integer
   348 %token <ID>   binary_integer_token
   342 %token <ID>   binary_integer_token
   349 %type  <leaf> binary_integer
   343 %type  <leaf> binary_integer
   350 %token <ID>   octal_integer_token
   344 %token <ID>   octal_integer_token
   352 %token <ID>   hex_integer_token
   346 %token <ID>   hex_integer_token
   353 %type  <leaf> hex_integer
   347 %type  <leaf> hex_integer
   354 %token <ID>   real_token
   348 %token <ID>   real_token
   355 %type  <leaf> real
   349 %type  <leaf> real
   356 %type  <leaf> signed_real
   350 %type  <leaf> signed_real
   357 /* helper symbol for non_negative_real_literal */
       
   358 %type  <leaf> non_negative_signed_real
       
   359 %type  <leaf> real_literal
   351 %type  <leaf> real_literal
   360 /* helper symbol for non_negative_numeric_literal */
       
   361 %type  <leaf> non_negative_real_literal
       
   362 // %type  <leaf> exponent
   352 // %type  <leaf> exponent
   363 %type  <leaf> bit_string_literal
   353 %type  <leaf> bit_string_literal
   364 %type  <leaf> boolean_literal
   354 %type  <leaf> boolean_literal
       
   355 
       
   356 %token safeboolean_true_literal_token
       
   357 %token safeboolean_false_literal_token
       
   358 %token boolean_true_literal_token
       
   359 %token boolean_false_literal_token
   365 
   360 
   366 %token FALSE
   361 %token FALSE
   367 %token TRUE
   362 %token TRUE
   368 
   363 
   369 
   364 
   417 %token <ID>	fixed_point_s_token
   412 %token <ID>	fixed_point_s_token
   418 %token <ID>	integer_s_token
   413 %token <ID>	integer_s_token
   419 %token <ID>	fixed_point_ms_token
   414 %token <ID>	fixed_point_ms_token
   420 %token <ID>	integer_ms_token
   415 %token <ID>	integer_ms_token
   421 
   416 
   422 %token TIME
   417 // %token TIME
   423 %token T_SHARP
   418 %token T_SHARP
   424 
   419 
   425 
   420 
   426 /************************************/
   421 /************************************/
   427 /* B 1.2.3.2 - Time of day and Date */
   422 /* B 1.2.3.2 - Time of day and Date */
   436 %type  <leaf>	year
   431 %type  <leaf>	year
   437 %type  <leaf>	month
   432 %type  <leaf>	month
   438 %type  <leaf>	day
   433 %type  <leaf>	day
   439 %type  <leaf>	date_and_time
   434 %type  <leaf>	date_and_time
   440 
   435 
   441 %token TIME_OF_DAY
   436 // %token TIME_OF_DAY
   442 %token DATE
   437 // %token DATE
   443 %token D_SHARP
   438 %token D_SHARP
   444 %token DATE_AND_TIME
   439 // %token DATE_AND_TIME
   445 
   440 
   446 
   441 
   447 /**********************/
   442 /**********************/
   448 /* B 1.3 - Data Types */
   443 /* B 1.3 - Data Types */
   449 /**********************/
   444 /**********************/
   520 
   515 
   521 %token WSTRING
   516 %token WSTRING
   522 %token STRING
   517 %token STRING
   523 %token BOOL
   518 %token BOOL
   524 
   519 
   525 // %token TIME
   520 %token TIME
   526 // %token DATE
   521 %token DATE
   527 // %token DATE_AND_TIME
   522 %token DATE_AND_TIME
   528 %token DT
   523 %token DT
   529 // %token TIME_OF_DAY
   524 %token TIME_OF_DAY
   530 %token TOD
   525 %token TOD
   531 
   526 
       
   527 /******************************************************/
       
   528 /* Symbols defined in                                 */
       
   529 /* "Safety Software Technical Specification,          */
       
   530 /*  Part 1: Concepts and Function Blocks,             */
       
   531 /*  Version 1.0 – Official Release"                   */
       
   532 /* by PLCopen - Technical Committee 5 - 2006-01-31    */
       
   533 /******************************************************/
       
   534 
       
   535 %token SAFEBYTE
       
   536 %token SAFEWORD
       
   537 %token SAFEDWORD
       
   538 %token SAFELWORD
       
   539 
       
   540 %token SAFELREAL
       
   541 %token SAFEREAL
       
   542 
       
   543 %token SAFESINT
       
   544 %token SAFEINT
       
   545 %token SAFEDINT
       
   546 %token SAFELINT
       
   547 
       
   548 %token SAFEUSINT
       
   549 %token SAFEUINT
       
   550 %token SAFEUDINT
       
   551 %token SAFEULINT
       
   552 
       
   553 %token SAFEWSTRING
       
   554 %token SAFESTRING
       
   555 %token SAFEBOOL
       
   556 
       
   557 %token SAFETIME
       
   558 %token SAFEDATE
       
   559 %token SAFEDATE_AND_TIME
       
   560 %token SAFEDT
       
   561 %token SAFETIME_OF_DAY
       
   562 %token SAFETOD
   532 
   563 
   533 /********************************/
   564 /********************************/
   534 /* B 1.3.2 - Generic data types */
   565 /* B 1.3.2 - Generic data types */
   535 /********************************/
   566 /********************************/
   536 /* Strangely, the following symbol does seem to be required! */
   567 /* Strangely, the following symbol does seem to be required! */
  1166 // %type  <leaf>	multiply_operator
  1197 // %type  <leaf>	multiply_operator
  1167 %type  <leaf>	power_expression
  1198 %type  <leaf>	power_expression
  1168 %type  <leaf>	unary_expression
  1199 %type  <leaf>	unary_expression
  1169 // %type  <leaf>	unary_operator
  1200 // %type  <leaf>	unary_operator
  1170 %type  <leaf>	primary_expression
  1201 %type  <leaf>	primary_expression
       
  1202 %type  <leaf>	non_negative_primary_expression
  1171 /* intermediate helper symbol for primary_expression */
  1203 /* intermediate helper symbol for primary_expression */
  1172 %type  <leaf>	function_invocation
  1204 %type  <leaf>	function_invocation
  1173 
  1205 
  1174 // %token AND
  1206 // %token AND
  1175 // %token XOR
  1207 // %token XOR
  1271 %token UNTIL
  1303 %token UNTIL
  1272 %token END_REPEAT
  1304 %token END_REPEAT
  1273 
  1305 
  1274 %token EXIT
  1306 %token EXIT
  1275 
  1307 
  1276 
       
  1277 /******************************************************/
       
  1278 /* Symbols defined in                                 */
       
  1279 /* "Safety Software Technical Specification,          */
       
  1280 /*  Part 1: Concepts and Function Blocks,             */
       
  1281 /*  Version 1.0 – Official Release"                   */
       
  1282 /* by PLCopen - Technical Committee 5 - 2006-01-31    */
       
  1283 /******************************************************/
       
  1284 %token SAFEBOOL
       
  1285 
  1308 
  1286 %%
  1309 %%
  1287 
  1310 
  1288 
  1311 
  1289 
  1312 
  1595 | character_string
  1618 | character_string
  1596 | time_literal
  1619 | time_literal
  1597 | bit_string_literal
  1620 | bit_string_literal
  1598 | boolean_literal
  1621 | boolean_literal
  1599 /* NOTE: in order to remove reduce/reduce conflicts,
  1622 /* NOTE: in order to remove reduce/reduce conflicts,
       
  1623  * [between -9.5 being parsed as 
       
  1624  *     (i)   a signed real, 
       
  1625  *     (ii)  or as a real preceded by the '-' operator
       
  1626  *  ]
       
  1627  *  we need to define a variant of the constant construct
       
  1628  *  where any constant is never preceded by the '-' character.
       
  1629  * In order to do this, we have borugh the signed_real 
       
  1630  * directly into the definition of the constant construct
       
  1631  * (so we can define another non_negative_constant
       
  1632  * construct that does not include it!)
       
  1633  */
       
  1634 | signed_real
       
  1635 /* NOTE: in order to remove reduce/reduce conflicts,
  1600  * unsigned_integer, signed_integer, binary_integer, octal_integer
  1636  * unsigned_integer, signed_integer, binary_integer, octal_integer
  1601  * and hex_integer have been integrated directly into
  1637  * and hex_integer have been integrated directly into
  1602  * the constants construct, instead of belonging to
  1638  * the constants construct, instead of belonging to
  1603  * either the bit_string_literal or integer_literal
  1639  * both the bit_string_literal or integer_literal
  1604  * construct.
  1640  * construct.
  1605  */
  1641  */
  1606 /* NOTE: unsigned_integer, although used in some
  1642 /* NOTE: unsigned_integer, although used in some
  1607  * rules, is not defined in the spec!
  1643  * rules, is not defined in the spec!
  1608  * We therefore replaced unsigned_integer as integer
  1644  * We therefore replaced unsigned_integer as integer
  1612 | binary_integer
  1648 | binary_integer
  1613 | octal_integer
  1649 | octal_integer
  1614 | hex_integer
  1650 | hex_integer
  1615 ;
  1651 ;
  1616 
  1652 
  1617 /* a helper symbol for expression */
  1653 
  1618 /* A constant without any preceding '-', but may
  1654 /* NOTE: in order to remove reduce/reduce conflicts,
  1619  * include a preceding '+' !
  1655  * [between -9.5 being parsed as 
       
  1656  *     (i)   a signed real, 
       
  1657  *     (ii)  or as a real preceded by the '-' operator
       
  1658  *  ]
       
  1659  *  we need to define a variant of the constant construct
       
  1660  *  where any constant is never preceded by the '-' character.
       
  1661  * In order to do this, we have borugh the signed_real 
       
  1662  * directly into the definition of the constant construct
       
  1663  * (so we can define another non_negative_constant
       
  1664  * construct that does not include it!)
  1620  */
  1665  */
  1621 non_negative_constant:
  1666 non_negative_constant:
  1622   non_negative_numeric_literal
  1667   numeric_literal
  1623 | character_string
  1668 | character_string
  1624 | time_literal
  1669 | time_literal
  1625 | bit_string_literal
  1670 | bit_string_literal
  1626 | boolean_literal
  1671 | boolean_literal
  1627 | non_negative_signed_integer
  1672 /* NOTE: in order to remove reduce/reduce conflicts,
       
  1673  * [between -9.5 being parsed as 
       
  1674  *     (i)   a signed real, 
       
  1675  *     (ii)  or as a real preceded by the '-' operator
       
  1676  *  ]
       
  1677  *  we need to define a variant of the constant construct
       
  1678  *  where any constant is never preceded by the '-' character.
       
  1679  * In order to do this, we have borugh the signed_real 
       
  1680  * directly into the definition of the constant construct
       
  1681  * (so we can define another non_negative_constant
       
  1682  * construct that does not include it!)
       
  1683  */
       
  1684 /* | signed_real */
       
  1685 | real /* an unsigned real */
       
  1686 /* NOTE: in order to remove reduce/reduce conflicts,
       
  1687  * unsigned_integer, signed_integer, binary_integer, octal_integer
       
  1688  * and hex_integer have been integrated directly into
       
  1689  * the constants construct, instead of belonging to
       
  1690  * both the bit_string_literal or integer_literal
       
  1691  * construct.
       
  1692  */
       
  1693 /* NOTE: unsigned_integer, although used in some
       
  1694  * rules, is not defined in the spec!
       
  1695  * We therefore replaced unsigned_integer as integer
       
  1696  */
       
  1697 | integer  /* i.e. an unsigned_integer */
       
  1698 /* | signed_integer */
  1628 | binary_integer
  1699 | binary_integer
  1629 | octal_integer
  1700 | octal_integer
  1630 | hex_integer
  1701 | hex_integer
  1631 ;
  1702 ;
  1632 
       
  1633 
  1703 
  1634 
  1704 
  1635 /******************************/
  1705 /******************************/
  1636 /* B 1.2.1 - Numeric Literals */
  1706 /* B 1.2.1 - Numeric Literals */
  1637 /******************************/
  1707 /******************************/
  1661  *      real_literal: [real_type_name '#'] singned_real
  1731  *      real_literal: [real_type_name '#'] singned_real
  1662  *      signed_real: ['+'|'-'] real
  1732  *      signed_real: ['+'|'-'] real
  1663  *      Flex handles real, while bison handles signed_real
  1733  *      Flex handles real, while bison handles signed_real
  1664  *      and real_literal.
  1734  *      and real_literal.
  1665  *
  1735  *
  1666  *    - According to the spec, intger '.' integer
  1736  *    - According to the spec, integer '.' integer
  1667  *      may be reduced to either a real or a fixed_point.
  1737  *      may be reduced to either a real or a fixed_point.
  1668  *      It is nevertheless possible to figure out from the
  1738  *      It is nevertheless possible to figure out from the
  1669  *      context which of the two rules should be used in
  1739  *      context which of the two rules should be used in
  1670  *      the reduction.
  1740  *      the reduction.
  1671  *      Unfortunately, due to the issue described above
  1741  *      Unfortunately, due to the issue described above
  1718 numeric_literal:
  1788 numeric_literal:
  1719   integer_literal
  1789   integer_literal
  1720 | real_literal
  1790 | real_literal
  1721 ;
  1791 ;
  1722 
  1792 
  1723 /* helper symbol for non_negative_constant */
       
  1724 non_negative_numeric_literal:
       
  1725   integer_literal
       
  1726 | non_negative_real_literal
       
  1727 ;
       
  1728 
       
  1729 
  1793 
  1730 integer_literal:
  1794 integer_literal:
  1731   integer_type_name '#' signed_integer
  1795   integer_type_name '#' signed_integer
  1732 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1796 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1733 | integer_type_name '#' binary_integer
  1797 | integer_type_name '#' binary_integer
  1759 ;
  1823 ;
  1760 
  1824 
  1761 signed_integer:
  1825 signed_integer:
  1762   integer
  1826   integer
  1763 | '+' integer   {$$ = $2;}
  1827 | '+' integer   {$$ = $2;}
  1764 | '-' integer	{$$ = new neg_literal_c($2, locloc(@$));}
  1828 | '-' integer	{$$ = new neg_integer_c($2, locloc(@$));}
  1765 ;
       
  1766 
       
  1767 /* a helper symbol for non_negative_constant */
       
  1768 /* A integer without any preceding '-', but may
       
  1769  * include a preceding '+' !
       
  1770  */
       
  1771 non_negative_signed_integer:
       
  1772   integer
       
  1773 | '+' integer   {$$ = $2;}
       
  1774 ;
  1829 ;
  1775 
  1830 
  1776 
  1831 
  1777 real_literal:
  1832 real_literal:
  1778   signed_real
  1833 /* NOTE: see note in the definition of constant for reason
  1779 | real_type_name '#' signed_real
  1834  * why signed_real is missing here!
       
  1835  */
       
  1836 /*  signed_real */
       
  1837   real_type_name '#' signed_real
  1780 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
  1838 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
  1781 /* ERROR_CHECK_BEGIN */
  1839 /* ERROR_CHECK_BEGIN */
  1782 | real_type_name signed_real
  1840 | real_type_name signed_real
  1783 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;}
  1841 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;}
  1784 | real_type_name '#' error
  1842 | real_type_name '#' error
  1788 	 yyerrok;
  1846 	 yyerrok;
  1789 	}
  1847 	}
  1790 /* ERROR_CHECK_END */
  1848 /* ERROR_CHECK_END */
  1791 ;
  1849 ;
  1792 
  1850 
  1793 /* helper symbol for non_negative_numeric_literal */
       
  1794 non_negative_real_literal:
       
  1795   non_negative_signed_real
       
  1796 | real_type_name '#' signed_real
       
  1797 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
       
  1798 ;
       
  1799 
  1851 
  1800 signed_real:
  1852 signed_real:
  1801   real
  1853   real
  1802 | '+' real	{$$ = $2;}
  1854 | '+' real	{$$ = $2;}
  1803 | '-' real	{$$ = new neg_literal_c($2, locloc(@2));}
  1855 | '-' real	{$$ = new neg_real_c($2, locloc(@2));}
  1804 ;
  1856 ;
  1805 
  1857 
  1806 /* helper symbol for non_negative_real_literal */
       
  1807 non_negative_signed_real:
       
  1808   real
       
  1809 | '+' real	{$$ = $2;}
       
  1810 ;
       
  1811 
  1858 
  1812 
  1859 
  1813 bit_string_literal:
  1860 bit_string_literal:
  1814   bit_string_type_name '#' integer  /* i.e. unsigned_integer */
  1861   bit_string_type_name '#' integer  /* i.e. unsigned_integer */
  1815 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1862 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1836 | bit_string_type_name octal_integer
  1883 | bit_string_type_name octal_integer
  1837 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
  1884 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
  1838 | bit_string_type_name hex_integer
  1885 | bit_string_type_name hex_integer
  1839 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
  1886 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
  1840 | bit_string_type_name '#' error
  1887 | bit_string_type_name '#' error
  1841   {$$ = NULL;
  1888 	{$$ = NULL;
  1842 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");}
  1889 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");}
  1843 	 else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;}
  1890 	 else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;}
  1844 	 yyerrok;
  1891 	 yyerrok;
  1845 	}
  1892 	}
  1846 /* ERROR_CHECK_END */
  1893 /* ERROR_CHECK_END */
  1847 ;
  1894 ;
  1848 
  1895 
  1849 
  1896 
  1850 boolean_literal:
  1897 boolean_literal:
  1851   TRUE	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1898   boolean_true_literal_token
  1852   				    new boolean_true_c(locloc(@$)),
  1899 	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1853 				    locloc(@$));}
  1900 				    new boolean_true_c(locloc(@$)),
  1854 | FALSE	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1901 				    locloc(@$));
       
  1902 	}
       
  1903 | boolean_false_literal_token
       
  1904 	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1855 				    new boolean_false_c(locloc(@$)),
  1905 				    new boolean_false_c(locloc(@$)),
  1856 				    locloc(@$));}
  1906 				    locloc(@$));
       
  1907 	}
       
  1908 | safeboolean_true_literal_token
       
  1909 	{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)),
       
  1910 				    new boolean_true_c(locloc(@$)),
       
  1911 				    locloc(@$));
       
  1912 	}
       
  1913 | safeboolean_false_literal_token
       
  1914 	{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)),
       
  1915 				    new boolean_false_c(locloc(@$)),
       
  1916 				    locloc(@$));
       
  1917 	}
       
  1918 | FALSE
       
  1919 	{$$ = new boolean_literal_c(NULL,
       
  1920 				    new boolean_false_c(locloc(@$)),
       
  1921 				    locloc(@$));
       
  1922 	}
       
  1923 | TRUE
       
  1924 	{$$ = new boolean_literal_c(NULL,
       
  1925 				    new boolean_true_c(locloc(@$)),
       
  1926 				    locloc(@$));
       
  1927 	}
  1857 /*
  1928 /*
  1858 |	BOOL '#' '1' {}
  1929 |	BOOL '#' '1' {}
  1859 |	BOOL '#' '0' {}
  1930 |	BOOL '#' '0' {}
  1860 */
  1931 */
  1861 /* NOTE: the rules
  1932 /* NOTE: the rules
  1933  *
  2004  *
  1934  *       We therefore have flex returning the token T_SHARP
  2005  *       We therefore have flex returning the token T_SHARP
  1935  *       when it comes across 'T#'
  2006  *       when it comes across 'T#'
  1936  */
  2007  */
  1937   TIME '#' interval
  2008   TIME '#' interval
  1938 	{$$ = new duration_c(NULL, $3, locloc(@$));}
  2009 	{$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $3, locloc(@$));}
  1939 | TIME '#' '-' interval
  2010 | TIME '#' '-' interval
  1940 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $4, locloc(@$));}
  2011 	{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));}
  1941 | T_SHARP interval
  2012 | T_SHARP interval
  1942 	{$$ = new duration_c(NULL, $2, locloc(@$));}
  2013 	{$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $2, locloc(@$));}
  1943 | T_SHARP '-' interval
  2014 | T_SHARP '-' interval
  1944 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $3, locloc(@$));}
  2015 	{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $3, locloc(@$));}
       
  2016 | SAFETIME '#' interval
       
  2017 	{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), NULL, $3, locloc(@$));}
       
  2018 | SAFETIME '#' '-' interval
       
  2019 	{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));}
  1945 /* ERROR_CHECK_BEGIN */
  2020 /* ERROR_CHECK_BEGIN */
  1946 | TIME interval
  2021 | TIME interval
  1947 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
  2022 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
  1948 | TIME '-' interval
  2023 | TIME '-' interval
  1949 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
  2024 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
  2104 /************************************/
  2179 /************************************/
  2105 /* B 1.2.3.2 - Time of day and Date */
  2180 /* B 1.2.3.2 - Time of day and Date */
  2106 /************************************/
  2181 /************************************/
  2107 time_of_day:
  2182 time_of_day:
  2108   TIME_OF_DAY '#' daytime
  2183   TIME_OF_DAY '#' daytime
  2109 	{$$ = new time_of_day_c($3, locloc(@$));}
  2184 	{$$ = new time_of_day_c(new tod_type_name_c(locloc(@1)), $3, locloc(@$));}
       
  2185 | SAFETIME_OF_DAY '#' daytime
       
  2186 	{$$ = new time_of_day_c(new safetod_type_name_c(locloc(@1)), $3, locloc(@$));}
  2110 /* ERROR_CHECK_BEGIN */
  2187 /* ERROR_CHECK_BEGIN */
  2111 | TIME_OF_DAY daytime
  2188 | TIME_OF_DAY daytime
  2112 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;}
  2189 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;}
  2113 | TIME_OF_DAY '#' error
  2190 | TIME_OF_DAY '#' error
  2114 	{$$ = NULL;
  2191 	{$$ = NULL;
  2151 day_second: fixed_point;
  2228 day_second: fixed_point;
  2152 
  2229 
  2153 
  2230 
  2154 date:
  2231 date:
  2155   DATE '#' date_literal
  2232   DATE '#' date_literal
  2156 	{$$ = new date_c($3, locloc(@$));}
  2233 	{$$ = new date_c(new date_type_name_c(locloc(@1)), $3, locloc(@$));}
  2157 | D_SHARP date_literal
  2234 | D_SHARP date_literal
  2158 	{$$ = new date_c($2, locloc(@$));}
  2235 	{$$ = new date_c(new date_type_name_c(locloc(@1)), $2, locloc(@$));}
       
  2236 | SAFEDATE '#' date_literal
       
  2237 	{$$ = new date_c(new safedate_type_name_c(locloc(@1)), $3, locloc(@$));}
  2159 /* ERROR_CHECK_BEGIN */
  2238 /* ERROR_CHECK_BEGIN */
  2160 | DATE date_literal
  2239 | DATE date_literal
  2161 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;}
  2240 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;}
  2162 | DATE '#' error
  2241 | DATE '#' error
  2163 	{$$ = NULL;
  2242 	{$$ = NULL;
  2204 day: integer;
  2283 day: integer;
  2205 
  2284 
  2206 
  2285 
  2207 date_and_time:
  2286 date_and_time:
  2208   DATE_AND_TIME '#' date_literal '-' daytime
  2287   DATE_AND_TIME '#' date_literal '-' daytime
  2209 	{$$ = new date_and_time_c($3, $5, locloc(@$));}
  2288 	{$$ = new date_and_time_c(new dt_type_name_c(locloc(@1)), $3, $5, locloc(@$));}
       
  2289 | SAFEDATE_AND_TIME '#' date_literal '-' daytime
       
  2290 	{$$ = new date_and_time_c(new safedt_type_name_c(locloc(@1)), $3, $5, locloc(@$));}
  2210 /* ERROR_CHECK_BEGIN */
  2291 /* ERROR_CHECK_BEGIN */
  2211 | DATE_AND_TIME date_literal '-' daytime
  2292 | DATE_AND_TIME date_literal '-' daytime
  2212 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;}
  2293 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;}
  2213 | DATE_AND_TIME '#' '-' daytime
  2294 | DATE_AND_TIME '#' '-' daytime
  2214 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for date literal in date and time."); yynerrs++;}
  2295 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for date literal in date and time."); yynerrs++;}
  2249 
  2330 
  2250 
  2331 
  2251 /***********************************/
  2332 /***********************************/
  2252 /* B 1.3.1 - Elementary Data Types */
  2333 /* B 1.3.1 - Elementary Data Types */
  2253 /***********************************/
  2334 /***********************************/
       
  2335     /******************************************************/
       
  2336     /* SAFExxxx Symbols defined in                        */
       
  2337     /* "Safety Software Technical Specification,          */
       
  2338     /*  Part 1: Concepts and Function Blocks,             */
       
  2339     /*  Version 1.0 – Official Release"                   */
       
  2340     /* by PLCopen - Technical Committee 5 - 2006-01-31    */
       
  2341     /******************************************************/
       
  2342 
  2254 elementary_type_name:
  2343 elementary_type_name:
  2255   numeric_type_name
  2344   numeric_type_name
  2256 | date_type_name
  2345 | date_type_name
  2257 | bit_string_type_name
  2346 | bit_string_type_name
  2258 | elementary_string_type_name
  2347 | elementary_string_type_name
  2260 | BOOL		{$$ = new bool_type_name_c(locloc(@$));}
  2349 | BOOL		{$$ = new bool_type_name_c(locloc(@$));}
  2261 /* NOTE: see note under the B 1.2.1 section of token
  2350 /* NOTE: see note under the B 1.2.1 section of token
  2262  * and grouping type definition for reason why BOOL
  2351  * and grouping type definition for reason why BOOL
  2263  * was added to this definition.
  2352  * was added to this definition.
  2264  */
  2353  */
  2265     /******************************************************/
  2354 | SAFETIME	{$$ = new safetime_type_name_c(locloc(@$));}
  2266     /* Symbols defined in                                 */
       
  2267     /* "Safety Software Technical Specification,          */
       
  2268     /*  Part 1: Concepts and Function Blocks,             */
       
  2269     /*  Version 1.0 – Official Release"                   */
       
  2270     /* by PLCopen - Technical Committee 5 - 2006-01-31    */
       
  2271     /******************************************************/
       
  2272 | SAFEBOOL	{$$ = new safebool_type_name_c(locloc(@$));}
  2355 | SAFEBOOL	{$$ = new safebool_type_name_c(locloc(@$));}
  2273 ;
  2356 ;
  2274 
  2357 
  2275 numeric_type_name:
  2358 numeric_type_name:
  2276   integer_type_name
  2359   integer_type_name
  2281   signed_integer_type_name
  2364   signed_integer_type_name
  2282 | unsigned_integer_type_name
  2365 | unsigned_integer_type_name
  2283 ;
  2366 ;
  2284 
  2367 
  2285 signed_integer_type_name:
  2368 signed_integer_type_name:
  2286   SINT	{$$ = new sint_type_name_c(locloc(@$));}
  2369   SINT		{$$ = new sint_type_name_c(locloc(@$));}
  2287 | INT	{$$ = new int_type_name_c(locloc(@$));}
  2370 | INT		{$$ = new int_type_name_c(locloc(@$));}
  2288 | DINT	{$$ = new dint_type_name_c(locloc(@$));}
  2371 | DINT		{$$ = new dint_type_name_c(locloc(@$));}
  2289 | LINT	{$$ = new lint_type_name_c(locloc(@$));}
  2372 | LINT		{$$ = new lint_type_name_c(locloc(@$));}
       
  2373 | SAFESINT	{$$ = new safesint_type_name_c(locloc(@$));}
       
  2374 | SAFEINT	{$$ = new safeint_type_name_c(locloc(@$));}
       
  2375 | SAFEDINT	{$$ = new safedint_type_name_c(locloc(@$));}
       
  2376 | SAFELINT	{$$ = new safelint_type_name_c(locloc(@$));}
  2290 ;
  2377 ;
  2291 
  2378 
  2292 unsigned_integer_type_name:
  2379 unsigned_integer_type_name:
  2293   USINT	{$$ = new usint_type_name_c(locloc(@$));}
  2380   USINT		{$$ = new usint_type_name_c(locloc(@$));}
  2294 | UINT	{$$ = new uint_type_name_c(locloc(@$));}
  2381 | UINT		{$$ = new uint_type_name_c(locloc(@$));}
  2295 | UDINT	{$$ = new udint_type_name_c(locloc(@$));}
  2382 | UDINT		{$$ = new udint_type_name_c(locloc(@$));}
  2296 | ULINT	{$$ = new ulint_type_name_c(locloc(@$));}
  2383 | ULINT		{$$ = new ulint_type_name_c(locloc(@$));}
       
  2384 | SAFEUSINT	{$$ = new safeusint_type_name_c(locloc(@$));}
       
  2385 | SAFEUINT	{$$ = new safeuint_type_name_c(locloc(@$));}
       
  2386 | SAFEUDINT	{$$ = new safeudint_type_name_c(locloc(@$));}
       
  2387 | SAFEULINT	{$$ = new safeulint_type_name_c(locloc(@$));}
  2297 ;
  2388 ;
  2298 
  2389 
  2299 real_type_name:
  2390 real_type_name:
  2300   REAL	{$$ = new real_type_name_c(locloc(@$));}
  2391   REAL		{$$ = new real_type_name_c(locloc(@$));}
  2301 | LREAL	{$$ = new lreal_type_name_c(locloc(@$));}
  2392 | LREAL		{$$ = new lreal_type_name_c(locloc(@$));}
       
  2393 | SAFEREAL	{$$ = new safereal_type_name_c(locloc(@$));}
       
  2394 | SAFELREAL	{$$ = new safelreal_type_name_c(locloc(@$));}
  2302 ;
  2395 ;
  2303 
  2396 
  2304 date_type_name:
  2397 date_type_name:
  2305   DATE		{$$ = new date_type_name_c(locloc(@$));}
  2398   DATE			{$$ = new date_type_name_c(locloc(@$));}
  2306 | TIME_OF_DAY	{$$ = new tod_type_name_c(locloc(@$));}
  2399 | TIME_OF_DAY		{$$ = new tod_type_name_c(locloc(@$));}
  2307 | TOD		{$$ = new tod_type_name_c(locloc(@$));}
  2400 | TOD			{$$ = new tod_type_name_c(locloc(@$));}
  2308 | DATE_AND_TIME	{$$ = new dt_type_name_c(locloc(@$));}
  2401 | DATE_AND_TIME		{$$ = new dt_type_name_c(locloc(@$));}
  2309 | DT		{$$ = new dt_type_name_c(locloc(@$));}
  2402 | DT			{$$ = new dt_type_name_c(locloc(@$));}
       
  2403 | SAFEDATE		{$$ = new safedate_type_name_c(locloc(@$));}
       
  2404 | SAFETIME_OF_DAY	{$$ = new safetod_type_name_c(locloc(@$));}
       
  2405 | SAFETOD		{$$ = new safetod_type_name_c(locloc(@$));}
       
  2406 | SAFEDATE_AND_TIME	{$$ = new safedt_type_name_c(locloc(@$));}
       
  2407 | SAFEDT		{$$ = new safedt_type_name_c(locloc(@$));}
  2310 ;
  2408 ;
  2311 
  2409 
  2312 
  2410 
  2313 bit_string_type_name:
  2411 bit_string_type_name:
  2314   BYTE	{$$ = new byte_type_name_c(locloc(@$));}
  2412   BYTE		{$$ = new byte_type_name_c(locloc(@$));}
  2315 | WORD	{$$ = new word_type_name_c(locloc(@$));}
  2413 | WORD		{$$ = new word_type_name_c(locloc(@$));}
  2316 | DWORD	{$$ = new dword_type_name_c(locloc(@$));}
  2414 | DWORD		{$$ = new dword_type_name_c(locloc(@$));}
  2317 | LWORD	{$$ = new lword_type_name_c(locloc(@$));}
  2415 | LWORD		{$$ = new lword_type_name_c(locloc(@$));}
       
  2416 | SAFEBYTE	{$$ = new safebyte_type_name_c(locloc(@$));}
       
  2417 | SAFEWORD	{$$ = new safeword_type_name_c(locloc(@$));}
       
  2418 | SAFEDWORD	{$$ = new safedword_type_name_c(locloc(@$));}
       
  2419 | SAFELWORD	{$$ = new safelword_type_name_c(locloc(@$));}
  2318 /* NOTE: see note under the B 1.2.1 section of token
  2420 /* NOTE: see note under the B 1.2.1 section of token
  2319  * and grouping type definition for reason why the BOOL
  2421  * and grouping type definition for reason why the BOOL
  2320  * was omitted from this definition.
  2422  * was omitted from this definition.
  2321  */
  2423  */
  2322 ;
  2424 ;
  2331  * possible future changes easier to edit...
  2433  * possible future changes easier to edit...
  2332  */
  2434  */
  2333 elementary_string_type_name:
  2435 elementary_string_type_name:
  2334   STRING	{$$ = new string_type_name_c(locloc(@$));}
  2436   STRING	{$$ = new string_type_name_c(locloc(@$));}
  2335 | WSTRING	{$$ = new wstring_type_name_c(locloc(@$));}
  2437 | WSTRING	{$$ = new wstring_type_name_c(locloc(@$));}
       
  2438 | SAFESTRING	{$$ = new safestring_type_name_c(locloc(@$));}
       
  2439 | SAFEWSTRING	{$$ = new safewstring_type_name_c(locloc(@$));}
  2336 ;
  2440 ;
  2337 
  2441 
  2338 
  2442 
  2339 
  2443 
  2340 /********************************/
  2444 /********************************/
  6373 /* ERROR_CHECK_END */
  6477 /* ERROR_CHECK_END */
  6374 ;
  6478 ;
  6375 
  6479 
  6376 
  6480 
  6377 il_param_instruction:
  6481 il_param_instruction:
  6378   il_param_assignment ',' eol_list
  6482   il_param_assignment ',' eol_list 
  6379 | il_param_out_assignment ',' eol_list
  6483 | il_param_out_assignment ',' eol_list
  6380 /* ERROR_CHECK_BEGIN */
  6484 /* ERROR_CHECK_BEGIN */
  6381 | il_param_assignment ',' error
  6485 | il_param_assignment ',' error
  6382   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter assignment in parameter assignment list."); yyerrok;}
  6486   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter assignment in parameter assignment list."); yyerrok;}
  6383 | il_param_out_assignment ',' error
  6487 | il_param_out_assignment ',' error
  6589 il_assign_out_operator:
  6693 il_assign_out_operator:
  6590 /*  variable_name SENDTO */
  6694 /*  variable_name SENDTO */
  6591 /*  any_identifier SENDTO */
  6695 /*  any_identifier SENDTO */
  6592   sendto_identifier SENDTO
  6696   sendto_identifier SENDTO
  6593 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  6697 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
       
  6698 /* The following is not required, as the sendto_identifier_token returned by flex will 
       
  6699  * also include the 'ENO' identifier.
       
  6700  * The resulting abstract syntax tree is identical with or without this following rule,
       
  6701  * as both the eno_identifier and the sendto_identifier are stored as
       
  6702  * an identifier_c !!
       
  6703  */
       
  6704 /*
  6594 | eno_identifier SENDTO
  6705 | eno_identifier SENDTO
  6595 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  6706 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
       
  6707 */
  6596 /*| NOT variable_name SENDTO */
  6708 /*| NOT variable_name SENDTO */
  6597 | NOT sendto_identifier SENDTO
  6709 | NOT sendto_identifier SENDTO
  6598 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
  6710 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
       
  6711 /* The following is not required, as the sendto_identifier_token returned by flex will 
       
  6712  * also include the 'ENO' identifier.
       
  6713  * The resulting abstract syntax tree is identical with or without this following rule,
       
  6714  * as both the eno_identifier and the sendto_identifier are stored as
       
  6715  * an identifier_c !!
       
  6716  *
       
  6717  * NOTE: Removing the following rule also removes a shift/reduce conflict from the parser.
       
  6718  *       This conflict is not really an error/ambiguity in the syntax, but rather
       
  6719  *       due to the fact that more than a single look-ahead token would be required
       
  6720  *       to correctly parse the syntax, something that bison does not support.
       
  6721  *
       
  6722  *       The shift/reduce conflict arises because bison does not know whether
       
  6723  *       to parse the 'NOT ENO' in the following code
       
  6724  *         LD 1
       
  6725  *         funct_name (
       
  6726  *                      NOT ENO => bool_var,
       
  6727  *                      EN := TRUE
       
  6728  *                    )
       
  6729  *        as either a il_param_assignment (wrong!) or an il_param_out_assignment.(correct).
       
  6730  *        The '=>' delimiter (known as SEND_TO in this iec.y file) is a dead giveaway that 
       
  6731  *        it should be parsed as an il_param_out_assignment, but still, bison gets confused!
       
  6732  *        Bison considers the possibility of reducing the 'NOT ENO' as an NOT_operator with
       
  6733  *        the 'ENO' operand
       
  6734  *        (NOT_operator -> il_simple_operator -> il_simple_operation -> il_simple_instruction ->
       
  6735  *          -> simple_instr_list -> il_param_assignment)
       
  6736  *        instead of reducing it to an il_param_out_operator.
       
  6737  *        ( il_param_out_operator -> il_param_out_assignment)
       
  6738  *
       
  6739  *        Note that the shift/reduce conflict only manifests itself in the il_formal_funct_call,
       
  6740  *        where both the il_param_out_assignment and il_param_assignment are used!
       
  6741  * 
       
  6742  *          il_param_out_assignment --+--> il_param_instruction -> il_param_instruction_list --+
       
  6743  *                                    |                                                        |
       
  6744  *          il_param_assignment     --+                                                        |
       
  6745  *                                                                                             |
       
  6746  *                                                     il_formal_funct_call <- il_param_list <-+
       
  6747  *
       
  6748  */
       
  6749 /*
  6599 | NOT eno_identifier SENDTO
  6750 | NOT eno_identifier SENDTO
  6600 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
  6751 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
       
  6752 */
  6601 /* ERROR_CHECK_BEGIN */
  6753 /* ERROR_CHECK_BEGIN */
  6602 | error SENDTO
  6754 | error SENDTO
  6603   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;}
  6755   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;}
  6604 | NOT SENDTO
  6756 | NOT SENDTO
  6605   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter defined in parameter out assignment."); yynerrs++;}
  6757   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter defined in parameter out assignment."); yynerrs++;}
  6836 /* ERROR_CHECK_END */
  6988 /* ERROR_CHECK_END */
  6837 ;
  6989 ;
  6838 
  6990 
  6839 
  6991 
  6840 unary_expression:
  6992 unary_expression:
  6841   primary_expression
  6993   non_negative_primary_expression
  6842 | '-' primary_expression
  6994 | '-' non_negative_primary_expression
  6843 	{$$ = new neg_expression_c($2, locloc(@$));}
  6995 	{$$ = new neg_expression_c($2, locloc(@$));}
  6844 | NOT primary_expression
  6996 | NOT primary_expression
  6845 	{$$ = new not_expression_c($2, locloc(@$));}
  6997 	{$$ = new not_expression_c($2, locloc(@$));}
  6846 /* ERROR_CHECK_BEGIN */
  6998 /* ERROR_CHECK_BEGIN */
  6847 | '-' error
  6999 | '-' error
  6872  *       (i.e. the constant 9 negative)
  7024  *       (i.e. the constant 9 negative)
  6873  *       OR
  7025  *       OR
  6874  *       expression<-unary_expression<-constant<-integer
  7026  *       expression<-unary_expression<-constant<-integer
  6875  *       (i.e. the constant 9, preceded by a unary negation)
  7027  *       (i.e. the constant 9, preceded by a unary negation)
  6876  *
  7028  *
  6877  *       To remove the conlfict, we only allow constants without
  7029  *       To remove the conflict, we only allow constants without
  6878  *       a preceding '-' to be used in primary_expression
  7030  *       a preceding '-' to be used in primary_expression
       
  7031  *       (i.e. as a parameter to the unary negation operator)
  6879  */
  7032  */
  6880 /* NOTE: We use enumerated_value_without_identifier instead of enumerated_value
  7033 /* NOTE: We use enumerated_value_without_identifier instead of enumerated_value
  6881  *       in order to remove a reduce/reduce conflict between reducing an
  7034  *       in order to remove a reduce/reduce conflict between reducing an
  6882  *       identifier to a variable or an enumerated_value.
  7035  *       identifier to a variable or an enumerated_value.
  6883  *
  7036  *
  6885  *       imply (by introducing syntax that allows to unambiguosly reference an
  7038  *       imply (by introducing syntax that allows to unambiguosly reference an
  6886  *       enumerated value - enum_type#enum_value) that in case the same identifier is used
  7039  *       enumerated value - enum_type#enum_value) that in case the same identifier is used
  6887  *       for a variable and an enumerated value, then the variable shall be
  7040  *       for a variable and an enumerated value, then the variable shall be
  6888  *       considered.
  7041  *       considered.
  6889  */
  7042  */
  6890 primary_expression:
  7043 non_negative_primary_expression:
  6891 /* constant */
       
  6892   non_negative_constant
  7044   non_negative_constant
  6893 //| enumerated_value_without_identifier
  7045 //| enumerated_value_without_identifier
  6894 | enumerated_value
  7046 | enumerated_value
  6895 | variable
  7047 | variable
  6896 | '(' expression ')'
  7048 | '(' expression ')'
  6899 /* ERROR_CHECK_BEGIN */
  7051 /* ERROR_CHECK_BEGIN */
  6900 | '(' expression error
  7052 | '(' expression error
  6901   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;}
  7053   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;}
  6902 /* ERROR_CHECK_END */
  7054 /* ERROR_CHECK_END */
  6903 ;
  7055 ;
       
  7056 
       
  7057 
       
  7058 primary_expression:
       
  7059   constant
       
  7060 //| enumerated_value_without_identifier
       
  7061   enumerated_value
       
  7062 | variable
       
  7063 | '(' expression ')'
       
  7064 	{$$ = $2;}
       
  7065 |  function_invocation
       
  7066 /* ERROR_CHECK_BEGIN */
       
  7067 | '(' expression error
       
  7068   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;}
       
  7069 /* ERROR_CHECK_END */
       
  7070 ;
       
  7071 
  6904 
  7072 
  6905 
  7073 
  6906 /* intermediate helper symbol for primary_expression */
  7074 /* intermediate helper symbol for primary_expression */
  6907 /* NOTE: function_name includes the standard function name 'NOT' !
  7075 /* NOTE: function_name includes the standard function name 'NOT' !
  6908  *       This introduces a reduce/reduce conflict, as NOT(var)
  7076  *       This introduces a reduce/reduce conflict, as NOT(var)
  7120 	{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));}
  7288 	{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));}
  7121 /*| variable_name SENDTO variable */
  7289 /*| variable_name SENDTO variable */
  7122 /*| any_identifier SENDTO variable */
  7290 /*| any_identifier SENDTO variable */
  7123 | sendto_identifier SENDTO variable
  7291 | sendto_identifier SENDTO variable
  7124 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
  7292 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
       
  7293 /* The following is not required, as the sendto_identifier_token returned by flex will 
       
  7294  * also include the 'ENO' identifier.
       
  7295  * The resulting abstract syntax tree is identical with or without this following rule,
       
  7296  * as both the eno_identifier and the sendto_identifier are stored as
       
  7297  * an identifier_c !!
       
  7298  */
       
  7299 /*
  7125 | eno_identifier SENDTO variable
  7300 | eno_identifier SENDTO variable
  7126 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
  7301 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
       
  7302 */
  7127 /*| NOT variable_name SENDTO variable */
  7303 /*| NOT variable_name SENDTO variable */
  7128 /*| NOT any_identifier SENDTO variable*/
  7304 /*| NOT any_identifier SENDTO variable*/
  7129 | NOT sendto_identifier SENDTO variable
  7305 | NOT sendto_identifier SENDTO variable
  7130 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
  7306 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
       
  7307 /* The following is not required, as the sendto_identifier_token returned by flex will 
       
  7308  * also include the 'ENO' identifier.
       
  7309  * The resulting abstract syntax tree is identical with or without this following rule,
       
  7310  * as both the eno_identifier and the sendto_identifier are stored as
       
  7311  * an identifier_c !!
       
  7312  */
       
  7313 /*
  7131 | NOT eno_identifier SENDTO variable
  7314 | NOT eno_identifier SENDTO variable
  7132 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
  7315 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
       
  7316 */
  7133 /* ERROR_CHECK_BEGIN */
  7317 /* ERROR_CHECK_BEGIN */
  7134 | any_identifier ASSIGN error
  7318 | any_identifier ASSIGN error
  7135   {$$ = NULL;
  7319   {$$ = NULL;
  7136 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
  7320 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
  7137 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
  7321 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
  7147   {$$ = NULL;
  7331   {$$ = NULL;
  7148 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  7332 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  7149 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  7333 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  7150 	 yyerrok;
  7334 	 yyerrok;
  7151 	}
  7335 	}
       
  7336 /*
  7152 | eno_identifier SENDTO error
  7337 | eno_identifier SENDTO error
  7153   {$$ = NULL;
  7338   {$$ = NULL;
  7154 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  7339 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  7155 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  7340 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  7156 	 yyerrok;
  7341 	 yyerrok;
  7157 	}
  7342 	}
       
  7343 */
  7158 | NOT SENDTO variable
  7344 | NOT SENDTO variable
  7159   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;}
  7345   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;}
  7160 | NOT error SENDTO variable
  7346 | NOT error SENDTO variable
  7161   {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;}
  7347   {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;}
  7162 | NOT sendto_identifier SENDTO error
  7348 | NOT sendto_identifier SENDTO error
  7163   {$$ = NULL;
  7349   {$$ = NULL;
  7164 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  7350 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  7165 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  7351 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  7166 	 yyerrok;
  7352 	 yyerrok;
  7167 	}
  7353 	}
       
  7354 /*
  7168 | NOT eno_identifier SENDTO error
  7355 | NOT eno_identifier SENDTO error
  7169   {$$ = NULL;
  7356   {$$ = NULL;
  7170 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  7357 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  7171 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  7358 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  7172 	 yyerrok;
  7359 	 yyerrok;
  7173 	}
  7360 	}
       
  7361 */
  7174 /* ERROR_CHECK_END */
  7362 /* ERROR_CHECK_END */
  7175 ;
  7363 ;
  7176 
  7364 
  7177 
  7365 
  7178 
  7366 
  7761     fclose(in_file);
  7949     fclose(in_file);
  7762     return -1;
  7950     return -1;
  7763   }
  7951   }
  7764 
  7952 
  7765   /* first parse the standard library file... */
  7953   /* first parse the standard library file... */
       
  7954   /*
       
  7955   #if YYDEBUG
       
  7956     yydebug = 1;
       
  7957   #endif
       
  7958   */
  7766   yyin = lib_file;
  7959   yyin = lib_file;
  7767   allow_function_overloading = true;
  7960   allow_function_overloading = true;
  7768   full_token_loc = full_token_loc_;
  7961   full_token_loc = full_token_loc_;
  7769   current_filename = libfilename;
  7962   current_filename = libfilename;
  7770   current_tracking = GetNewTracking(yyin);
  7963   current_tracking = GetNewTracking(yyin);
  7784   for(int i = 0; standard_function_block_names[i] != NULL; i++)
  7977   for(int i = 0; standard_function_block_names[i] != NULL; i++)
  7785     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
  7978     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
  7786         library_element_symtable.end_value())
  7979         library_element_symtable.end_value())
  7787       library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token);
  7980       library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token);
  7788 
  7981 
  7789 #if YYDEBUG
       
  7790   yydebug = 1;
       
  7791 #endif
       
  7792 
  7982 
  7793   /* now parse the input file... */
  7983   /* now parse the input file... */
       
  7984   #if YYDEBUG
       
  7985     yydebug = 1;
       
  7986   #endif
  7794   yyin = in_file;
  7987   yyin = in_file;
  7795   allow_function_overloading = false;
  7988   allow_function_overloading = false;
  7796   full_token_loc = full_token_loc_;
  7989   full_token_loc = full_token_loc_;
  7797   current_filename = filename;
  7990   current_filename = filename;
  7798   current_tracking = GetNewTracking(yyin);
  7991   current_tracking = GetNewTracking(yyin);