stage1_2/iec.y
changeset 131 f55ef301e14c
parent 121 9e8ce092e169
child 133 fff75b8283be
equal deleted inserted replaced
130:a8263f33123f 131:f55ef301e14c
   225  * This means that bison cannot handle it without some
   225  * This means that bison cannot handle it without some
   226  * caoxing from ourselves. We will then need this token
   226  * caoxing from ourselves. We will then need this token
   227  * to do the coaxing...
   227  * to do the coaxing...
   228  */
   228  */
   229 %token BOGUS_TOKEN_ID
   229 %token BOGUS_TOKEN_ID
   230 
       
   231 
   230 
   232 %type <leaf>	start
   231 %type <leaf>	start
   233 
   232 
   234 %type <leaf>	any_identifier
   233 %type <leaf>	any_identifier
   235 
   234 
   827 %type  <leaf>	action_time
   826 %type  <leaf>	action_time
   828 %type  <leaf>	indicator_name
   827 %type  <leaf>	indicator_name
   829 %type  <leaf>	transition
   828 %type  <leaf>	transition
   830 %type  <leaf>	steps
   829 %type  <leaf>	steps
   831 %type  <list>	step_name_list
   830 %type  <list>	step_name_list
       
   831 %type  <leaf>	transition_priority
   832 %type  <leaf>	transition_condition
   832 %type  <leaf>	transition_condition
   833 %type  <leaf>	action
   833 %type  <leaf>	action
   834 %type  <leaf>	transition_name
   834 %type  <leaf>	transition_name
   835 
   835 
   836 
   836 
  1380 prev_declared_derived_function_block_name: prev_declared_derived_function_block_name_token {$$ = new identifier_c($1, locloc(@$));};
  1380 prev_declared_derived_function_block_name: prev_declared_derived_function_block_name_token {$$ = new identifier_c($1, locloc(@$));};
  1381 prev_declared_program_type_name: prev_declared_program_type_name_token {$$ = new identifier_c($1, locloc(@$));};
  1381 prev_declared_program_type_name: prev_declared_program_type_name_token {$$ = new identifier_c($1, locloc(@$));};
  1382 
  1382 
  1383 
  1383 
  1384 
  1384 
  1385 
       
  1386 
       
  1387 /***************************/
  1385 /***************************/
  1388 /* B 0 - Programming Model */
  1386 /* B 0 - Programming Model */
  1389 /***************************/
  1387 /***************************/
  1390 library:
  1388 library:
  1391   /* empty */
  1389   /* empty */
  1396 | library library_element_declaration
  1394 | library library_element_declaration
  1397 	{$$ = $1; $$->add_element($2);}
  1395 	{$$ = $1; $$->add_element($2);}
  1398 /* ERROR_CHECK_BEGIN */
  1396 /* ERROR_CHECK_BEGIN */
  1399 | library error END_OF_INPUT
  1397 | library error END_OF_INPUT
  1400 	{$$ = NULL;
  1398 	{$$ = NULL;
  1401 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown error.");
  1399 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown syntax error.");
  1402 	 yyerrok;
  1400 	 yyerrok;
  1403 	}
  1401 	}
  1404 /* ERROR_CHECK_END */
  1402 /* ERROR_CHECK_END */
  1405 ;
  1403 ;
  1406 
  1404 
  1680 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1678 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1681 /* NOTE: see note in the definition of constant for reason
  1679 /* NOTE: see note in the definition of constant for reason
  1682  * why signed_integer, binary_integer, octal_integer
  1680  * why signed_integer, binary_integer, octal_integer
  1683  * and hex_integer are missing here!
  1681  * and hex_integer are missing here!
  1684  */
  1682  */
       
  1683 /* ERROR_CHECK_BEGIN */
       
  1684 | integer_type_name signed_integer
       
  1685 	{$$ = NULL;
       
  1686 	 yynerrs++;
       
  1687 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
       
  1688 	}
       
  1689 | integer_type_name binary_integer
       
  1690 	{$$ = NULL;
       
  1691 	 yynerrs++;
       
  1692 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
       
  1693 	}
       
  1694 | integer_type_name octal_integer
       
  1695 	{$$ = NULL;
       
  1696 	 yynerrs++;
       
  1697 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
       
  1698 	}
       
  1699 | integer_type_name hex_integer
       
  1700 	{$$ = NULL;
       
  1701 	 yynerrs++;
       
  1702 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
       
  1703 	}
       
  1704 | integer_type_name error signed_integer
       
  1705 	{$$ = NULL;
       
  1706 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
       
  1707 	 yyerrok;
       
  1708 	}
       
  1709 | integer_type_name error binary_integer
       
  1710 	{$$ = NULL;
       
  1711 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
       
  1712 	 yyerrok;
       
  1713 	}
       
  1714 | integer_type_name error octal_integer
       
  1715 	{$$ = NULL;
       
  1716 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
       
  1717 	 yyerrok;
       
  1718 	}
       
  1719 | integer_type_name error hex_integer
       
  1720 	{$$ = NULL;
       
  1721 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
       
  1722 	 yyerrok;
       
  1723 	}
       
  1724 | integer_type_name '#' error
       
  1725 	{$$ = NULL;
       
  1726 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for integer literal.");
       
  1727 	 yyerrok;
       
  1728 	}
       
  1729 /* ERROR_CHECK_END */
  1685 ;
  1730 ;
  1686 
  1731 
  1687 signed_integer:
  1732 signed_integer:
  1688   integer
  1733   integer
  1689 | '+' integer   {$$ = $2;}
  1734 | '+' integer   {$$ = $2;}
  1702 
  1747 
  1703 real_literal:
  1748 real_literal:
  1704   signed_real
  1749   signed_real
  1705 | real_type_name '#' signed_real
  1750 | real_type_name '#' signed_real
  1706 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
  1751 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
       
  1752 /* ERROR_CHECK_BEGIN */
       
  1753 | real_type_name signed_real
       
  1754 	{$$ = NULL;
       
  1755 	 yynerrs++;
       
  1756 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between real type name and value in real literal.");
       
  1757 	}
       
  1758 | real_type_name error signed_real
       
  1759 	{$$ = NULL;
       
  1760 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between real type name and value in real literal.");
       
  1761 	 yyerrok;
       
  1762 	}
       
  1763 | real_type_name '#' error
       
  1764 	{$$ = NULL;
       
  1765 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for real literal.");
       
  1766 	 yyerrok;
       
  1767 	}
       
  1768 /* ERROR_CHECK_END */
  1707 ;
  1769 ;
  1708 
  1770 
  1709 /* helper symbol for non_negative_numeric_literal */
  1771 /* helper symbol for non_negative_numeric_literal */
  1710 non_negative_real_literal:
  1772 non_negative_real_literal:
  1711   non_negative_signed_real
  1773   non_negative_signed_real
  1742 /* NOTE: see note under the B 1.2.1 section of token
  1804 /* NOTE: see note under the B 1.2.1 section of token
  1743  * and grouping type definition for reason why the use of
  1805  * and grouping type definition for reason why the use of
  1744  * bit_string_type_name, although seemingly incorrect, is
  1806  * bit_string_type_name, although seemingly incorrect, is
  1745  * really correct here!
  1807  * really correct here!
  1746  */
  1808  */
       
  1809 /* ERROR_CHECK_BEGIN */
       
  1810 | bit_string_type_name integer
       
  1811 	{$$ = NULL;
       
  1812 	 yynerrs++;
       
  1813 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
       
  1814 	}
       
  1815 | bit_string_type_name binary_integer
       
  1816 	{$$ = NULL;
       
  1817 	 yynerrs++;
       
  1818 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
       
  1819 	}
       
  1820 | bit_string_type_name octal_integer
       
  1821 	{$$ = NULL;
       
  1822 	 yynerrs++;
       
  1823 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
       
  1824 	}
       
  1825 | bit_string_type_name hex_integer
       
  1826 	{$$ = NULL;
       
  1827 	 yynerrs++;
       
  1828 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
       
  1829 	}
       
  1830 | bit_string_type_name error integer
       
  1831 	{$$ = NULL;
       
  1832 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
       
  1833 	 yyerrok;
       
  1834 	}
       
  1835 | bit_string_type_name error binary_integer
       
  1836 	{$$ = NULL;
       
  1837 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
       
  1838 	 yyerrok;
       
  1839 	}
       
  1840 | bit_string_type_name error octal_integer
       
  1841 	{$$ = NULL;
       
  1842 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
       
  1843 	 yyerrok;
       
  1844 	}
       
  1845 | bit_string_type_name error hex_integer
       
  1846 	{$$ = NULL;
       
  1847 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
       
  1848 	 yyerrok;
       
  1849 	}
       
  1850 | bit_string_type_name '#' error
       
  1851 	{$$ = NULL;
       
  1852 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for bit string literal.");
       
  1853 	 yyerrok;
       
  1854 	}
       
  1855 /* ERROR_CHECK_END */
  1747 ;
  1856 ;
  1748 
  1857 
  1749 
  1858 
  1750 boolean_literal:
  1859 boolean_literal:
  1751   TRUE	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1860   TRUE	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
  1840 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $4, locloc(@$));}
  1949 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $4, locloc(@$));}
  1841 | T_SHARP interval
  1950 | T_SHARP interval
  1842 	{$$ = new duration_c(NULL, $2, locloc(@$));}
  1951 	{$$ = new duration_c(NULL, $2, locloc(@$));}
  1843 | T_SHARP '-' interval
  1952 | T_SHARP '-' interval
  1844 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $3, locloc(@$));}
  1953 	{$$ = new duration_c(new neg_time_c(locloc(@$)), $3, locloc(@$));}
       
  1954 /* ERROR_CHECK_BEGIN */
       
  1955 | TIME interval
       
  1956 	{$$ = NULL;
       
  1957 	 yynerrs++;
       
  1958 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME' and interval in duration.");
       
  1959 	}
       
  1960 | TIME '-' interval
       
  1961 	{$$ = NULL;
       
  1962 	 yynerrs++;
       
  1963 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME' and interval in duration.");
       
  1964 	}
       
  1965 | TIME error interval
       
  1966 	{$$ = NULL;
       
  1967 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME' and interval in duration.");
       
  1968 	 yyerrok;
       
  1969 	}
       
  1970 | TIME error '-' interval
       
  1971 	{$$ = NULL;
       
  1972 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME' and interval in duration.");
       
  1973 	 yyerrok;
       
  1974 	}
       
  1975 | TIME '#' error
       
  1976 	{$$ = NULL;
       
  1977 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for duration.");
       
  1978 	 yyerrok;
       
  1979 	}
       
  1980 | T_SHARP error
       
  1981 	{$$ = NULL;
       
  1982 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid value for duration.");
       
  1983 	 yyerrok;
       
  1984 	}
       
  1985 /* ERROR_CHECK_END */
  1845 ;
  1986 ;
  1846 
  1987 
  1847 
  1988 
  1848 interval:
  1989 interval:
  1849   days
  1990   days
  1904 /*| integer ('d') ['_'] hours */
  2045 /*| integer ('d') ['_'] hours */
  1905 | integer_d hours
  2046 | integer_d hours
  1906 	{$$ = new days_c($1, $2, locloc(@$));}
  2047 	{$$ = new days_c($1, $2, locloc(@$));}
  1907 | integer_d '_' hours
  2048 | integer_d '_' hours
  1908 	{$$ = new days_c($1, $3, locloc(@$));}
  2049 	{$$ = new days_c($1, $3, locloc(@$));}
       
  2050 /* ERROR_CHECK_BEGIN */
       
  2051 | integer_d '_' error
       
  2052 	{$$ = NULL;
       
  2053 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for hours in duration.");
       
  2054 	 yyerrok;
       
  2055 	}
       
  2056 /* ERROR_CHECK_END */
  1909 ;
  2057 ;
  1910 
  2058 
  1911 
  2059 
  1912 hours:
  2060 hours:
  1913 /*  fixed_point ('h') */
  2061 /*  fixed_point ('h') */
  1916 /*| integer ('h') ['_'] minutes */
  2064 /*| integer ('h') ['_'] minutes */
  1917 | integer_h minutes
  2065 | integer_h minutes
  1918 	{$$ = new hours_c($1, $2, locloc(@$));}
  2066 	{$$ = new hours_c($1, $2, locloc(@$));}
  1919 | integer_h '_' minutes
  2067 | integer_h '_' minutes
  1920 	{$$ = new hours_c($1, $3, locloc(@$));}
  2068 	{$$ = new hours_c($1, $3, locloc(@$));}
       
  2069 /* ERROR_CHECK_BEGIN */
       
  2070 | integer_h '_' error
       
  2071 	{$$ = NULL;
       
  2072 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for minutes in duration.");
       
  2073 	 yyerrok;
       
  2074 	}
       
  2075 /* ERROR_CHECK_END */
       
  2076 
  1921 ;
  2077 ;
  1922 
  2078 
  1923 minutes:
  2079 minutes:
  1924 /*  fixed_point ('m') */
  2080 /*  fixed_point ('m') */
  1925   fixed_point_m
  2081   fixed_point_m
  1927 /*| integer ('m') ['_'] seconds */
  2083 /*| integer ('m') ['_'] seconds */
  1928 | integer_m seconds
  2084 | integer_m seconds
  1929 	{$$ = new minutes_c($1, $2, locloc(@$));}
  2085 	{$$ = new minutes_c($1, $2, locloc(@$));}
  1930 | integer_m '_' seconds
  2086 | integer_m '_' seconds
  1931 	{$$ = new minutes_c($1, $3, locloc(@$));}
  2087 	{$$ = new minutes_c($1, $3, locloc(@$));}
       
  2088 /* ERROR_CHECK_BEGIN */
       
  2089 | integer_m '_' error
       
  2090 	{$$ = NULL;
       
  2091 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for seconds in duration.");
       
  2092 	 yyerrok;
       
  2093 	}
       
  2094 /* ERROR_CHECK_END */
  1932 ;
  2095 ;
  1933 
  2096 
  1934 seconds:
  2097 seconds:
  1935 /*  fixed_point ('s') */
  2098 /*  fixed_point ('s') */
  1936   fixed_point_s
  2099   fixed_point_s
  1938 /*| integer ('s') ['_'] milliseconds */
  2101 /*| integer ('s') ['_'] milliseconds */
  1939 | integer_s milliseconds
  2102 | integer_s milliseconds
  1940 	{$$ = new seconds_c($1, $2, locloc(@$));}
  2103 	{$$ = new seconds_c($1, $2, locloc(@$));}
  1941 | integer_s '_' milliseconds
  2104 | integer_s '_' milliseconds
  1942 	{$$ = new seconds_c($1, $3, locloc(@$));}
  2105 	{$$ = new seconds_c($1, $3, locloc(@$));}
       
  2106 /* ERROR_CHECK_BEGIN */
       
  2107 | integer_s '_' error
       
  2108 	{$$ = NULL;
       
  2109 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for milliseconds in duration.");
       
  2110 	 yyerrok;
       
  2111 	}
       
  2112 /* ERROR_CHECK_END */
  1943 ;
  2113 ;
  1944 
  2114 
  1945 milliseconds:
  2115 milliseconds:
  1946 /*  fixed_point ('ms') */
  2116 /*  fixed_point ('ms') */
  1947   fixed_point_ms
  2117   fixed_point_ms
  1954 /* B 1.2.3.2 - Time of day and Date */
  2124 /* B 1.2.3.2 - Time of day and Date */
  1955 /************************************/
  2125 /************************************/
  1956 time_of_day:
  2126 time_of_day:
  1957   TIME_OF_DAY '#' daytime
  2127   TIME_OF_DAY '#' daytime
  1958 	{$$ = new time_of_day_c($3, locloc(@$));}
  2128 	{$$ = new time_of_day_c($3, locloc(@$));}
       
  2129 /* ERROR_CHECK_BEGIN */
       
  2130 | TIME_OF_DAY daytime
       
  2131 	{$$ = NULL;
       
  2132 	 yynerrs++;
       
  2133 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day.");
       
  2134 	}
       
  2135 | TIME_OF_DAY error daytime
       
  2136 	{$$ = NULL;
       
  2137 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME_OF_DAY' and daytime in time of day.");
       
  2138 	 yyerrok;
       
  2139 	}
       
  2140 | TIME_OF_DAY '#' error
       
  2141 	{$$ = NULL;
       
  2142 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for time of day.");
       
  2143 	 yyerrok;
       
  2144 	}
       
  2145 /* ERROR_CHECK_END */
  1959 ;
  2146 ;
  1960 
  2147 
  1961 
  2148 
  1962 daytime:
  2149 daytime:
  1963   day_hour ':' day_minute ':' day_second
  2150   day_hour ':' day_minute ':' day_second
  1964 	{$$ = new daytime_c($1, $3, $5, locloc(@$));}
  2151 	{$$ = new daytime_c($1, $3, $5, locloc(@$));}
       
  2152 /* ERROR_CHECK_BEGIN */
       
  2153 | day_hour day_minute ':' day_second
       
  2154   {$$ = NULL;
       
  2155 	 yynerrs++;
       
  2156 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between hours and minutes in daytime.");
       
  2157 	}
       
  2158 | day_hour error day_minute ':' day_second
       
  2159   {$$ = NULL;
       
  2160 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' between hours and minutes in daytime.");
       
  2161 	 yyerrok;
       
  2162 	}
       
  2163 | day_hour ':' ':' day_second
       
  2164 	{$$ = NULL;
       
  2165 	 yynerrs++;
       
  2166 	 print_err_msg(current_filename, locf(@2), locl(@3), "no minutes defined in daytime.");
       
  2167 	}
       
  2168 | day_hour ':' error ':' day_second
       
  2169 	{$$ = NULL;
       
  2170 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid value for minutes in daytime.");
       
  2171 	 yyerrok;
       
  2172 	}
       
  2173 | day_hour ':' day_minute day_second
       
  2174   {$$ = NULL;
       
  2175 	 yynerrs++;
       
  2176 	 print_err_msg(current_filename, locf(@3), locl(@4), "':' missing between minutes and seconds in daytime.");
       
  2177 	}
       
  2178 | day_hour ':' day_minute error day_second
       
  2179   {$$ = NULL;
       
  2180 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' between minutes and seconds in daytime.");
       
  2181 	 yyerrok;
       
  2182 	}
       
  2183 | day_hour ':' day_minute ':' error
       
  2184   {$$ = NULL;
       
  2185 	 print_err_msg(current_filename, locf(@4), locl(@4), "invalid value for seconds in daytime.");
       
  2186 	 yyerrok;
       
  2187 	}
       
  2188 /* ERROR_CHECK_END */
  1965 ;
  2189 ;
  1966 
  2190 
  1967 
  2191 
  1968 day_hour: integer;
  2192 day_hour: integer;
  1969 day_minute: integer;
  2193 day_minute: integer;
  1973 date:
  2197 date:
  1974   DATE '#' date_literal
  2198   DATE '#' date_literal
  1975 	{$$ = new date_c($3, locloc(@$));}
  2199 	{$$ = new date_c($3, locloc(@$));}
  1976 | D_SHARP date_literal
  2200 | D_SHARP date_literal
  1977 	{$$ = new date_c($2, locloc(@$));}
  2201 	{$$ = new date_c($2, locloc(@$));}
       
  2202 /* ERROR_CHECK_BEGIN */
       
  2203 | DATE date_literal
       
  2204 	{$$ = NULL;
       
  2205 	 yynerrs++;
       
  2206 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'DATE' and date literal in date.");
       
  2207 	}
       
  2208 | DATE error date_literal
       
  2209 	{$$ = NULL;
       
  2210 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'DATE' and date literal in date.");
       
  2211 	 yyerrok;
       
  2212 	}
       
  2213 | DATE '#' error
       
  2214 	{$$ = NULL;
       
  2215 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date.");
       
  2216 	 yyerrok;
       
  2217 	}
       
  2218 | D_SHARP error
       
  2219 	{$$ = NULL;
       
  2220 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date.");
       
  2221 	 yyerrok;
       
  2222 	}
       
  2223 /* ERROR_CHECK_END */
  1978 ;
  2224 ;
  1979 
  2225 
  1980 
  2226 
  1981 date_literal:
  2227 date_literal:
  1982   year '-' month '-' day
  2228   year '-' month '-' day
  1983 	{$$ = new date_literal_c($1, $3, $5, locloc(@$));}
  2229 	{$$ = new date_literal_c($1, $3, $5, locloc(@$));}
       
  2230 /* ERROR_CHECK_BEGIN */
       
  2231 | year month '-' day
       
  2232   {$$ = NULL;
       
  2233 	 yynerrs++;
       
  2234 	 print_err_msg(current_filename, locf(@1), locl(@2), "'-' missing between year and month in date literal.");
       
  2235 	}
       
  2236 | year error month '-' day
       
  2237   {$$ = NULL;
       
  2238 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '-' between year and month in date literal.");
       
  2239 	 yyerrok;
       
  2240 	}
       
  2241 | year '-' '-' day
       
  2242 	{$$ = NULL;
       
  2243 	 yynerrs++;
       
  2244 	 print_err_msg(current_filename, locf(@2), locl(@3), "no month defined in date literal.");
       
  2245 	}
       
  2246 | year '-' error '-' day
       
  2247 	{$$ = NULL;
       
  2248 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid value for month in date literal.");
       
  2249 	 yyerrok;
       
  2250 	}
       
  2251 | year '-' month day
       
  2252   {$$ = NULL;
       
  2253 	 yynerrs++;
       
  2254 	 print_err_msg(current_filename, locf(@3), locl(@4), "':' missing between month and day in date literal.");
       
  2255 	}
       
  2256 | year ':' month error day
       
  2257   {$$ = NULL;
       
  2258 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' between month and day in date literal.");
       
  2259 	 yyerrok;
       
  2260 	}
       
  2261 | year ':' month ':' error
       
  2262   {$$ = NULL;
       
  2263 	 print_err_msg(current_filename, locf(@4), locl(@4), "invalid value for day in date literal.");
       
  2264 	 yyerrok;
       
  2265 	}
       
  2266 /* ERROR_CHECK_END */
  1984 ;
  2267 ;
  1985 
  2268 
  1986 
  2269 
  1987 year: integer;
  2270 year: integer;
  1988 month: integer;
  2271 month: integer;
  1990 
  2273 
  1991 
  2274 
  1992 date_and_time:
  2275 date_and_time:
  1993   DATE_AND_TIME '#' date_literal '-' daytime
  2276   DATE_AND_TIME '#' date_literal '-' daytime
  1994 	{$$ = new date_and_time_c($3, $5, locloc(@$));}
  2277 	{$$ = new date_and_time_c($3, $5, locloc(@$));}
       
  2278 /* ERROR_CHECK_BEGIN */
       
  2279 | DATE_AND_TIME date_literal '-' daytime
       
  2280 	{$$ = NULL;
       
  2281 	 yynerrs++;
       
  2282 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time.");
       
  2283 	}
       
  2284 | DATE_AND_TIME error date_literal '-' daytime
       
  2285 	{$$ = NULL;
       
  2286 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'DATE_AND_TIME' and date literal in date and time.");
       
  2287 	 yyerrok;
       
  2288 	}
       
  2289 | DATE_AND_TIME '#' '-' daytime
       
  2290 	{$$ = NULL;
       
  2291 	 yynerrs++;
       
  2292 	 print_err_msg(current_filename, locf(@2), locl(@2), "no value defined for date literal in date and time.");
       
  2293 	}
       
  2294 | DATE_AND_TIME '#' error '-' daytime
       
  2295 	{$$ = NULL;
       
  2296 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date literal in date and time.");
       
  2297 	 yyerrok;
       
  2298 	}
       
  2299 | DATE_AND_TIME '#' date_literal daytime
       
  2300 	{$$ = NULL;
       
  2301 	 yynerrs++;
       
  2302 	 print_err_msg(current_filename, locf(@2), locl(@2), "'-' missing between date literal and daytime in date and time.");
       
  2303 	}
       
  2304 | DATE_AND_TIME '#' date_literal error daytime
       
  2305 	{$$ = NULL;
       
  2306 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting '-' between date literal and daytime in date and time.");
       
  2307 	 yyerrok;
       
  2308 	}
       
  2309 | DATE_AND_TIME '#' date_literal '-' error
       
  2310 	{$$ = NULL;
       
  2311 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for daytime in date and time.");
       
  2312 	 yyerrok;
       
  2313 	}
       
  2314 /* ERROR_CHECK_END */
  1995 ;
  2315 ;
  1996 
  2316 
  1997 
  2317 
  1998 
  2318 
  1999 
  2319 
  2153 */
  2473 */
  2154 
  2474 
  2155 data_type_declaration:
  2475 data_type_declaration:
  2156   TYPE type_declaration_list END_TYPE
  2476   TYPE type_declaration_list END_TYPE
  2157 	{$$ = new data_type_declaration_c($2, locloc(@$));}
  2477 	{$$ = new data_type_declaration_c($2, locloc(@$));}
       
  2478 /* ERROR_CHECK_BEGIN */
       
  2479 | TYPE END_TYPE
       
  2480 	{$$ = NULL;
       
  2481 	 yynerrs++;
       
  2482 	 print_err_msg(current_filename, locf(@1), locl(@2), "no data type declared in data type(s) declaration.");
       
  2483 	}
       
  2484 | TYPE error type_declaration_list END_TYPE
       
  2485 	{$$ = NULL;
       
  2486 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'TYPE' in data type(s) declaration.");
       
  2487 	 yyerrok;
       
  2488 	}
       
  2489 | TYPE error END_TYPE
       
  2490 	{$$ = NULL;
       
  2491 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in data type(s) declaration.");
       
  2492 	 yyerrok;
       
  2493 	}
       
  2494 /* ERROR_CHECK_END */
  2158 ;
  2495 ;
  2159 
  2496 
  2160 /* helper symbol for data_type_declaration */
  2497 /* helper symbol for data_type_declaration */
  2161 type_declaration_list:
  2498 type_declaration_list:
  2162   type_declaration ';'
  2499   type_declaration ';'
  2163 	{$$ = new type_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2500 	{$$ = new type_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2164 | type_declaration_list type_declaration ';'
  2501 | type_declaration_list type_declaration ';'
  2165 	{$$ = $1; $$->add_element($2);}
  2502 	{$$ = $1; $$->add_element($2);}
       
  2503 /* ERROR_CHECK_BEGIN */
       
  2504 | type_declaration error
       
  2505 	{$$ = NULL;
       
  2506 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of data type declaration.");
       
  2507 	 yyerrok;
       
  2508 	}
       
  2509 | type_declaration_list type_declaration error
       
  2510 	{$$ = NULL;
       
  2511 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of data type declaration.");
       
  2512 	 yyerrok;
       
  2513 	}
       
  2514 | type_declaration_list ';'
       
  2515 	{$$ = NULL;
       
  2516 	 yynerrs++;
       
  2517 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after data type declaration.");
       
  2518 	}
       
  2519 /* ERROR_CHECK_END */
  2166 ;
  2520 ;
  2167 
  2521 
  2168 type_declaration:
  2522 type_declaration:
  2169   single_element_type_declaration
  2523   single_element_type_declaration
  2170 | array_type_declaration
  2524 | array_type_declaration
  2182 /*  simple_type_name ':' simple_spec_init */
  2536 /*  simple_type_name ':' simple_spec_init */
  2183   identifier ':' simple_spec_init
  2537   identifier ':' simple_spec_init
  2184 	{$$ = new simple_type_declaration_c($1, $3, locloc(@$));
  2538 	{$$ = new simple_type_declaration_c($1, $3, locloc(@$));
  2185 	 library_element_symtable.insert($1, prev_declared_simple_type_name_token);
  2539 	 library_element_symtable.insert($1, prev_declared_simple_type_name_token);
  2186 	}
  2540 	}
       
  2541 /* ERROR_CHECK_BEGIN */
       
  2542 | identifier simple_spec_init
       
  2543 	{$$ = NULL;
       
  2544 	 yynerrs++;
       
  2545 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in simple type declaration.");
       
  2546 	}
       
  2547 | identifier ':' identifier
       
  2548 	{$$ = NULL;
       
  2549 	 yynerrs++;
       
  2550 	 print_err_msg(current_filename, locf(@3), locl(@3), "unknown data type defined in specification for data type declaration.");
       
  2551 	}
       
  2552 | identifier ':' error
       
  2553 	{$$ = NULL;
       
  2554 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in data type declaration.");
       
  2555 	 yyerrok;
       
  2556 	}
       
  2557 /* ERROR_CHECK_END */
  2187 ;
  2558 ;
  2188 
  2559 
  2189 
  2560 
  2190 simple_spec_init:
  2561 simple_spec_init:
  2191   simple_specification
  2562   simple_specification
  2200 */
  2571 */
  2201 | elementary_type_name ASSIGN constant
  2572 | elementary_type_name ASSIGN constant
  2202 	{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
  2573 	{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
  2203 | prev_declared_simple_type_name ASSIGN constant
  2574 | prev_declared_simple_type_name ASSIGN constant
  2204 	{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
  2575 	{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
       
  2576 /* ERROR_CHECK_BEGIN */
       
  2577 | elementary_type_name constant
       
  2578 	{$$ = NULL;
       
  2579 	 yynerrs++;
       
  2580 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in specification with initialization.");
       
  2581 	}
       
  2582 | prev_declared_simple_type_name constant
       
  2583 	{$$ = NULL;
       
  2584 	 yynerrs++;
       
  2585 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in specification with initialization.");
       
  2586 	}
       
  2587 | identifier ASSIGN constant
       
  2588 	{$$ = NULL;
       
  2589 	 yynerrs++;
       
  2590 	 print_err_msg(current_filename, locf(@1), locl(@1), "unknown type defined in specification.");
       
  2591 	}
       
  2592 /* ERROR_CHECK_END */
  2205 ;
  2593 ;
  2206 
  2594 
  2207 /* When converting to C/C++, we need to know whether
  2595 /* When converting to C/C++, we need to know whether
  2208  * the elementary_type_name is being used in a variable
  2596  * the elementary_type_name is being used in a variable
  2209  * declaration or elsewhere (ex. declaration of a derived
  2597  * declaration or elsewhere (ex. declaration of a derived
  2228 /*  subrange_type_name ':' subrange_spec_init */
  2616 /*  subrange_type_name ':' subrange_spec_init */
  2229   identifier ':' subrange_spec_init
  2617   identifier ':' subrange_spec_init
  2230 	{$$ = new subrange_type_declaration_c($1, $3, locloc(@$));
  2618 	{$$ = new subrange_type_declaration_c($1, $3, locloc(@$));
  2231 	 library_element_symtable.insert($1, prev_declared_subrange_type_name_token);
  2619 	 library_element_symtable.insert($1, prev_declared_subrange_type_name_token);
  2232 	}
  2620 	}
       
  2621 /* ERROR_CHECK_BEGIN */
       
  2622 | identifier subrange_spec_init
       
  2623 	{$$ = NULL;
       
  2624 	 yynerrs++;
       
  2625 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in subrange type declaration.");
       
  2626 	}
       
  2627 /* ERROR_CHECK_END */
  2233 ;
  2628 ;
  2234 
  2629 
  2235 subrange_spec_init:
  2630 subrange_spec_init:
  2236   subrange_specification
  2631   subrange_specification
  2237 	{$$ = new subrange_spec_init_c($1, NULL, locloc(@$));}
  2632 	{$$ = new subrange_spec_init_c($1, NULL, locloc(@$));}
  2238 | subrange_specification ASSIGN signed_integer
  2633 | subrange_specification ASSIGN signed_integer
  2239 	{$$ = new subrange_spec_init_c($1, $3, locloc(@$));}
  2634 	{$$ = new subrange_spec_init_c($1, $3, locloc(@$));}
       
  2635 /* ERROR_CHECK_BEGIN */
       
  2636 | subrange_specification signed_integer
       
  2637 	{$$ = NULL;
       
  2638 	 yynerrs++;
       
  2639 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in subrange specification with initialization.");
       
  2640 	}
       
  2641 /* ERROR_CHECK_END */
  2240 ;
  2642 ;
  2241 
  2643 
  2242 subrange_specification:
  2644 subrange_specification:
  2243   integer_type_name '(' subrange')'
  2645   integer_type_name '(' subrange ')'
  2244 	{$$ = new subrange_specification_c($1, $3, locloc(@$));}
  2646 	{$$ = new subrange_specification_c($1, $3, locloc(@$));}
  2245 | prev_declared_subrange_type_name
  2647 | prev_declared_subrange_type_name
  2246   {$$ = new subrange_specification_c($1, NULL, locloc(@$));}
  2648   {$$ = new subrange_specification_c($1, NULL, locloc(@$));}
       
  2649 /* ERROR_CHECK_BEGIN */
       
  2650 | integer_type_name '(' ')'
       
  2651 	{$$ = NULL;
       
  2652 	 yynerrs++;
       
  2653 	 print_err_msg(current_filename, locf(@2), locl(@3), "no subrange defined in subrange specification.");
       
  2654 	}
       
  2655 | integer_type_name '(' error ')'
       
  2656 	{$$ = NULL;
       
  2657 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid subrange defined in subrange specification.");
       
  2658 	 yyerrok;
       
  2659 	}
       
  2660 | integer_type_name '(' subrange error
       
  2661 	{$$ = NULL;
       
  2662 	 print_err_msg(current_filename, locf(@3), locl(@3), "')' missing after subrange defined in subrange specification.");
       
  2663 	 yyerrok;
       
  2664 	}
       
  2665 /* ERROR_CHECK_END */
  2247 ;
  2666 ;
  2248 
  2667 
  2249 
  2668 
  2250 subrange:
  2669 subrange:
  2251   signed_integer DOTDOT signed_integer
  2670   signed_integer DOTDOT signed_integer
  2252 	{$$ = new subrange_c($1, $3, locloc(@$));}
  2671 	{$$ = new subrange_c($1, $3, locloc(@$));}
       
  2672 /* ERROR_CHECK_BEGIN */
       
  2673 | signed_integer signed_integer
       
  2674 	{$$ = NULL;
       
  2675 	 yynerrs++;
       
  2676 	 print_err_msg(current_filename, locf(@1), locl(@2), "'..' missing between bounds in subrange definition.");
       
  2677 	}
       
  2678 | signed_integer error signed_integer
       
  2679 	{$$ = NULL;
       
  2680 	 yynerrs++;
       
  2681 	 print_err_msg(current_filename, locf(@1), locl(@2), "expecting '..' between bounds in subrange definition.");
       
  2682 	}
       
  2683 | signed_integer DOTDOT error
       
  2684 	{$$ = NULL;
       
  2685 	 yynerrs++;
       
  2686 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid value for upper bound in subrange definition.");
       
  2687 	}
       
  2688 /* ERROR_CHECK_END */
  2253 ;
  2689 ;
  2254 
  2690 
  2255 enumerated_type_declaration:
  2691 enumerated_type_declaration:
  2256 /*  enumerated_type_name ':' enumerated_spec_init */
  2692 /*  enumerated_type_name ':' enumerated_spec_init */
  2257   identifier ':' enumerated_spec_init
  2693   identifier ':' enumerated_spec_init
  2258 	{$$ = new enumerated_type_declaration_c($1, $3, locloc(@$));
  2694 	{$$ = new enumerated_type_declaration_c($1, $3, locloc(@$));
  2259 	 library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);
  2695 	 library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);
  2260 	}
  2696 	}
       
  2697 /* ERROR_CHECK_BEGIN */
       
  2698 | identifier enumerated_spec_init
       
  2699 	{$$ = NULL;
       
  2700 	 yynerrs++;
       
  2701 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in enumerated type declaration.");
       
  2702 	}
       
  2703 /* ERROR_CHECK_END */
  2261 ;
  2704 ;
  2262 
  2705 
  2263 
  2706 
  2264 enumerated_spec_init:
  2707 enumerated_spec_init:
  2265   enumerated_specification
  2708   enumerated_specification
  2266 	{$$ = new enumerated_spec_init_c($1, NULL, locloc(@$));}
  2709 	{$$ = new enumerated_spec_init_c($1, NULL, locloc(@$));}
  2267 | enumerated_specification ASSIGN enumerated_value
  2710 | enumerated_specification ASSIGN enumerated_value
  2268 	{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));}
  2711 	{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));}
       
  2712 /* ERROR_CHECK_BEGIN */
       
  2713 | enumerated_specification enumerated_value
       
  2714 	{$$ = NULL;
       
  2715 	 yynerrs++;
       
  2716 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in enumerated specification with initialization.");
       
  2717 	}
       
  2718 /* ERROR_CHECK_END */
  2269 ;
  2719 ;
  2270 
  2720 
  2271 enumerated_specification:
  2721 enumerated_specification:
  2272   '(' enumerated_value_list ')'
  2722   '(' enumerated_value_list ')'
  2273 	{$$ = $2;}
  2723 	{$$ = $2;}
  2274 | prev_declared_enumerated_type_name
  2724 | prev_declared_enumerated_type_name
       
  2725 /* ERROR_CHECK_BEGIN */
       
  2726 | '(' ')'
       
  2727 	{$$ = NULL;
       
  2728 	 yynerrs++;
       
  2729 	 print_err_msg(current_filename, locf(@1), locl(@2), "no enumerated value list defined in enumerated specification.");
       
  2730 	}
       
  2731 | '(' error ')'
       
  2732 	{$$ = NULL;
       
  2733 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid enumerated value list defined in enumerated specification.");
       
  2734 	 yyerrok;
       
  2735 	}
       
  2736 | '(' enumerated_value_list error
       
  2737 	{$$ = NULL;
       
  2738 	 print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of enumerated specification.");
       
  2739 	 yyerrok;
       
  2740 	}
       
  2741 /* ERROR_CHECK_END */
  2275 ;
  2742 ;
  2276 
  2743 
  2277 /* helper symbol for enumerated_specification */
  2744 /* helper symbol for enumerated_specification */
  2278 enumerated_value_list:
  2745 enumerated_value_list:
  2279   enumerated_value
  2746   enumerated_value
  2280 	{$$ = new enumerated_value_list_c(locloc(@$)); $$->add_element($1);}
  2747 	{$$ = new enumerated_value_list_c(locloc(@$)); $$->add_element($1);}
  2281 | enumerated_value_list ',' enumerated_value
  2748 | enumerated_value_list ',' enumerated_value
  2282 	{$$ = $1; $$->add_element($3);}
  2749 	{$$ = $1; $$->add_element($3);}
       
  2750 /* ERROR_CHECK_BEGIN */
       
  2751 | enumerated_value_list enumerated_value
       
  2752 	{$$ = NULL;
       
  2753 	 yynerrs++;
       
  2754 	 print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in enumerated value list.");
       
  2755 	}
       
  2756 | enumerated_value_list ',' error
       
  2757 	{$$ = NULL;
       
  2758 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid value in enumerated value list.");
       
  2759 	 yyerrok;
       
  2760 	}
       
  2761 /* ERROR_CHECK_END */
  2283 ;
  2762 ;
  2284 
  2763 
  2285 
  2764 
  2286 enumerated_value:
  2765 enumerated_value:
  2287   identifier 
  2766   identifier 
  2288   {$$ = new enumerated_value_c(NULL, $1, locloc(@$));}
  2767   {$$ = new enumerated_value_c(NULL, $1, locloc(@$));}
  2289 | prev_declared_enumerated_type_name '#' any_identifier
  2768 | prev_declared_enumerated_type_name '#' any_identifier
  2290 	{$$ = new enumerated_value_c($1, $3, locloc(@$));}
  2769 	{$$ = new enumerated_value_c($1, $3, locloc(@$));}
       
  2770 /* ERROR_CHECK_BEGIN */
       
  2771 | prev_declared_enumerated_type_name any_identifier
       
  2772 	{$$ = NULL;
       
  2773 	 yynerrs++;
       
  2774 	 print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between enumerated type name and value in enumerated literal.");
       
  2775 	}
       
  2776 | prev_declared_enumerated_type_name error any_identifier
       
  2777 	{$$ = NULL;
       
  2778 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between enumerated type name and value in enumerated literal.");
       
  2779 	 yyerrok;
       
  2780 	}
       
  2781 | prev_declared_enumerated_type_name '#' error
       
  2782 	{$$ = NULL;
       
  2783 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for enumerated literal.");
       
  2784 	 yyerrok;
       
  2785 	}
       
  2786 | identifier '#' any_identifier
       
  2787 	{$$ = NULL;
       
  2788 	 yynerrs++;
       
  2789 	 print_err_msg(current_filename, locf(@1), locl(@1), "unknown type name for typed literal.");
       
  2790 	}
       
  2791 /* ERROR_CHECK_END */
  2291 ;
  2792 ;
  2292 
  2793 
  2293 
  2794 
  2294 /*
  2795 /*
  2295 enumerated_value_without_identifier:
  2796 enumerated_value_without_identifier:
  2303 /*  array_type_name ':' array_spec_init */
  2804 /*  array_type_name ':' array_spec_init */
  2304   identifier ':' array_spec_init
  2805   identifier ':' array_spec_init
  2305 	{$$ = new array_type_declaration_c($1, $3, locloc(@$));
  2806 	{$$ = new array_type_declaration_c($1, $3, locloc(@$));
  2306 	 library_element_symtable.insert($1, prev_declared_array_type_name_token);
  2807 	 library_element_symtable.insert($1, prev_declared_array_type_name_token);
  2307 	}
  2808 	}
       
  2809 /* ERROR_CHECK_BEGIN */
       
  2810 | identifier array_spec_init
       
  2811 	{$$ = NULL;
       
  2812 	 yynerrs++;
       
  2813 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in array type declaration.");
       
  2814 	}
       
  2815 /* ERROR_CHECK_END */
  2308 ;
  2816 ;
  2309 
  2817 
  2310 array_spec_init:
  2818 array_spec_init:
  2311   array_specification
  2819   array_specification
  2312 	{$$ = new array_spec_init_c($1, NULL, locloc(@$));}
  2820 	{$$ = new array_spec_init_c($1, NULL, locloc(@$));}
  2313 | array_specification ASSIGN array_initialization
  2821 | array_specification ASSIGN array_initialization
  2314 	{$$ = new array_spec_init_c($1, $3, locloc(@$));}
  2822 	{$$ = new array_spec_init_c($1, $3, locloc(@$));}
       
  2823 /* ERROR_CHECK_BEGIN */
       
  2824 | array_specification array_initialization
       
  2825 	{$$ = NULL;
       
  2826 	 yynerrs++;
       
  2827 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in array specification with initialization.");
       
  2828 	}
       
  2829 /* ERROR_CHECK_END */
  2315 ;
  2830 ;
  2316 
  2831 
  2317 
  2832 
  2318 array_specification:
  2833 array_specification:
  2319   prev_declared_array_type_name
  2834   prev_declared_array_type_name
  2320 | ARRAY '[' array_subrange_list ']' OF non_generic_type_name
  2835 | ARRAY '[' array_subrange_list ']' OF non_generic_type_name
  2321 	{$$ = new array_specification_c($3, $6, locloc(@$));}
  2836 	{$$ = new array_specification_c($3, $6, locloc(@$));}
       
  2837 /* ERROR_CHECK_BEGIN */
       
  2838 | ARRAY array_subrange_list ']' OF non_generic_type_name
       
  2839 	{$$ = NULL;
       
  2840 	 yynerrs++;
       
  2841 	 print_err_msg(current_filename, locf(@1), locl(@2), "'[' missing before subrange list in array specification.");
       
  2842 	}
       
  2843 | ARRAY error array_subrange_list ']' OF non_generic_type_name
       
  2844 	{$$ = NULL;
       
  2845 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '[' after 'ARRAY' in array specification.");
       
  2846 	 yyerrok;
       
  2847 	}
       
  2848 | ARRAY '[' ']' OF non_generic_type_name
       
  2849 	{$$ = NULL;
       
  2850 	 yynerrs++;
       
  2851 	 print_err_msg(current_filename, locf(@2), locl(@3), "no subrange list defined in array specification.");
       
  2852 	}
       
  2853 | ARRAY '[' error ']' OF non_generic_type_name
       
  2854 	{$$ = NULL;
       
  2855 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid subrange list defined in array specification.");
       
  2856 	 yyerrok;
       
  2857 	}
       
  2858 | ARRAY OF non_generic_type_name
       
  2859 	{$$ = NULL;
       
  2860 	 yynerrs++;
       
  2861 	 print_err_msg(current_filename, locf(@1), locl(@2), "no subrange list defined in array specification.");
       
  2862 	}
       
  2863 | ARRAY error OF non_generic_type_name
       
  2864 	{$$ = NULL;
       
  2865 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid subrange list defined in array specification.");
       
  2866 	 yyerrok;
       
  2867 	}
       
  2868 | ARRAY '[' array_subrange_list OF non_generic_type_name
       
  2869 	{$$ = NULL;
       
  2870 	 yynerrs++;
       
  2871 	 print_err_msg(current_filename, locf(@3), locl(@4), "']' missing after subrange list in array specification.");
       
  2872 	}
       
  2873 | ARRAY '[' array_subrange_list error OF non_generic_type_name
       
  2874 	{$$ = NULL;
       
  2875 	 yynerrs++;
       
  2876 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting '[' after subrange list in array specification.");
       
  2877 	}
       
  2878 | ARRAY '[' array_subrange_list ']' non_generic_type_name
       
  2879 	{$$ = NULL;
       
  2880 	 yynerrs++;
       
  2881 	 print_err_msg(current_filename, locf(@4), locl(@5), "'OF' missing between subrange list and item type name in array specification.");
       
  2882 	}
       
  2883 | ARRAY '[' array_subrange_list ']' error non_generic_type_name
       
  2884 	{$$ = NULL;
       
  2885 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'OF' between subrange list and item type name in array specification.");
       
  2886 	 yyerrok;
       
  2887 	}
       
  2888 | ARRAY '[' array_subrange_list ']' OF error
       
  2889 	{$$ = NULL;
       
  2890 	 print_err_msg(current_filename, locf(@1), locl(@3), "no itme data type defined in array specification.");
       
  2891 	 yyerrok;
       
  2892 	}
       
  2893 /* ERROR_CHECK_END */
  2322 ;
  2894 ;
  2323 
  2895 
  2324 /* helper symbol for array_specification */
  2896 /* helper symbol for array_specification */
  2325 array_subrange_list:
  2897 array_subrange_list:
  2326   subrange
  2898   subrange
  2327 	{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);}
  2899 	{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);}
  2328 | array_subrange_list ',' subrange
  2900 | array_subrange_list ',' subrange
  2329 	{$$ = $1; $$->add_element($3);}
  2901 	{$$ = $1; $$->add_element($3);}
       
  2902 /* ERROR_CHECK_BEGIN */
       
  2903 | array_subrange_list subrange
       
  2904 	{$$ = NULL;
       
  2905 	 yynerrs++;
       
  2906 	 print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in subrange list.");
       
  2907 	}
       
  2908 | array_subrange_list ',' error
       
  2909 	{$$ = NULL;
       
  2910 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid subrange in subrange list.");
       
  2911 	 yyerrok;
       
  2912 	}
       
  2913 /* ERROR_CHECK_END */
  2330 ;
  2914 ;
  2331 
  2915 
  2332 
  2916 
  2333 array_initialization:
  2917 array_initialization:
  2334   '[' array_initial_elements_list ']'
  2918   '[' array_initial_elements_list ']'
  2335 	{$$ = $2;}
  2919 	{$$ = $2;}
       
  2920 /* ERROR_CHECK_BEGIN */
       
  2921 | '[' ']'
       
  2922 	{$$ = NULL;
       
  2923 	 yynerrs++;
       
  2924 	 print_err_msg(current_filename, locf(@1), locl(@2), "no initial values list defined in array initialization.");
       
  2925 	}
       
  2926 | '[' error ']'
       
  2927 	{$$ = NULL;
       
  2928 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid initial values list defined in array initialization.");
       
  2929 	 yyerrok;
       
  2930 	}
       
  2931 | '[' array_initial_elements_list error
       
  2932 	{$$ = NULL;
       
  2933 	 print_err_msg(current_filename, locf(@1), locl(@2), "']' missing at the end of array initialization.");
       
  2934 	 yyerrok;
       
  2935 	}
       
  2936 /* ERROR_CHECK_END */
  2336 ;
  2937 ;
  2337 
  2938 
  2338 
  2939 
  2339 /* helper symbol for array_initialization */
  2940 /* helper symbol for array_initialization */
  2340 array_initial_elements_list:
  2941 array_initial_elements_list:
  2341   array_initial_elements
  2942   array_initial_elements
  2342 	{$$ = new array_initial_elements_list_c(locloc(@$)); $$->add_element($1);}
  2943 	{$$ = new array_initial_elements_list_c(locloc(@$)); $$->add_element($1);}
  2343 | array_initial_elements_list ',' array_initial_elements
  2944 | array_initial_elements_list ',' array_initial_elements
  2344 	{$$ = $1; $$->add_element($3);}
  2945 	{$$ = $1; $$->add_element($3);}
       
  2946 /* ERROR_CHECK_BEGIN 
       
  2947 | array_initial_elements_list ',' error
       
  2948 	{$$ = NULL;
       
  2949 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid array initial value in array initial values list.");
       
  2950 	 yyerrok;
       
  2951 	}
       
  2952 /* ERROR_CHECK_END */
  2345 ;
  2953 ;
  2346 
  2954 
  2347 
  2955 
  2348 array_initial_elements:
  2956 array_initial_elements:
  2349   array_initial_element
  2957   array_initial_element
  2350 | integer '(' ')'
  2958 | integer '(' ')'
  2351 | integer '(' array_initial_element ')'
  2959 | integer '(' array_initial_element ')'
  2352 	{$$ = new array_initial_elements_c($1, $3, locloc(@$));}
  2960 	{$$ = new array_initial_elements_c($1, $3, locloc(@$));}
       
  2961 /* ERROR_CHECK_BEGIN 
       
  2962 | integer '(' error ')'
       
  2963 	{$$ = NULL;
       
  2964 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid array initial value in array initial values list.");
       
  2965 	 yyerrok;
       
  2966 	}
       
  2967 | integer '(' array_initial_element error
       
  2968 	{$$ = NULL;
       
  2969 	 print_err_msg(current_filename, locf(@2), locl(@4), "')' missing at the end of array initial value in array initial values list.");
       
  2970 	 yyerrok;
       
  2971 	}
       
  2972 /* ERROR_CHECK_END */
  2353 ;
  2973 ;
  2354 
  2974 
  2355 
  2975 
  2356 array_initial_element:
  2976 array_initial_element:
  2357   constant
  2977   constant
  2366 /*  structure_type_name ':' structure_specification */
  2986 /*  structure_type_name ':' structure_specification */
  2367   identifier ':' structure_specification
  2987   identifier ':' structure_specification
  2368 	{$$ = new structure_type_declaration_c($1, $3, locloc(@$));
  2988 	{$$ = new structure_type_declaration_c($1, $3, locloc(@$));
  2369 	 library_element_symtable.insert($1, prev_declared_structure_type_name_token);
  2989 	 library_element_symtable.insert($1, prev_declared_structure_type_name_token);
  2370 	}
  2990 	}
       
  2991 /* ERROR_CHECK_BEGIN */
       
  2992 | identifier structure_specification
       
  2993 	{$$ = NULL;
       
  2994 	 yynerrs++;
       
  2995 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in structure type declaration.");
       
  2996 	}
       
  2997 /* ERROR_CHECK_END */
  2371 ;
  2998 ;
  2372 
  2999 
  2373 
  3000 
  2374 structure_specification:
  3001 structure_specification:
  2375   structure_declaration
  3002   structure_declaration
  2380 initialized_structure:
  3007 initialized_structure:
  2381   prev_declared_structure_type_name
  3008   prev_declared_structure_type_name
  2382 	{$$ = new initialized_structure_c($1, NULL, locloc(@$));}
  3009 	{$$ = new initialized_structure_c($1, NULL, locloc(@$));}
  2383 | prev_declared_structure_type_name ASSIGN structure_initialization
  3010 | prev_declared_structure_type_name ASSIGN structure_initialization
  2384 	{$$ = new initialized_structure_c($1, $3, locloc(@$));}
  3011 	{$$ = new initialized_structure_c($1, $3, locloc(@$));}
       
  3012 /* ERROR_CHECK_BEGIN */
       
  3013 | prev_declared_structure_type_name structure_initialization
       
  3014 	{$$ = NULL;
       
  3015 	 yynerrs++;
       
  3016 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structure specification with initialization.");
       
  3017 	}
       
  3018 | identifier ASSIGN structure_initialization
       
  3019 	{$$ = NULL;
       
  3020 	 yynerrs++;
       
  3021 	 print_err_msg(current_filename, locf(@1), locl(@2), "unknown type name for structure specification with initialization.");
       
  3022 	}
       
  3023 /* ERROR_CHECK_END */
  2385 ;
  3024 ;
  2386 
  3025 
  2387 
  3026 
  2388 structure_declaration:
  3027 structure_declaration:
  2389   STRUCT structure_element_declaration_list END_STRUCT
  3028   STRUCT structure_element_declaration_list END_STRUCT
  2390 	{$$ = $2;}
  3029 	{$$ = $2;}
       
  3030 /* ERROR_CHECK_BEGIN */
       
  3031 | STRUCT END_STRUCT
       
  3032 	{$$ = NULL;
       
  3033 	 yynerrs++;
       
  3034 	 print_err_msg(current_filename, locf(@1), locl(@2), "no structure element declared in structure type declaration.");
       
  3035 	}
       
  3036 | STRUCT error structure_element_declaration_list END_STRUCT
       
  3037 	{$$ = NULL;
       
  3038 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'STRUCT' in structure type declaration.");
       
  3039 	 yyerrok;
       
  3040 	}
       
  3041 | STRUCT error END_STRUCT
       
  3042 	{$$ = NULL;
       
  3043 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in structure type declaration.");
       
  3044 	 yyerrok;
       
  3045 	}
       
  3046 /* ERROR_CHECK_END */
  2391 ;
  3047 ;
  2392 
  3048 
  2393 /* helper symbol for structure_declaration */
  3049 /* helper symbol for structure_declaration */
  2394 structure_element_declaration_list:
  3050 structure_element_declaration_list:
  2395   structure_element_declaration ';'
  3051   structure_element_declaration ';'
  2396 	{$$ = new structure_element_declaration_list_c(locloc(@$)); $$->add_element($1);}
  3052 	{$$ = new structure_element_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2397 | structure_element_declaration_list structure_element_declaration ';'
  3053 | structure_element_declaration_list structure_element_declaration ';'
  2398 	{$$ = $1; $$->add_element($2);}
  3054 	{$$ = $1; $$->add_element($2);}
       
  3055 /* ERROR_CHECK_BEGIN */
       
  3056 | structure_element_declaration error
       
  3057 	{$$ = NULL;
       
  3058 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of structure element declaration.");
       
  3059 	 yyerrok;
       
  3060 	}
       
  3061 | structure_element_declaration_list structure_element_declaration error
       
  3062 	{$$ = NULL;
       
  3063 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of structure element declaration.");
       
  3064 	 yyerrok;
       
  3065 	}
       
  3066 | structure_element_declaration_list ';'
       
  3067 	{$$ = NULL;
       
  3068 	 yynerrs++;
       
  3069 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after structure element declaration.");
       
  3070 	}
       
  3071 /* ERROR_CHECK_END */
  2399 ;
  3072 ;
  2400 
  3073 
  2401 
  3074 
  2402 structure_element_declaration:
  3075 structure_element_declaration:
  2403   structure_element_name ':' simple_spec_init
  3076   structure_element_name ':' simple_spec_init
  2408 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
  3081 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
  2409 | structure_element_name ':' array_spec_init
  3082 | structure_element_name ':' array_spec_init
  2410 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
  3083 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
  2411 | structure_element_name ':' initialized_structure
  3084 | structure_element_name ':' initialized_structure
  2412 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
  3085 	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
       
  3086 /* ERROR_CHECK_BEGIN */
       
  3087 | structure_element_name simple_spec_init
       
  3088 	{$$ = NULL;
       
  3089 	 yynerrs++;
       
  3090 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and simple specification.");
       
  3091 	}
       
  3092 | structure_element_name subrange_spec_init
       
  3093 	{$$ = NULL;
       
  3094 	 yynerrs++;
       
  3095 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and subrange specification.");
       
  3096 	}
       
  3097 | structure_element_name enumerated_spec_init
       
  3098 	{$$ = NULL;
       
  3099 	 yynerrs++;
       
  3100 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and enumerated specification.");
       
  3101 	}
       
  3102 | structure_element_name array_spec_init
       
  3103 	{$$ = NULL;
       
  3104 	 yynerrs++;
       
  3105 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and array specification.");
       
  3106 	}
       
  3107 | structure_element_name initialized_structure
       
  3108 	{$$ = NULL;
       
  3109 	 yynerrs++;
       
  3110 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and structure specification.");
       
  3111 	}
       
  3112 | structure_element_name ':' identifier
       
  3113 	{$$ = NULL;
       
  3114 	 yynerrs++;
       
  3115 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown variable type defined in structure element declaration.");
       
  3116 	}
       
  3117 | structure_element_name ':' error
       
  3118 	{$$ = NULL;
       
  3119 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in structure element declaration.");
       
  3120 	 yyerrok;
       
  3121 	}
       
  3122 /* ERROR_CHECK_END */
  2413 ;
  3123 ;
  2414 
  3124 
  2415 
  3125 
  2416 structure_element_name: any_identifier;
  3126 structure_element_name: any_identifier;
  2417 
  3127 
  2418 
  3128 
  2419 structure_initialization:
  3129 structure_initialization:
  2420   '(' structure_element_initialization_list ')'
  3130   '(' structure_element_initialization_list ')'
  2421 	{$$ = $2;}
  3131 	{$$ = $2;}
       
  3132 /* ERROR_CHECK_BEGIN */
       
  3133 | '(' error ')'
       
  3134 	{$$ = NULL;
       
  3135 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid structure element initialization list in structure initialization.");
       
  3136 	 yyerrok;
       
  3137 	}
       
  3138 | '(' structure_element_initialization_list error
       
  3139 	{$$ = NULL;
       
  3140 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting ')' at the end of structure element initialization list in structure initialization.");
       
  3141 	 yyerrok;
       
  3142 	}
       
  3143 /* ERROR_CHECK_END */
  2422 ;
  3144 ;
  2423 
  3145 
  2424 /* helper symbol for structure_initialization */
  3146 /* helper symbol for structure_initialization */
  2425 structure_element_initialization_list:
  3147 structure_element_initialization_list:
  2426   structure_element_initialization
  3148   structure_element_initialization
  2427 	{$$ = new structure_element_initialization_list_c(locloc(@$)); $$->add_element($1);}
  3149 	{$$ = new structure_element_initialization_list_c(locloc(@$)); $$->add_element($1);}
  2428 | structure_element_initialization_list ',' structure_element_initialization
  3150 | structure_element_initialization_list ',' structure_element_initialization
  2429 	{$$ = $1; $$->add_element($3);}
  3151 	{$$ = $1; $$->add_element($3);}
       
  3152 /* ERROR_CHECK_BEGIN 
       
  3153 | structure_element_initialization_list structure_element_initialization
       
  3154 	{$$ = NULL;
       
  3155 	 yynerrs++;
       
  3156 	 print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in structure element initialization list in structure initialization.");
       
  3157 	}
       
  3158 | structure_element_initialization_list ',' error
       
  3159 	{$$ = NULL;
       
  3160 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid structure element initialization in structure initialization.");
       
  3161 	 yyerrok;
       
  3162 	}
       
  3163 /* ERROR_CHECK_END */
  2430 ;
  3164 ;
  2431 
  3165 
  2432 
  3166 
  2433 structure_element_initialization:
  3167 structure_element_initialization:
  2434   structure_element_name ASSIGN constant
  3168   structure_element_name ASSIGN constant
  2437 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
  3171 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
  2438 | structure_element_name ASSIGN array_initialization
  3172 | structure_element_name ASSIGN array_initialization
  2439 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
  3173 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
  2440 | structure_element_name ASSIGN structure_initialization
  3174 | structure_element_name ASSIGN structure_initialization
  2441 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
  3175 	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
       
  3176 /* ERROR_CHECK_BEGIN */
       
  3177 | structure_element_name constant
       
  3178 	{$$ = NULL;
       
  3179 	 yynerrs++;
       
  3180 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structure element initialization.");
       
  3181 	}
       
  3182 | structure_element_name enumerated_value
       
  3183 	{$$ = NULL;
       
  3184 	 yynerrs++;
       
  3185 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in enumerated structure element initialization.");
       
  3186 	}
       
  3187 | structure_element_name array_initialization
       
  3188 	{$$ = NULL;
       
  3189 	 yynerrs++;
       
  3190 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in array structure element initialization.");
       
  3191 	}
       
  3192 | structure_element_name structure_initialization
       
  3193 	{$$ = NULL;
       
  3194 	 yynerrs++;
       
  3195 	 print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structured structure element initialization.");
       
  3196 	}
       
  3197 /* ERROR_CHECK_END */
  2442 ;
  3198 ;
  2443 
  3199 
  2444 /* NOTE: in order to remove a reduce/reduce conflict,
  3200 /* NOTE: in order to remove a reduce/reduce conflict,
  2445  *       all occurences of string_type_name
  3201  *       all occurences of string_type_name
  2446  *       have been replaced with identifier!
  3202  *       have been replaced with identifier!
  2642 | VAR_INPUT RETAIN     input_declaration_list END_VAR
  3398 | VAR_INPUT RETAIN     input_declaration_list END_VAR
  2643 	{$$ = new input_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3399 	{$$ = new input_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  2644 | VAR_INPUT NON_RETAIN input_declaration_list END_VAR
  3400 | VAR_INPUT NON_RETAIN input_declaration_list END_VAR
  2645 	{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  3401 	{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  2646 /* ERROR_CHECK_BEGIN */
  3402 /* ERROR_CHECK_BEGIN */
       
  3403 | VAR_INPUT END_VAR
       
  3404 	{$$ = NULL;
       
  3405 	 yynerrs++;
       
  3406 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in input variable(s) declaration.");
       
  3407 	}
       
  3408 | VAR_INPUT RETAIN END_VAR
       
  3409 	{$$ = NULL;
       
  3410 	 yynerrs++;
       
  3411 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive input variable(s) declaration.");
       
  3412 	}
       
  3413 | VAR_INPUT NON_RETAIN END_VAR
       
  3414 	{$$ = NULL;
       
  3415 	 yynerrs++;
       
  3416 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive input variable(s) declaration.");
       
  3417 	}
       
  3418 | VAR_INPUT error input_declaration_list END_VAR
       
  3419 	{$$ = NULL;
       
  3420 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_INPUT' in input variable(s) declaration.");
       
  3421 	 yyerrok;
       
  3422 	}
       
  3423 | VAR_INPUT RETAIN error input_declaration_list END_VAR
       
  3424 	{$$ = NULL;
       
  3425 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive input variable(s) declaration.");
       
  3426 	 yyerrok;
       
  3427 	}
       
  3428 | VAR_INPUT NON_RETAIN error input_declaration_list END_VAR
       
  3429 	{$$ = NULL;
       
  3430 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive input variable(s) declaration.");
       
  3431 	 yyerrok;
       
  3432 	}
  2647 | VAR_INPUT error END_VAR
  3433 | VAR_INPUT error END_VAR
  2648 	{$$ = NULL;
  3434 	{$$ = NULL;
  2649 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in input variable(s) declaration.");
  3435 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in input variable(s) declaration.");
  2650 	 /* yychar */
  3436 	 yyerrok;
       
  3437 	}
       
  3438 | VAR_INPUT RETAIN error END_VAR
       
  3439 	{$$ = NULL;
       
  3440 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in retentive input variable(s) declaration.");
       
  3441 	 yyerrok;
       
  3442 	}
       
  3443 | VAR_INPUT NON_RETAIN error END_VAR
       
  3444 	{$$ = NULL;
       
  3445 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in non-retentive input variable(s) declaration.");
  2651 	 yyerrok;
  3446 	 yyerrok;
  2652 	}
  3447 	}
  2653 /* ERROR_CHECK_END */
  3448 /* ERROR_CHECK_END */
  2654 ;
  3449 ;
  2655 
  3450 
  2657 input_declaration_list:
  3452 input_declaration_list:
  2658   input_declaration ';'
  3453   input_declaration ';'
  2659 	{$$ = new input_declaration_list_c(locloc(@$)); $$->add_element($1);}
  3454 	{$$ = new input_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2660 | input_declaration_list input_declaration ';'
  3455 | input_declaration_list input_declaration ';'
  2661 	{$$ = $1; $$->add_element($2);}
  3456 	{$$ = $1; $$->add_element($2);}
       
  3457 /* ERROR_CHECK_BEGIN */
       
  3458 | input_declaration error
       
  3459 	{$$ = NULL;
       
  3460 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of input variable declaration.");
       
  3461 	 yyerrok;
       
  3462 	}
       
  3463 | input_declaration_list input_declaration error
       
  3464 	{$$ = NULL;
       
  3465 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of input variable declaration.");
       
  3466 	 yyerrok;
       
  3467 	}
       
  3468 | input_declaration_list ';'
       
  3469 	{$$ = NULL;
       
  3470 	 yynerrs++;
       
  3471 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after input variable declaration.");
       
  3472 	}
       
  3473 /* ERROR_CHECK_END */
  2662 ;
  3474 ;
  2663 
  3475 
  2664 
  3476 
  2665 input_declaration:
  3477 input_declaration:
  2666   var_init_decl
  3478   var_init_decl
  2671 edge_declaration:
  3483 edge_declaration:
  2672   var1_list ':' BOOL R_EDGE
  3484   var1_list ':' BOOL R_EDGE
  2673 	{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3485 	{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));}
  2674 | var1_list ':' BOOL F_EDGE
  3486 | var1_list ':' BOOL F_EDGE
  2675 	{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3487 	{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
       
  3488 /* ERROR_CHECK_BEGIN */
       
  3489 | var1_list BOOL R_EDGE
       
  3490 	{$$ = NULL;
       
  3491 	 yynerrs++;
       
  3492 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and specification.");
       
  3493 	}
       
  3494 | var1_list BOOL F_EDGE
       
  3495 	{$$ = NULL;
       
  3496 	 yynerrs++;
       
  3497 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and specification.");
       
  3498 	}
       
  3499 | var1_list ':' BOOL R_EDGE F_EDGE
       
  3500 	{$$ = NULL;
       
  3501 	 yynerrs++;
       
  3502 	 print_err_msg(current_filename, locf(@4), locl(@4), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration.");
       
  3503 	}
       
  3504 | var1_list ':' R_EDGE
       
  3505 	{$$ = NULL;
       
  3506 	 yynerrs++;
       
  3507 	 print_err_msg(current_filename, locf(@2), locl(@2), "'BOOL' missing in edge declaration.");
       
  3508 	}
       
  3509 | var1_list ':' F_EDGE
       
  3510 	{$$ = NULL;
       
  3511 	 yynerrs++;
       
  3512 	 print_err_msg(current_filename, locf(@2), locl(@2), "'BOOL' missing in edge declaration.");
       
  3513 	}
       
  3514 /* ERROR_CHECK_END */
  2676 ;
  3515 ;
  2677 
  3516 
  2678 
  3517 
  2679 var_init_decl:
  3518 var_init_decl:
  2680   var1_init_decl
  3519   var1_init_decl
  2692 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3531 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  2693 | var1_list ':' subrange_spec_init
  3532 | var1_list ':' subrange_spec_init
  2694 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3533 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  2695 | var1_list ':' enumerated_spec_init
  3534 | var1_list ':' enumerated_spec_init
  2696 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3535 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
       
  3536 /* ERROR_CHECK_BEGIN */
       
  3537 | var1_list simple_spec_init
       
  3538 	{$$ = NULL;
       
  3539 	 yynerrs++;
       
  3540 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and simple specification.");
       
  3541 	}
       
  3542 | var1_list subrange_spec_init
       
  3543 	{$$ = NULL;
       
  3544 	 yynerrs++;
       
  3545 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and subrange specification.");
       
  3546 	}
       
  3547 | var1_list enumerated_spec_init
       
  3548 	{$$ = NULL;
       
  3549 	 yynerrs++;
       
  3550 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and enumerated specification.");
       
  3551 	}
       
  3552 | var1_list ':' identifier
       
  3553 	{$$ = NULL;
       
  3554 	 yynerrs++;
       
  3555 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown variable type defined in variable declaration.");
       
  3556 	}
       
  3557 | var1_list ':' error
       
  3558 	{$$ = NULL;
       
  3559 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in variable declaration.");
       
  3560 	 yyerrok;
       
  3561 	}
       
  3562 /* ERROR_CHECK_END */
  2697 ;
  3563 ;
  2698 
  3564 
  2699 
  3565 
  2700 var1_list:
  3566 var1_list:
  2701   variable_name
  3567   variable_name
  2704 	}
  3570 	}
  2705  | var1_list ',' variable_name
  3571  | var1_list ',' variable_name
  2706 	{$$ = $1; $$->add_element($3);
  3572 	{$$ = $1; $$->add_element($3);
  2707 	 variable_name_symtable.insert($3, prev_declared_variable_name_token);
  3573 	 variable_name_symtable.insert($3, prev_declared_variable_name_token);
  2708 	}
  3574 	}
       
  3575 /* ERROR_CHECK_BEGIN */
       
  3576 | var1_list variable_name
       
  3577 	{$$ = NULL;
       
  3578 	 yynerrs++;
       
  3579 	 print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in variable list.");
       
  3580 	}
       
  3581 | var1_list ',' error
       
  3582 	{$$ = NULL;
       
  3583 	 yynerrs++;
       
  3584 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ',' in variable declaration.");
       
  3585 	}
       
  3586 /* ERROR_CHECK_END */
  2709 ;
  3587 ;
  2710 
  3588 
  2711 
  3589 
  2712 
  3590 
  2713 array_var_init_decl:
  3591 array_var_init_decl:
  2714  var1_list ':' array_spec_init
  3592  var1_list ':' array_spec_init
  2715 	{$$ = new array_var_init_decl_c($1, $3, locloc(@$));}
  3593 	{$$ = new array_var_init_decl_c($1, $3, locloc(@$));}
       
  3594 /* ERROR_CHECK_BEGIN */
       
  3595 | var1_list array_spec_init
       
  3596 	{$$ = NULL;
       
  3597 	 yynerrs++;
       
  3598 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and array specification.");
       
  3599 	}
       
  3600 /* ERROR_CHECK_END */
  2716 ;
  3601 ;
  2717 
  3602 
  2718 
  3603 
  2719 structured_var_init_decl:
  3604 structured_var_init_decl:
  2720   var1_list ':' initialized_structure
  3605   var1_list ':' initialized_structure
  2721 	{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));}
  3606 	{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));}
       
  3607 /* ERROR_CHECK_BEGIN */
       
  3608 | var1_list initialized_structure
       
  3609 	{$$ = NULL;
       
  3610 	 yynerrs++;
       
  3611 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and structured specification.");
       
  3612 	}
       
  3613 /* ERROR_CHECK_END */
  2722 ;
  3614 ;
  2723 
  3615 
  2724 
  3616 
  2725 /* NOTE: see notes above fb_name_list and var1_list
  3617 /* NOTE: see notes above fb_name_list and var1_list
  2726  *       for reason why ':' was removed from this rule!
  3618  *       for reason why ':' was removed from this rule!
  2732   fb_name_list_with_colon function_block_type_name
  3624   fb_name_list_with_colon function_block_type_name
  2733 	{$$ = new fb_name_decl_c($1, $2, NULL, locloc(@$));}
  3625 	{$$ = new fb_name_decl_c($1, $2, NULL, locloc(@$));}
  2734 /*| fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
  3626 /*| fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
  2735 | fb_name_list_with_colon function_block_type_name ASSIGN structure_initialization
  3627 | fb_name_list_with_colon function_block_type_name ASSIGN structure_initialization
  2736 	{$$ = new fb_name_decl_c($1, $2, $4, locloc(@$));}
  3628 	{$$ = new fb_name_decl_c($1, $2, $4, locloc(@$));}
       
  3629 /* ERROR_CHECK_BEGIN */
       
  3630 | fb_name_list_with_colon ASSIGN structure_initialization
       
  3631 	{$$ = NULL;
       
  3632 	 yynerrs++;
       
  3633 	 print_err_msg(current_filename, locf(@2), locl(@2), "no function block type name defined in function block declaration with initialization.");
       
  3634 	}
       
  3635 | fb_name_list_with_colon function_block_type_name structure_initialization
       
  3636 	{$$ = NULL;
       
  3637 	 yynerrs++;
       
  3638 	 print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing in function block declaration with initialization.");
       
  3639 	}
       
  3640 | fb_name_list_with_colon function_block_type_name ASSIGN error
       
  3641 	{$$ = NULL;
       
  3642 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid initialization in function block declaration.");
       
  3643 	 yyerrok;
       
  3644 	}
       
  3645 /* ERROR_CHECK_END */
  2737 ;
  3646 ;
  2738 
  3647 
  2739 
  3648 
  2740 
  3649 
  2741 /* NOTE: In order to remove a reduce/reduce conflict between
  3650 /* NOTE: In order to remove a reduce/reduce conflict between
  2795 | VAR_OUTPUT RETAIN var_init_decl_list END_VAR
  3704 | VAR_OUTPUT RETAIN var_init_decl_list END_VAR
  2796 	{$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3705 	{$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  2797 | VAR_OUTPUT NON_RETAIN var_init_decl_list END_VAR
  3706 | VAR_OUTPUT NON_RETAIN var_init_decl_list END_VAR
  2798 	{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  3707 	{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  2799 /* ERROR_CHECK_BEGIN */
  3708 /* ERROR_CHECK_BEGIN */
       
  3709 | VAR_OUTPUT END_VAR
       
  3710 	{$$ = NULL;
       
  3711 	 yynerrs++;
       
  3712 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in output variable(s) declaration.");
       
  3713 	}
       
  3714 | VAR_OUTPUT RETAIN END_VAR
       
  3715 	{$$ = NULL;
       
  3716 	 yynerrs++;
       
  3717 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive output variable(s) declaration.");
       
  3718 	}
       
  3719 | VAR_OUTPUT NON_RETAIN END_VAR
       
  3720 	{$$ = NULL;
       
  3721 	 yynerrs++;
       
  3722 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive output variable(s) declaration.");
       
  3723 	}
       
  3724 | VAR_OUTPUT error var_init_decl_list END_VAR
       
  3725 	{$$ = NULL;
       
  3726 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_OUPUT' in output variable(s) declaration.");
       
  3727 	 yyerrok;
       
  3728 	}
       
  3729 | VAR_OUTPUT RETAIN error var_init_decl_list END_VAR
       
  3730 	{$$ = NULL;
       
  3731 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive output variable(s) declaration.");
       
  3732 	 yyerrok;
       
  3733 	}
       
  3734 | VAR_OUTPUT NON_RETAIN error var_init_decl_list END_VAR
       
  3735 	{$$ = NULL;
       
  3736 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive output variable(s) declaration.");
       
  3737 	 yyerrok;
       
  3738 	}
  2800 | VAR_OUTPUT error END_VAR
  3739 | VAR_OUTPUT error END_VAR
  2801 	{$$ = NULL;
  3740 	{$$ = NULL;
  2802 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in output variable(s) declaration.");
  3741 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in output variable(s) declaration.");
  2803 	 /* yychar */
  3742 	 yyerrok;
       
  3743 	}
       
  3744 | VAR_OUTPUT RETAIN error END_VAR
       
  3745 	{$$ = NULL;
       
  3746 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in retentive output variable(s) declaration.");
       
  3747 	 yyerrok;
       
  3748 	}
       
  3749 | VAR_OUTPUT NON_RETAIN error END_VAR
       
  3750 	{$$ = NULL;
       
  3751 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in non-retentive output variable(s) declaration.");
  2804 	 yyerrok;
  3752 	 yyerrok;
  2805 	}
  3753 	}
  2806 /* ERROR_CHECK_END */
  3754 /* ERROR_CHECK_END */
  2807 ;
  3755 ;
  2808 
  3756 
  2810 
  3758 
  2811 input_output_declarations:
  3759 input_output_declarations:
  2812   VAR_IN_OUT var_declaration_list END_VAR
  3760   VAR_IN_OUT var_declaration_list END_VAR
  2813 	{$$ = new input_output_declarations_c($2, locloc(@$));}
  3761 	{$$ = new input_output_declarations_c($2, locloc(@$));}
  2814 /* ERROR_CHECK_BEGIN */
  3762 /* ERROR_CHECK_BEGIN */
       
  3763 | VAR_IN_OUT END_VAR
       
  3764 	{$$ = NULL;
       
  3765 	 yynerrs++;
       
  3766 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in in_out variable(s) declaration.");
       
  3767 	}
  2815 | VAR_IN_OUT error END_VAR
  3768 | VAR_IN_OUT error END_VAR
  2816 	{$$ = NULL;
  3769 	{$$ = NULL;
  2817 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in in_out variable(s) declaration.");
  3770 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in in_out variable(s) declaration.");
  2818 	 /* yychar */
       
  2819 	 yyerrok;
  3771 	 yyerrok;
  2820 	}
  3772 	}
  2821 /* ERROR_CHECK_END */
  3773 /* ERROR_CHECK_END */
  2822 ;
  3774 ;
  2823 
  3775 
  2827 var_declaration_list:
  3779 var_declaration_list:
  2828   var_declaration ';'
  3780   var_declaration ';'
  2829 	{$$ = new var_declaration_list_c(locloc(@$)); $$->add_element($1);}
  3781 	{$$ = new var_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2830 | var_declaration_list var_declaration ';'
  3782 | var_declaration_list var_declaration ';'
  2831 	{$$ = $1; $$->add_element($2);}
  3783 	{$$ = $1; $$->add_element($2);}
       
  3784 /* ERROR_CHECK_BEGIN */
       
  3785 | var_declaration error
       
  3786 	{$$ = NULL;
       
  3787 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of variable declaration.");
       
  3788 	 yyerrok;
       
  3789 	}
       
  3790 | var_declaration_list var_declaration error
       
  3791 	{$$ = NULL;
       
  3792 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of variable declaration.");
       
  3793 	 yyerrok;
       
  3794 	}
       
  3795 | var_declaration_list ';'
       
  3796 	{$$ = NULL;
       
  3797 	 yynerrs++;
       
  3798 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after variable declaration.");
       
  3799 	}
       
  3800 /* ERROR_CHECK_END */
  2832 ;
  3801 ;
  2833 
  3802 
  2834 
  3803 
  2835 var_declaration:
  3804 var_declaration:
  2836   temp_var_decl
  3805   temp_var_decl
  2850 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3819 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  2851 | var1_list  ':' subrange_specification
  3820 | var1_list  ':' subrange_specification
  2852 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3821 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  2853 | var1_list  ':' enumerated_specification
  3822 | var1_list  ':' enumerated_specification
  2854 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
  3823 	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
       
  3824 /* ERROR_CHECK_BEGIN */
       
  3825 | var1_list simple_specification
       
  3826 	{$$ = NULL;
       
  3827 	 yynerrs++;
       
  3828 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and simple specification.");
       
  3829 	}
       
  3830 | var1_list subrange_specification
       
  3831 	{$$ = NULL;
       
  3832 	 yynerrs++;
       
  3833 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and subrange specification.");
       
  3834 	}
       
  3835 | var1_list enumerated_specification
       
  3836 	{$$ = NULL;
       
  3837 	 yynerrs++;
       
  3838 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and enumerated specification.");
       
  3839 	}
       
  3840 /* ERROR_CHECK_END */
  2855 ;
  3841 ;
  2856 
  3842 
  2857 
  3843 
  2858 
  3844 
  2859 array_var_declaration:
  3845 array_var_declaration:
  2860   var1_list ':' array_specification
  3846   var1_list ':' array_specification
  2861 	{$$ = new array_var_declaration_c($1, $3, locloc(@$));}
  3847 	{$$ = new array_var_declaration_c($1, $3, locloc(@$));}
       
  3848 /* ERROR_CHECK_BEGIN */
       
  3849 | var1_list array_specification
       
  3850 	{$$ = NULL;
       
  3851 	 yynerrs++;
       
  3852 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and array specification.");
       
  3853 	}
       
  3854 /* ERROR_CHECK_END */
  2862 ;
  3855 ;
  2863 
  3856 
  2864 structured_var_declaration:
  3857 structured_var_declaration:
  2865   var1_list ':' prev_declared_structure_type_name
  3858   var1_list ':' prev_declared_structure_type_name
  2866 	{$$ = new structured_var_declaration_c($1, $3, locloc(@$));}
  3859 	{$$ = new structured_var_declaration_c($1, $3, locloc(@$));}
       
  3860 /* ERROR_CHECK_BEGIN */
       
  3861 | var1_list prev_declared_structure_type_name
       
  3862 	{$$ = NULL;
       
  3863 	 yynerrs++;
       
  3864 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and structured specification.");
       
  3865 	}
       
  3866 | var1_list ':' identifier
       
  3867 	{$$ = NULL;
       
  3868 	 yynerrs++;
       
  3869 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown type name in structured variable declaration.");
       
  3870 	}
       
  3871 /* ERROR_CHECK_END */
  2867 ;
  3872 ;
  2868 
  3873 
  2869 
  3874 
  2870 var_declarations:
  3875 var_declarations:
  2871   VAR var_init_decl_list END_VAR
  3876   VAR var_init_decl_list END_VAR
  2872 	{$$ = new var_declarations_c(NULL, $2, locloc(@$));}
  3877 	{$$ = new var_declarations_c(NULL, $2, locloc(@$));}
  2873 | VAR CONSTANT var_init_decl_list END_VAR
  3878 | VAR CONSTANT var_init_decl_list END_VAR
  2874 	{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  3879 	{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
       
  3880 /* ERROR_CHECK_BEGIN */
       
  3881 | VAR END_VAR
       
  3882 	{$$ = NULL;
       
  3883 	 yynerrs++;
       
  3884 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in variable(s) declaration.");
       
  3885 	}
       
  3886 | VAR CONSTANT END_VAR
       
  3887 	{$$ = NULL;
       
  3888 	 yynerrs++;
       
  3889 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in constant variable(s) declaration.");
       
  3890 	}
       
  3891 | VAR error var_init_decl_list END_VAR
       
  3892 	{$$ = NULL;
       
  3893 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in variable(s) declaration.");
       
  3894 	 yyerrok;
       
  3895 	}
       
  3896 | VAR CONSTANT error var_init_decl_list END_VAR
       
  3897 	{$$ = NULL;
       
  3898 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant variable(s) declaration.");
       
  3899 	 yyerrok;
       
  3900 	}
       
  3901 | VAR error END_VAR
       
  3902 	{$$ = NULL;
       
  3903 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in variable(s) declaration.");
       
  3904 	 yyerrok;
       
  3905 	}
       
  3906 | VAR CONSTANT error END_VAR
       
  3907 	{$$ = NULL;
       
  3908 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in constant variable(s) declaration.");
       
  3909 	 yyerrok;
       
  3910 	}
       
  3911 /* ERROR_CHECK_END */
  2875 ;
  3912 ;
  2876 
  3913 
  2877 
  3914 
  2878 retentive_var_declarations:
  3915 retentive_var_declarations:
  2879   VAR RETAIN var_init_decl_list END_VAR
  3916   VAR RETAIN var_init_decl_list END_VAR
  2880 	{$$ = new retentive_var_declarations_c($3, locloc(@$));}
  3917 	{$$ = new retentive_var_declarations_c($3, locloc(@$));}
  2881 /* ERROR_CHECK_BEGIN */
  3918 /* ERROR_CHECK_BEGIN */
       
  3919 | VAR RETAIN END_VAR
       
  3920 	{$$ = NULL;
       
  3921 	 yynerrs++;
       
  3922 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive variable(s) declaration.");
       
  3923 	}
       
  3924 | VAR RETAIN error var_init_decl_list END_VAR
       
  3925 	{$$ = NULL;
       
  3926 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive variable(s) declaration.");
       
  3927 	 yyerrok;
       
  3928 	}
  2882 | VAR RETAIN error END_VAR
  3929 | VAR RETAIN error END_VAR
  2883 	{$$ = NULL;
  3930 	{$$ = NULL;
  2884 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in variable(s) declaration.");
  3931 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in retentive variable(s) declaration.");
  2885 	 /* yychar */
       
  2886 	 yyerrok;
  3932 	 yyerrok;
  2887 	}
  3933 	}
  2888 /* ERROR_CHECK_END */
  3934 /* ERROR_CHECK_END */
  2889 ;
  3935 ;
  2890 
  3936 
  2891 
  3937 
  2892 located_var_declarations:
  3938 located_var_declarations:
  2893   VAR  located_var_decl_list END_VAR
  3939   VAR located_var_decl_list END_VAR
  2894 	{$$ = new located_var_declarations_c(NULL, $2, locloc(@$));}
  3940 	{$$ = new located_var_declarations_c(NULL, $2, locloc(@$));}
  2895 | VAR CONSTANT located_var_decl_list END_VAR
  3941 | VAR CONSTANT located_var_decl_list END_VAR
  2896 	{$$ = new located_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  3942 	{$$ = new located_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  2897 | VAR RETAIN located_var_decl_list END_VAR
  3943 | VAR RETAIN located_var_decl_list END_VAR
  2898 	{$$ = new located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3944 	{$$ = new located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  2899 | VAR NON_RETAIN located_var_decl_list END_VAR
  3945 | VAR NON_RETAIN located_var_decl_list END_VAR
  2900 	{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  3946 	{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
       
  3947 /* ERROR_CHECK_BEGIN */
       
  3948 | VAR NON_RETAIN END_VAR
       
  3949 	{$$ = NULL;
       
  3950 	 yynerrs++;
       
  3951 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive located variable(s) declaration.");
       
  3952 	}
       
  3953 | VAR error located_var_decl_list END_VAR
       
  3954 	{$$ = NULL;
       
  3955 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in located variable(s) declaration.");
       
  3956 	 yyerrok;
       
  3957 	}
       
  3958 | VAR CONSTANT error located_var_decl_list END_VAR
       
  3959 	{$$ = NULL;
       
  3960 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant located variable(s) declaration.");
       
  3961 	 yyerrok;
       
  3962 	}
       
  3963 | VAR RETAIN error located_var_decl_list END_VAR
       
  3964 	{$$ = NULL;
       
  3965 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive located variable(s) declaration.");
       
  3966 	 yyerrok;
       
  3967 	}
       
  3968 | VAR NON_RETAIN error located_var_decl_list END_VAR
       
  3969 	{$$ = NULL;
       
  3970 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration.");
       
  3971 	 yyerrok;
       
  3972 	}
       
  3973 | VAR NON_RETAIN error END_VAR
       
  3974 	{$$ = NULL;
       
  3975 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in non retentive variable(s) declaration.");
       
  3976 	 yyerrok;
       
  3977 	}
       
  3978 /* ERROR_CHECK_END */
  2901 ;
  3979 ;
  2902 
  3980 
  2903 
  3981 
  2904 /* helper symbol for located_var_declarations */
  3982 /* helper symbol for located_var_declarations */
  2905 located_var_decl_list:
  3983 located_var_decl_list:
  2906   located_var_decl ';'
  3984   located_var_decl ';'
  2907 	{$$ = new located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  3985 	{$$ = new located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  2908 | located_var_decl_list located_var_decl ';'
  3986 | located_var_decl_list located_var_decl ';'
  2909 	{$$ = $1; $$->add_element($2);}
  3987 	{$$ = $1; $$->add_element($2);}
       
  3988 /* ERROR_CHECK_BEGIN */
       
  3989 | located_var_decl error
       
  3990 	{$$ = NULL;
       
  3991 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of located variable declaration.");
       
  3992 	 yyerrok;
       
  3993 	}
       
  3994 | located_var_decl_list located_var_decl error
       
  3995 	{$$ = NULL;
       
  3996 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of located variable declaration.");
       
  3997 	 yyerrok;
       
  3998 	}
       
  3999 | located_var_decl_list ';'
       
  4000 	{$$ = NULL;
       
  4001 	 yynerrs++;
       
  4002 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after located variable declaration.");
       
  4003 	}
       
  4004 /* ERROR_CHECK_END */
  2910 ;
  4005 ;
  2911 
  4006 
  2912 
  4007 
  2913 located_var_decl:
  4008 located_var_decl:
  2914   variable_name location ':' located_var_spec_init
  4009   variable_name location ':' located_var_spec_init
  2915 	{$$ = new located_var_decl_c($1, $2, $4, locloc(@$));
  4010 	{$$ = new located_var_decl_c($1, $2, $4, locloc(@$));
  2916 	 variable_name_symtable.insert($1, prev_declared_variable_name_token);
  4011 	 variable_name_symtable.insert($1, prev_declared_variable_name_token);
  2917 	}
  4012 	}
  2918 | location ':' located_var_spec_init
  4013 | location ':' located_var_spec_init
  2919 	{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));}
  4014 	{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));}
       
  4015 /* ERROR_CHECK_BEGIN */
       
  4016 | variable_name location located_var_spec_init
       
  4017 	{$$ = NULL;
       
  4018 	 yynerrs++;
       
  4019 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between located variable location and specification.");
       
  4020 	}
       
  4021 | location located_var_spec_init
       
  4022 	{$$ = NULL;
       
  4023 	 yynerrs++;
       
  4024 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between located variable location and specification.");
       
  4025 	}
       
  4026 | variable_name location ':' error
       
  4027 	{$$ = NULL;
       
  4028 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in located variable declaration.");
       
  4029 	 yyerrok;
       
  4030 	}
       
  4031 | location ':' error
       
  4032 	{$$ = NULL;
       
  4033 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in located variable declaration.");
       
  4034 	 yyerrok;
       
  4035 	}
       
  4036 /* ERROR_CHECK_END */
  2920 ;
  4037 ;
  2921 
  4038 
  2922 
  4039 
  2923 
  4040 
  2924 
  4041 
  2926   VAR_EXTERNAL external_declaration_list END_VAR
  4043   VAR_EXTERNAL external_declaration_list END_VAR
  2927 	{$$ = new external_var_declarations_c(NULL, $2, locloc(@$));}
  4044 	{$$ = new external_var_declarations_c(NULL, $2, locloc(@$));}
  2928 | VAR_EXTERNAL CONSTANT external_declaration_list END_VAR
  4045 | VAR_EXTERNAL CONSTANT external_declaration_list END_VAR
  2929 	{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  4046 	{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  2930 /* ERROR_CHECK_BEGIN */
  4047 /* ERROR_CHECK_BEGIN */
       
  4048 | VAR_EXTERNAL END_VAR
       
  4049 	{$$ = NULL;
       
  4050 	 yynerrs++;
       
  4051 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in external variable(s) declaration.");
       
  4052 	}
       
  4053 | VAR_EXTERNAL CONSTANT END_VAR
       
  4054 	{$$ = NULL;
       
  4055 	 yynerrs++;
       
  4056 	 print_err_msg(current_filename, locf(@1), locl(@3), "no variable declared in constant external variable(s) declaration.");
       
  4057 	}
       
  4058 | VAR_EXTERNAL error external_declaration_list END_VAR
       
  4059 	{$$ = NULL;
       
  4060 	 print_err_msg(current_filename, locf(@1), locl(@4), "unexpected token after 'VAR_EXTERNAL' in external variable(s) declaration.");
       
  4061 	 yyerrok;
       
  4062 	}
       
  4063 | VAR_EXTERNAL CONSTANT error external_declaration_list END_VAR
       
  4064 	{$$ = NULL;
       
  4065 	 print_err_msg(current_filename, locf(@2), locl(@5), "unexpected token after 'CONSTANT' in constant external variable(s) declaration.");
       
  4066 	 yyerrok;
       
  4067 	}
  2931 | VAR_EXTERNAL error END_VAR
  4068 | VAR_EXTERNAL error END_VAR
  2932 	{$$ = NULL;
  4069 	{$$ = NULL;
  2933 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in external variable(s) declaration.");
  4070 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in external variable(s) declaration.");
  2934 	 /* yychar */
  4071 	 yyerrok;
       
  4072 	}
       
  4073 | VAR_EXTERNAL CONSTANT error END_VAR
       
  4074 	{$$ = NULL;
       
  4075 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant external variable(s) declaration.");
  2935 	 yyerrok;
  4076 	 yyerrok;
  2936 	}
  4077 	}
  2937 /* ERROR_CHECK_END */
  4078 /* ERROR_CHECK_END */
  2938 ;
  4079 ;
  2939 
  4080 
  2940 /* helper symbol for external_var_declarations */
  4081 /* helper symbol for external_var_declarations */
  2941 external_declaration_list:
  4082 external_declaration_list:
  2942   external_declaration ';'
  4083   external_declaration ';'
  2943 	{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);}
  4084 	{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);}
  2944 | external_declaration_list external_declaration';'
  4085 | external_declaration_list external_declaration ';'
  2945 	{$$ = $1; $$->add_element($2);}
  4086 	{$$ = $1; $$->add_element($2);}
       
  4087 /* ERROR_CHECK_BEGIN */
       
  4088 | external_declaration error
       
  4089 	{$$ = NULL;
       
  4090 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of external variable declaration.");
       
  4091 	 yyerrok;
       
  4092 	}
       
  4093 | external_declaration_list external_declaration error
       
  4094 	{$$ = NULL;
       
  4095 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of external variable declaration.");
       
  4096 	 yyerrok;
       
  4097 	}
       
  4098 | external_declaration_list ';'
       
  4099 	{$$ = NULL;
       
  4100 	 yynerrs++;
       
  4101 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after external variable declaration.");
       
  4102 	}
       
  4103 /* ERROR_CHECK_END */
  2946 ;
  4104 ;
  2947 
  4105 
  2948 
  4106 
  2949 external_declaration:
  4107 external_declaration:
  2950   global_var_name ':' simple_specification
  4108   global_var_name ':' simple_specification
  2969 	}
  4127 	}
  2970 | global_var_name ':' function_block_type_name
  4128 | global_var_name ':' function_block_type_name
  2971 	{$$ = new external_declaration_c($1, $3, locloc(@$));
  4129 	{$$ = new external_declaration_c($1, $3, locloc(@$));
  2972 	 variable_name_symtable.insert($1, prev_declared_fb_name_token);
  4130 	 variable_name_symtable.insert($1, prev_declared_fb_name_token);
  2973 	}
  4131 	}
       
  4132 /* ERROR_CHECK_BEGIN */
       
  4133 | global_var_name simple_specification
       
  4134 	{$$ = NULL;
       
  4135 	 yynerrs++;
       
  4136 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and simple specification.");
       
  4137 	}
       
  4138 | global_var_name subrange_specification
       
  4139 	{$$ = NULL;
       
  4140 	 yynerrs++;
       
  4141 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and subrange specification.");
       
  4142 	}
       
  4143 | global_var_name enumerated_specification
       
  4144 	{$$ = NULL;
       
  4145 	 yynerrs++;
       
  4146 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and enumerated specification.");
       
  4147 	}
       
  4148 | global_var_name array_specification
       
  4149 	{$$ = NULL;
       
  4150 	 yynerrs++;
       
  4151 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and array specification.");
       
  4152 	}
       
  4153 | global_var_name prev_declared_structure_type_name
       
  4154 	{$$ = NULL;
       
  4155 	 yynerrs++;
       
  4156 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and structured specification.");
       
  4157 	}
       
  4158 | global_var_name function_block_type_name
       
  4159 	{$$ = NULL;
       
  4160 	 yynerrs++;
       
  4161 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and function block type specification.");
       
  4162 	}
       
  4163 | global_var_name ':' identifier
       
  4164 	{$$ = NULL;
       
  4165 	 yynerrs++;
       
  4166 	 print_err_msg(current_filename, locf(@2), locl(@2), "unknown type name in external variable declaration.");
       
  4167 	}
       
  4168 | global_var_name ':' error
       
  4169 	{$$ = NULL;
       
  4170 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in external variable declaration.");
       
  4171 	 yyerrok;
       
  4172 	}
       
  4173 /* ERROR_CHECK_END */
  2974 ;
  4174 ;
  2975 
  4175 
  2976 
  4176 
  2977 global_var_name: identifier;
  4177 global_var_name: identifier;
  2978 
  4178 
  2983 | VAR_GLOBAL CONSTANT global_var_decl_list END_VAR
  4183 | VAR_GLOBAL CONSTANT global_var_decl_list END_VAR
  2984 	{$$ = new global_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  4184 	{$$ = new global_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  2985 | VAR_GLOBAL RETAIN global_var_decl_list END_VAR
  4185 | VAR_GLOBAL RETAIN global_var_decl_list END_VAR
  2986 	{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  4186 	{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  2987 /* ERROR_CHECK_BEGIN */
  4187 /* ERROR_CHECK_BEGIN */
       
  4188 | VAR_GLOBAL END_VAR
       
  4189 	{$$ = NULL;
       
  4190 	 yynerrs++;
       
  4191 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in global variable(s) declaration.");
       
  4192 	}
       
  4193 | VAR_GLOBAL CONSTANT END_VAR
       
  4194 	{$$ = NULL;
       
  4195 	 yynerrs++;
       
  4196 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in constant global variable(s) declaration.");
       
  4197 	}
       
  4198 | VAR_GLOBAL RETAIN END_VAR
       
  4199 	{$$ = NULL;
       
  4200 	 yynerrs++;
       
  4201 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive global variable(s) declaration.");
       
  4202 	}
       
  4203 | VAR_GLOBAL error global_var_decl_list END_VAR
       
  4204 	{$$ = NULL;
       
  4205 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_GLOBAL' in global variable(s) declaration.");
       
  4206 	 yyerrok;
       
  4207 	}
       
  4208 | VAR_GLOBAL CONSTANT error global_var_decl_list END_VAR
       
  4209 	{$$ = NULL;
       
  4210 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant global variable(s) declaration.");
       
  4211 	 yyerrok;
       
  4212 	}
       
  4213 | VAR_GLOBAL RETAIN error global_var_decl_list END_VAR
       
  4214 	{$$ = NULL;
       
  4215 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive global variable(s) declaration.");
       
  4216 	 yyerrok;
       
  4217 	}
  2988 | VAR_GLOBAL error END_VAR
  4218 | VAR_GLOBAL error END_VAR
  2989 	{$$ = NULL;
  4219 	{$$ = NULL;
  2990 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in global variable(s) declaration.");
  4220 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in global variable(s) declaration.");
  2991 	 /* yychar */
  4221 	 yyerrok;
       
  4222 	}
       
  4223 | VAR_GLOBAL CONSTANT error END_VAR
       
  4224 	{$$ = NULL;
       
  4225 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant global variable(s) declaration.");
       
  4226 	 yyerrok;
       
  4227 	}
       
  4228 | VAR_GLOBAL RETAIN error END_VAR
       
  4229 	{$$ = NULL;
       
  4230 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant global variable(s) declaration.");
  2992 	 yyerrok;
  4231 	 yyerrok;
  2993 	}
  4232 	}
  2994 /* ERROR_CHECK_END */
  4233 /* ERROR_CHECK_END */
  2995 ;
  4234 ;
  2996 
  4235 
  2999 global_var_decl_list:
  4238 global_var_decl_list:
  3000   global_var_decl ';'
  4239   global_var_decl ';'
  3001 	{$$ = new global_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  4240 	{$$ = new global_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  3002 | global_var_decl_list global_var_decl ';'
  4241 | global_var_decl_list global_var_decl ';'
  3003 	{$$ = $1; $$->add_element($2);}
  4242 	{$$ = $1; $$->add_element($2);}
       
  4243 /* ERROR_CHECK_BEGIN */
       
  4244 | global_var_decl error
       
  4245 	{$$ = NULL;
       
  4246 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of global variable declaration.");
       
  4247 	 yyerrok;
       
  4248 	}
       
  4249 | global_var_decl_list global_var_decl error
       
  4250 	{$$ = NULL;
       
  4251 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of global variable declaration.");
       
  4252 	 yyerrok;
       
  4253 	}
       
  4254 | global_var_decl_list ';'
       
  4255 	{$$ = NULL;
       
  4256 	 yynerrs++;
       
  4257 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after global variable declaration.");
       
  4258 	}
       
  4259 /* ERROR_CHECK_END */
  3004 ;
  4260 ;
  3005 
  4261 
  3006 
  4262 
  3007 global_var_decl:
  4263 global_var_decl:
       
  4264 /* NOTE : This possibility defined in standard has no sense and generate a conflict (disabled)
  3008   global_var_spec ':'
  4265   global_var_spec ':'
  3009 	{$$ = new global_var_decl_c($1, NULL, locloc(@$));}
  4266 	{$$ = new global_var_decl_c($1, NULL, locloc(@$));}
  3010 | global_var_spec ':' located_var_spec_init
  4267 */
       
  4268   global_var_spec ':' located_var_spec_init
  3011 	{$$ = new global_var_decl_c($1, $3, locloc(@$));}
  4269 	{$$ = new global_var_decl_c($1, $3, locloc(@$));}
  3012 | global_var_spec ':' function_block_type_name
  4270 | global_var_spec ':' function_block_type_name
  3013 	{$$ = new global_var_decl_c($1, $3, locloc(@$));}
  4271 	{$$ = new global_var_decl_c($1, $3, locloc(@$));}
       
  4272 /* ERROR_CHECK_BEGIN */
       
  4273 | global_var_list located_var_spec_init
       
  4274 	{$$ = NULL;
       
  4275 	 yynerrs++;
       
  4276 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between global variable list and type specification.");
       
  4277 	}
       
  4278 | global_var_name location located_var_spec_init
       
  4279 	{$$ = NULL;
       
  4280 	 yynerrs++;
       
  4281 	 print_err_msg(current_filename, locf(@3), locl(@3), "':' missing between global variable specification and type specification.");
       
  4282 	}
       
  4283 | global_var_spec function_block_type_name
       
  4284 	{$$ = NULL;
       
  4285 	 yynerrs++;
       
  4286 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between global variable specification and function block type specification.");
       
  4287 	}
       
  4288 | global_var_spec ':' identifier
       
  4289 	{$$ = NULL;
       
  4290 	 yynerrs++;
       
  4291 	 print_err_msg(current_filename, locf(@3), locl(@3), "unknown variable type defined in global variable declaration.");
       
  4292 	}
       
  4293 | global_var_spec ':' error
       
  4294 	{$$ = NULL;
       
  4295 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in global variable declaration.");
       
  4296 	 yyerrok;
       
  4297 	}
       
  4298 /* ERROR_CHECK_END */
  3014 ;
  4299 ;
  3015 
  4300 
  3016 
  4301 
  3017 global_var_spec:
  4302 global_var_spec:
  3018   global_var_list	{$$ = $1;}
  4303   global_var_list	{$$ = $1;}
  3020 	{$$ = new global_var_spec_c(NULL, $1, locloc(@$));}
  4305 	{$$ = new global_var_spec_c(NULL, $1, locloc(@$));}
  3021 | global_var_name location
  4306 | global_var_name location
  3022 	{$$ = new global_var_spec_c($1, $2, locloc(@$));
  4307 	{$$ = new global_var_spec_c($1, $2, locloc(@$));
  3023 	 variable_name_symtable.insert($1, prev_declared_global_var_name_token);
  4308 	 variable_name_symtable.insert($1, prev_declared_global_var_name_token);
  3024 	}
  4309 	}
  3025 
       
  3026 ;
  4310 ;
  3027 
  4311 
  3028 
  4312 
  3029 located_var_spec_init:
  4313 located_var_spec_init:
  3030   simple_spec_init
  4314   simple_spec_init
  3038 
  4322 
  3039 
  4323 
  3040 location:
  4324 location:
  3041   AT direct_variable
  4325   AT direct_variable
  3042 	{$$ = new location_c($2, locloc(@$));}
  4326 	{$$ = new location_c($2, locloc(@$));}
       
  4327 /* ERROR_CHECK_BEGIN */
       
  4328 | AT error
       
  4329 	{$$ = NULL;
       
  4330 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid location in location declaration.");
       
  4331 	 yyerrok;
       
  4332 	}
       
  4333 /* ERROR_CHECK_END */
  3043 ;
  4334 ;
  3044 
  4335 
  3045 
  4336 
  3046 
  4337 
  3047 global_var_list:
  4338 global_var_list:
  3051 	}
  4342 	}
  3052 | global_var_list ',' global_var_name
  4343 | global_var_list ',' global_var_name
  3053 	{$$ = $1; $$->add_element($3);
  4344 	{$$ = $1; $$->add_element($3);
  3054 	 variable_name_symtable.insert($3, prev_declared_global_var_name_token);
  4345 	 variable_name_symtable.insert($3, prev_declared_global_var_name_token);
  3055 	}
  4346 	}
       
  4347 /* ERROR_CHECK_BEGIN */
       
  4348 | global_var_list global_var_name
       
  4349 	{$$ = NULL;
       
  4350 	 yynerrs++;
       
  4351 	 print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in global variable list.");
       
  4352 	}
       
  4353 | global_var_list ',' error
       
  4354 	{$$ = NULL;
       
  4355 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ',' in global variable declaration.");
       
  4356 	 yyerrok;
       
  4357 	}
       
  4358 /* ERROR_CHECK_END */
  3056 ;
  4359 ;
  3057 
  4360 
  3058 
  4361 
  3059 
  4362 
  3060 string_var_declaration:
  4363 string_var_declaration:
  3063 ;
  4366 ;
  3064 
  4367 
  3065 single_byte_string_var_declaration:
  4368 single_byte_string_var_declaration:
  3066   var1_list ':' single_byte_string_spec
  4369   var1_list ':' single_byte_string_spec
  3067 	{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));}
  4370 	{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));}
       
  4371 /* ERROR_CHECK_BEGIN */
       
  4372 | var1_list single_byte_string_spec
       
  4373 	{$$ = NULL;
       
  4374 	 yynerrs++;
       
  4375 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and string type specification.");
       
  4376 	}
       
  4377 /* ERROR_CHECK_END */
  3068 ;
  4378 ;
  3069 
  4379 
  3070 /* NOTE: The constructs
  4380 /* NOTE: The constructs
  3071  *
  4381  *
  3072  *       [W]STRING
  4382  *       [W]STRING
  3109 | STRING ASSIGN single_byte_character_string
  4419 | STRING ASSIGN single_byte_character_string
  3110 	{$$ = new single_byte_string_spec_c(NULL, $3, locloc(@$));}
  4420 	{$$ = new single_byte_string_spec_c(NULL, $3, locloc(@$));}
  3111 */
  4421 */
  3112 | STRING '[' integer ']' ASSIGN single_byte_character_string
  4422 | STRING '[' integer ']' ASSIGN single_byte_character_string
  3113 	{$$ = new single_byte_string_spec_c($3, $6, locloc(@$));}
  4423 	{$$ = new single_byte_string_spec_c($3, $6, locloc(@$));}
       
  4424 /* ERROR_CHECK_BEGIN */
       
  4425 | STRING '[' error ']'
       
  4426 	{$$ = NULL;
       
  4427 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited string type specification.");
       
  4428 	 yyerrok;
       
  4429 	}
       
  4430 | STRING '[' error ']' ASSIGN single_byte_character_string
       
  4431 	{$$ = NULL;
       
  4432 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited string type specification.");
       
  4433 	 yyerrok;
       
  4434 	}
       
  4435 | STRING '[' ']'
       
  4436 	{$$ = NULL;
       
  4437 	 yynerrs++;
       
  4438 	 print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited string type specification.");
       
  4439 	}
       
  4440 | STRING '[' ']' ASSIGN single_byte_character_string
       
  4441 	{$$ = NULL;
       
  4442 	 yynerrs++;
       
  4443 	 print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited string type specification.");
       
  4444 	}
       
  4445 | STRING '[' integer error
       
  4446 	{$$ = NULL;
       
  4447 	 print_err_msg(current_filename, locf(@3), locl(@3), "expecting ']' after length definition for limited string type specification.");
       
  4448 	 yyerrok;
       
  4449 	}
       
  4450 | STRING '[' integer error ASSIGN single_byte_character_string
       
  4451 	{$$ = NULL;
       
  4452 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting ']' after length definition for limited string type specification.");
       
  4453 	 yyerrok;
       
  4454 	}
       
  4455 | STRING '[' integer ']' single_byte_character_string
       
  4456 	{$$ = NULL;
       
  4457 	 yynerrs++;
       
  4458 	 print_err_msg(current_filename, locf(@4), locl(@5), "':=' missing before limited string type initialization.");
       
  4459 	}
       
  4460 | STRING '[' integer ']' ASSIGN error
       
  4461 	{$$ = NULL;
       
  4462 	 print_err_msg(current_filename, locf(@5), locl(@5), "invalid value for limited string type initialization.");
       
  4463 	 yyerrok;
       
  4464 	}
       
  4465 /* ERROR_CHECK_END */
  3114 ;
  4466 ;
  3115 
  4467 
  3116 
  4468 
  3117 double_byte_string_var_declaration:
  4469 double_byte_string_var_declaration:
  3118   var1_list ':' double_byte_string_spec
  4470   var1_list ':' double_byte_string_spec
  3119 	{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));}
  4471 	{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));}
       
  4472 /* ERROR_CHECK_BEGIN */
       
  4473 | var1_list double_byte_string_spec
       
  4474 	{$$ = NULL;
       
  4475 	 yynerrs++;
       
  4476 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and double byte string type specification.");
       
  4477 	}
       
  4478 /* ERROR_CHECK_END */
  3120 ;
  4479 ;
  3121 
  4480 
  3122 double_byte_string_spec:
  4481 double_byte_string_spec:
  3123 /*  WSTRING
  4482 /*  WSTRING
  3124 	{$$ = new double_byte_string_spec_c(NULL, NULL, locloc(@$));}
  4483 	{$$ = new double_byte_string_spec_c(NULL, NULL, locloc(@$));}
  3129 | WSTRING ASSIGN double_byte_character_string
  4488 | WSTRING ASSIGN double_byte_character_string
  3130 	{$$ = new double_byte_string_spec_c(NULL, $3, locloc(@$));}
  4489 	{$$ = new double_byte_string_spec_c(NULL, $3, locloc(@$));}
  3131 */
  4490 */
  3132 | WSTRING '[' integer ']' ASSIGN double_byte_character_string
  4491 | WSTRING '[' integer ']' ASSIGN double_byte_character_string
  3133 	{$$ = new double_byte_string_spec_c($3, $6, locloc(@$));}
  4492 	{$$ = new double_byte_string_spec_c($3, $6, locloc(@$));}
       
  4493 /* ERROR_CHECK_BEGIN */
       
  4494 | WSTRING '[' error ']'
       
  4495 	{$$ = NULL;
       
  4496 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited double byte string type specification.");
       
  4497 	 yyerrok;
       
  4498 	}
       
  4499 | WSTRING '[' error ']' ASSIGN single_byte_character_string
       
  4500 	{$$ = NULL;
       
  4501 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited double byte string type specification.");
       
  4502 	 yyerrok;
       
  4503 	}
       
  4504 | WSTRING '[' ']'
       
  4505 	{$$ = NULL;
       
  4506 	 yynerrs++;
       
  4507 	 print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited double byte string type specification.");
       
  4508 	}
       
  4509 | WSTRING '[' ']' ASSIGN single_byte_character_string
       
  4510 	{$$ = NULL;
       
  4511 	 yynerrs++;
       
  4512 	 print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited double byte string type specification.");
       
  4513 	}
       
  4514 | WSTRING '[' integer error
       
  4515 	{$$ = NULL;
       
  4516 	 print_err_msg(current_filename, locf(@3), locl(@3), "expecting ']' after length definition for limited double byte string type specification.");
       
  4517 	 yyerrok;
       
  4518 	}
       
  4519 | WSTRING '[' integer error ASSIGN single_byte_character_string
       
  4520 	{$$ = NULL;
       
  4521 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting ']' after length definition for limited double byte string type specification.");
       
  4522 	 yyerrok;
       
  4523 	}
       
  4524 | WSTRING '[' integer ']' single_byte_character_string
       
  4525 	{$$ = NULL;
       
  4526 	 yynerrs++;
       
  4527 	 print_err_msg(current_filename, locf(@4), locl(@5), "':=' missing before limited double byte string type initialization.");
       
  4528 	}
       
  4529 | WSTRING '[' integer ']' ASSIGN error
       
  4530 	{$$ = NULL;
       
  4531 	 print_err_msg(current_filename, locf(@5), locl(@5), "invalid value for limited double byte string type initialization.");
       
  4532 	 yyerrok;
       
  4533 	}
       
  4534 /* ERROR_CHECK_END */
  3134 ;
  4535 ;
  3135 
  4536 
  3136 
  4537 
  3137 
  4538 
  3138 incompl_located_var_declarations:
  4539 incompl_located_var_declarations:
  3140 	{$$ = new incompl_located_var_declarations_c(NULL, $2, locloc(@$));}
  4541 	{$$ = new incompl_located_var_declarations_c(NULL, $2, locloc(@$));}
  3141 | VAR     RETAIN incompl_located_var_decl_list END_VAR
  4542 | VAR     RETAIN incompl_located_var_decl_list END_VAR
  3142 	{$$ = new incompl_located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  4543 	{$$ = new incompl_located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3143 | VAR NON_RETAIN incompl_located_var_decl_list END_VAR
  4544 | VAR NON_RETAIN incompl_located_var_decl_list END_VAR
  3144 	{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  4545 	{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
       
  4546 /* ERROR_CHECK_BEGIN */
       
  4547 | VAR error incompl_located_var_decl_list END_VAR
       
  4548 	{$$ = NULL;
       
  4549 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in incomplete located variable(s) declaration.");
       
  4550 	 yyerrok;
       
  4551 	}
       
  4552 | VAR RETAIN error incompl_located_var_decl_list END_VAR
       
  4553 	{$$ = NULL;
       
  4554 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive located variable(s) declaration.");
       
  4555 	 yyerrok;
       
  4556 	}
       
  4557 | VAR NON_RETAIN error incompl_located_var_decl_list END_VAR
       
  4558 	{$$ = NULL;
       
  4559 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration.");
       
  4560 	 yyerrok;
       
  4561 	}
       
  4562 /* ERROR_CHECK_END */
  3145 ;
  4563 ;
  3146 
  4564 
  3147 /* helper symbol for incompl_located_var_declarations */
  4565 /* helper symbol for incompl_located_var_declarations */
  3148 incompl_located_var_decl_list:
  4566 incompl_located_var_decl_list:
  3149   incompl_located_var_decl ';'
  4567   incompl_located_var_decl ';'
  3150 	{$$ = new incompl_located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  4568 	{$$ = new incompl_located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
  3151 | incompl_located_var_decl_list incompl_located_var_decl ';'
  4569 | incompl_located_var_decl_list incompl_located_var_decl ';'
  3152 	{$$ = $1; $$->add_element($2);}
  4570 	{$$ = $1; $$->add_element($2);}
       
  4571 /* ERROR_CHECK_BEGIN */
       
  4572 | incompl_located_var_decl error
       
  4573 	{$$ = NULL;
       
  4574 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of incomplete located variable declaration.");
       
  4575 	 yyerrok;
       
  4576 	}
       
  4577 | incompl_located_var_decl_list incompl_located_var_decl error
       
  4578 	{$$ = NULL;
       
  4579 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of incomplete located variable declaration.");
       
  4580 	 yyerrok;
       
  4581 	}
       
  4582 | incompl_located_var_decl_list ';'
       
  4583 	{$$ = NULL;
       
  4584 	 yynerrs++;
       
  4585 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after incomplete located variable declaration.");
       
  4586 	}
       
  4587 /* ERROR_CHECK_END */
  3153 ;
  4588 ;
  3154 
  4589 
  3155 
  4590 
  3156 incompl_located_var_decl:
  4591 incompl_located_var_decl:
  3157   variable_name incompl_location ':' var_spec
  4592   variable_name incompl_location ':' var_spec
  3158 	{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));}
  4593 	{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));}
       
  4594 /* ERROR_CHECK_BEGIN */
       
  4595 | variable_name incompl_location ':' error
       
  4596 	{$$ = NULL;
       
  4597 	 print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in incomplete located variable declaration.");
       
  4598 	 yyerrok;
       
  4599 	}
       
  4600 | variable_name incompl_location var_spec
       
  4601 	{$$ = NULL;
       
  4602 	 yynerrs++;
       
  4603 	 print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between incomplete located variable and type specification.");
       
  4604 	}
       
  4605 /* ERROR_CHECK_END */
  3159 ;
  4606 ;
  3160 
  4607 
  3161 
  4608 
  3162 incompl_location:
  4609 incompl_location:
  3163   AT incompl_location_token
  4610   AT incompl_location_token
  3210 var_init_decl_list:
  4657 var_init_decl_list:
  3211   var_init_decl ';'
  4658   var_init_decl ';'
  3212 	{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}
  4659 	{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}
  3213 | var_init_decl_list var_init_decl ';'
  4660 | var_init_decl_list var_init_decl ';'
  3214 	{$$ = $1; $$->add_element($2);}
  4661 	{$$ = $1; $$->add_element($2);}
       
  4662 /* ERROR_CHECK_BEGIN */
       
  4663 | var_init_decl_list var_init_decl error
       
  4664 	{$$ = NULL;
       
  4665 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of variable declaration.");
       
  4666 	 yyerrok;
       
  4667 	}
       
  4668 /* ERROR_CHECK_END */
  3215 ;
  4669 ;
  3216 
  4670 
  3217 
  4671 
  3218 
  4672 
  3219 
  4673 
  3421 	 } else {
  4875 	 } else {
  3422 	   library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  4876 	   library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  3423 	 }
  4877 	 }
  3424 	}
  4878 	}
  3425 /* ERROR_CHECK_BEGIN */
  4879 /* ERROR_CHECK_BEGIN */
  3426 | FUNCTION error END_FUNCTION
  4880 | function_name_declaration elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
  3427 	{$$ = NULL;
  4881 	{$$ = NULL;
  3428 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in function declaration.");
  4882 	 yynerrs++;
  3429 	 /* yychar */
  4883 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after function name in function declaration.");
       
  4884 	}
       
  4885 | function_name_declaration derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
       
  4886 	{$$ = NULL;
       
  4887 	 yynerrs++;
       
  4888 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after function name in function declaration.");
       
  4889 	}
       
  4890 | function_name_declaration error derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
       
  4891 	{$$ = NULL;
       
  4892 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' after function name in function declaration.");
       
  4893 	 yyerrok;
       
  4894 	}
       
  4895 | function_name_declaration ':' io_OR_function_var_declarations_list function_body END_FUNCTION
       
  4896 	{$$ = NULL;
       
  4897 	 yynerrs++;
       
  4898 	 print_err_msg(current_filename, locf(@2), locl(@3), "no return type defined in function declaration.");
       
  4899 	}
       
  4900 | function_name_declaration ':' error io_OR_function_var_declarations_list function_body END_FUNCTION
       
  4901 	{$$ = NULL;
       
  4902 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid return type defined in function declaration.");
       
  4903 	 yyerrok;
       
  4904 	}
       
  4905 | function_name_declaration ':' identifier io_OR_function_var_declarations_list function_body END_FUNCTION
       
  4906 	{$$ = NULL;
       
  4907 	 yynerrs++;
       
  4908 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown return type defined in function declaration.");
       
  4909 	}
       
  4910 | function_name_declaration ':' elementary_type_name function_body END_FUNCTION
       
  4911 	{$$ = NULL;
       
  4912 	 yynerrs++;
       
  4913 	 print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared in function declaration.");
       
  4914 	}
       
  4915 | function_name_declaration ':' derived_type_name function_body END_FUNCTION
       
  4916 	{$$ = NULL;
       
  4917 	 yynerrs++;
       
  4918 	 print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared in function declaration.");
       
  4919 	}
       
  4920 | function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list END_FUNCTION
       
  4921 	{$$ = NULL;
       
  4922 	 yynerrs++;
       
  4923 	 print_err_msg(current_filename, locf(@4), locl(@5), "no body defined in function declaration.");
       
  4924 	}
       
  4925 | function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list END_FUNCTION
       
  4926 	{$$ = NULL;
       
  4927 	 yynerrs++;
       
  4928 	 print_err_msg(current_filename, locf(@4), locl(@5), "no body defined in function declaration.");
       
  4929 	}
       
  4930 | function_name_declaration ':' elementary_type_name END_FUNCTION
       
  4931 	{$$ = NULL;
       
  4932 	 yynerrs++;
       
  4933 	 print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared and body defined in function declaration.");
       
  4934 	}
       
  4935 | function_name_declaration ':' derived_type_name END_FUNCTION
       
  4936 	{$$ = NULL;
       
  4937 	 yynerrs++;
       
  4938 	 print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared and body defined in function declaration.");
       
  4939 	}
       
  4940 | function_name_declaration error END_FUNCTION
       
  4941 	{$$ = NULL;
       
  4942 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in function declaration.");
  3430 	 yyerrok;
  4943 	 yyerrok;
  3431 	}
  4944 	}
  3432 /* ERROR_CHECK_END */
  4945 /* ERROR_CHECK_END */
  3433 ;
  4946 ;
  3434 
  4947 
  3474 	  * is cleared once the end of the function
  4987 	  * is cleared once the end of the function
  3475 	  * is parsed.
  4988 	  * is parsed.
  3476 	  */
  4989 	  */
  3477 	 variable_name_symtable.insert($2, prev_declared_variable_name_token);
  4990 	 variable_name_symtable.insert($2, prev_declared_variable_name_token);
  3478 	}
  4991 	}
       
  4992 /* ERROR_CHECK_BEGIN */
       
  4993 | FUNCTION error 
       
  4994 	{$$ = NULL;
       
  4995 	 print_err_msg(current_filename, locf(@1), locl(@1), "no function name defined in function declaration.");
       
  4996 	 yyerrok;
       
  4997 	}
       
  4998 /* ERROR_CHECK_END */
  3479 ;
  4999 ;
  3480 
  5000 
  3481 
  5001 
  3482 
  5002 
  3483 /* intermediate helper symbol for function_declaration */
  5003 /* intermediate helper symbol for function_declaration */
  3484 io_OR_function_var_declarations_list:
  5004 io_OR_function_var_declarations_list:
  3485   /* empty */
  5005   io_var_declarations
  3486 	{$$ = new var_declarations_list_c(locloc(@$));}
  5006   {$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);}
       
  5007 | function_var_decls
       
  5008 	{$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);}
  3487 | io_OR_function_var_declarations_list io_var_declarations
  5009 | io_OR_function_var_declarations_list io_var_declarations
  3488 	{$$ = $1; $$->add_element($2);}
  5010 	{$$ = $1; $$->add_element($2);}
  3489 | io_OR_function_var_declarations_list function_var_decls
  5011 | io_OR_function_var_declarations_list function_var_decls
  3490 	{$$ = $1; $$->add_element($2);}
  5012 	{$$ = $1; $$->add_element($2);}
       
  5013 /* ERROR_CHECK_BEGIN */
       
  5014 | io_OR_function_var_declarations_list error 
       
  5015 	{$$ = NULL;
       
  5016 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in function declaration.");
       
  5017 	 yyerrok;
       
  5018 	}
       
  5019 /* ERROR_CHECK_END */
  3491 ;
  5020 ;
  3492 
  5021 
  3493 
  5022 
  3494 io_var_declarations:
  5023 io_var_declarations:
  3495   input_declarations
  5024   input_declarations
  3501 function_var_decls:
  5030 function_var_decls:
  3502   VAR CONSTANT var2_init_decl_list END_VAR
  5031   VAR CONSTANT var2_init_decl_list END_VAR
  3503 	{$$ = new function_var_decls_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  5032 	{$$ = new function_var_decls_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
  3504 | VAR var2_init_decl_list END_VAR
  5033 | VAR var2_init_decl_list END_VAR
  3505 	{$$ = new function_var_decls_c(NULL, $2, locloc(@$));}
  5034 	{$$ = new function_var_decls_c(NULL, $2, locloc(@$));}
       
  5035 /* ERROR_CHECK_BEGIN */
       
  5036 | VAR error var_init_decl_list END_VAR
       
  5037 	{$$ = NULL;
       
  5038 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in function variable(s) declaration.");
       
  5039 	 yyerrok;
       
  5040 	}
       
  5041 | VAR CONSTANT error var_init_decl_list END_VAR
       
  5042 	{$$ = NULL;
       
  5043 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant function variable(s) declaration.");
       
  5044 	 yyerrok;
       
  5045 	}
       
  5046 /* ERROR_CHECK_END */
  3506 ;
  5047 ;
  3507 
  5048 
  3508 /* intermediate helper symbol for function_var_decls */
  5049 /* intermediate helper symbol for function_var_decls */
  3509 var2_init_decl_list:
  5050 var2_init_decl_list:
  3510   var2_init_decl ';'
  5051   var2_init_decl ';'
  3511 	{$$ = new var2_init_decl_list_c(locloc(@$)); $$->add_element($1);}
  5052 	{$$ = new var2_init_decl_list_c(locloc(@$)); $$->add_element($1);}
  3512 | var2_init_decl_list var2_init_decl ';'
  5053 | var2_init_decl_list var2_init_decl ';'
  3513 	{$$ = $1; $$->add_element($2);}
  5054 	{$$ = $1; $$->add_element($2);}
       
  5055 /* ERROR_CHECK_BEGIN */
       
  5056 | var2_init_decl error
       
  5057 	{$$ = NULL;
       
  5058 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of function variable(s) declaration.");
       
  5059 	 yyerrok;
       
  5060 	}
       
  5061 | var2_init_decl_list var2_init_decl error
       
  5062 	{$$ = NULL;
       
  5063 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of function variable(s) declaration.");
       
  5064 	 yyerrok;
       
  5065 	}
       
  5066 | var2_init_decl_list ';'
       
  5067 	{$$ = NULL;
       
  5068 	 yynerrs++;
       
  5069 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after function variable(s) declaration.");
       
  5070 	}
       
  5071 /* ERROR_CHECK_END */
  3514 ;
  5072 ;
  3515 
  5073 
  3516 
  5074 
  3517 function_body:
  5075 function_body:
  3518   statement_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
  5076   statement_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
  3557 	  * are no longer valid!
  5115 	  * are no longer valid!
  3558 	  */
  5116 	  */
  3559 	 variable_name_symtable.pop();
  5117 	 variable_name_symtable.pop();
  3560 	}
  5118 	}
  3561 /* ERROR_CHECK_BEGIN */
  5119 /* ERROR_CHECK_BEGIN */
       
  5120 | FUNCTION_BLOCK io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
       
  5121   {$$ = NULL;
       
  5122 	 yynerrs++;
       
  5123 	 print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in function block declaration.");
       
  5124 	}
       
  5125 | FUNCTION_BLOCK error io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
       
  5126 	{$$ = NULL;
       
  5127 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name in function block declaration.");
       
  5128 	 yyerrok;
       
  5129 	}
       
  5130 | FUNCTION_BLOCK derived_function_block_name function_block_body END_FUNCTION_BLOCK
       
  5131 	{$$ = NULL;
       
  5132 	 yynerrs++;
       
  5133 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared in function declaration.");
       
  5134 	}
       
  5135 | FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list END_FUNCTION_BLOCK
       
  5136 	{$$ = NULL;
       
  5137 	 yynerrs++;
       
  5138 	 print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in function block declaration.");
       
  5139 	}
       
  5140 | FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK
       
  5141 	{$$ = NULL;
       
  5142 	 yynerrs++;
       
  5143 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared and body defined in function block declaration.");
       
  5144 	}
  3562 | FUNCTION_BLOCK error END_FUNCTION_BLOCK
  5145 | FUNCTION_BLOCK error END_FUNCTION_BLOCK
  3563 	{$$ = NULL;
  5146 	{$$ = NULL;
  3564 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in function block declaration.");
  5147 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in function block declaration.");
  3565 	 /* yychar */
       
  3566 	 yyerrok;
  5148 	 yyerrok;
  3567 	}
  5149 	}
  3568 /* ERROR_CHECK_END */
  5150 /* ERROR_CHECK_END */
  3569 ;
  5151 ;
  3570 
  5152 
  3574 /*  { io_var_declarations | other_var_declarations }   */
  5156 /*  { io_var_declarations | other_var_declarations }   */
  3575 /*
  5157 /*
  3576  * NOTE: we re-use the var_declarations_list_c
  5158  * NOTE: we re-use the var_declarations_list_c
  3577  */
  5159  */
  3578 io_OR_other_var_declarations_list:
  5160 io_OR_other_var_declarations_list:
  3579   /* empty */
  5161   io_var_declarations
  3580 	{$$ = new var_declarations_list_c(locloc(@$));}
  5162   {$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);}
       
  5163 | other_var_declarations
       
  5164   {$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);}
  3581 | io_OR_other_var_declarations_list io_var_declarations
  5165 | io_OR_other_var_declarations_list io_var_declarations
  3582 	{$$ = $1; $$->add_element($2);}
  5166 	{$$ = $1; $$->add_element($2);}
  3583 | io_OR_other_var_declarations_list other_var_declarations
  5167 | io_OR_other_var_declarations_list other_var_declarations
  3584 	{$$ = $1; $$->add_element($2);}
  5168 	{$$ = $1; $$->add_element($2);}
       
  5169 /* ERROR_CHECK_BEGIN */
       
  5170 | io_OR_other_var_declarations_list error 
       
  5171 	{$$ = NULL;
       
  5172 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in function declaration.");
       
  5173 	 yyerrok;
       
  5174 	}
       
  5175 /* ERROR_CHECK_END */
  3585 ;
  5176 ;
  3586 
  5177 
  3587 /* NOTE:
  5178 /* NOTE:
  3588  *  The IEC specification gives the following definition:
  5179  *  The IEC specification gives the following definition:
  3589  *  other_var_declarations ::=
  5180  *  other_var_declarations ::=
  3605 | non_retentive_var_decls
  5196 | non_retentive_var_decls
  3606 | external_var_declarations
  5197 | external_var_declarations
  3607 | var_declarations
  5198 | var_declarations
  3608 | retentive_var_declarations
  5199 | retentive_var_declarations
  3609 | incompl_located_var_declarations
  5200 | incompl_located_var_declarations
  3610 /* TODO: the following error rule is not working! Must be fixed. */
       
  3611 /* ERROR_CHECK_BEGIN */
       
  3612 | VAR error END_VAR
       
  3613 	{$$ = NULL;
       
  3614 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in variable(s) declaration.");
       
  3615 	 /* yychar */
       
  3616 	 yyerrok;
       
  3617 	}
       
  3618 /* ERROR_CHECK_END */
       
  3619 ;
  5201 ;
  3620 
  5202 
  3621 
  5203 
  3622 temp_var_decls:
  5204 temp_var_decls:
  3623   VAR_TEMP temp_var_decls_list END_VAR
  5205   VAR_TEMP temp_var_decls_list END_VAR
  3624 	{$$ = new temp_var_decls_c($2, locloc(@$));}
  5206 	{$$ = new temp_var_decls_c($2, locloc(@$));}
       
  5207 /* ERROR_CHECK_BEGIN */
       
  5208 | VAR_TEMP END_VAR
       
  5209 	{$$ = NULL;
       
  5210 	 yynerrs++;
       
  5211 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in temporary variable(s) declaration.");
       
  5212 	}
       
  5213 | VAR_TEMP error temp_var_decls_list END_VAR
       
  5214 	{$$ = NULL;
       
  5215 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_TEMP' in function variable(s) declaration.");
       
  5216 	 yyerrok;
       
  5217 	}
       
  5218 /* ERROR_CHECK_END */
  3625 ;
  5219 ;
  3626 
  5220 
  3627 
  5221 
  3628 /* intermediate helper symbol for temp_var_decls */
  5222 /* intermediate helper symbol for temp_var_decls */
  3629 temp_var_decls_list:
  5223 temp_var_decls_list:
  3630   temp_var_decl ';'
  5224   temp_var_decl ';'
  3631 	{$$ = new temp_var_decls_list_c(locloc(@$)); $$->add_element($1);}
  5225 	{$$ = new temp_var_decls_list_c(locloc(@$)); $$->add_element($1);}
  3632 | temp_var_decls_list temp_var_decl ';'
  5226 | temp_var_decls_list temp_var_decl ';'
  3633 	{$$ = $1; $$->add_element($2);}
  5227 	{$$ = $1; $$->add_element($2);}
       
  5228 /* ERROR_CHECK_BEGIN */
       
  5229 | temp_var_decl error
       
  5230 	{$$ = NULL;
       
  5231 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of temporary variable declaration.");
       
  5232 	 yyerrok;
       
  5233 	}
       
  5234 | temp_var_decls_list temp_var_decl error
       
  5235 	{$$ = NULL;
       
  5236 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of temporary variable declaration.");
       
  5237 	 yyerrok;
       
  5238 	}
       
  5239 | temp_var_decls_list ';'
       
  5240 	{$$ = NULL;
       
  5241 	 yynerrs++;
       
  5242 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after temporary variable declaration.");
       
  5243 	}
       
  5244 /* ERROR_CHECK_END */
  3634 ;
  5245 ;
  3635 
  5246 
  3636 
  5247 
  3637 non_retentive_var_decls:
  5248 non_retentive_var_decls:
  3638   VAR NON_RETAIN var_init_decl_list END_VAR
  5249   VAR NON_RETAIN var_init_decl_list END_VAR
  3639 	{$$ = new non_retentive_var_decls_c($3, locloc(@$));}
  5250 	{$$ = new non_retentive_var_decls_c($3, locloc(@$));}
       
  5251 /* ERROR_CHECK_BEGIN */
       
  5252 | VAR NON_RETAIN error var_init_decl_list END_VAR
       
  5253 	{$$ = NULL;
       
  5254 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive temporary variable(s) declaration.");
       
  5255 	 yyerrok;
       
  5256 	}
       
  5257 /* ERROR_CHECK_END */
  3640 ;
  5258 ;
  3641 
  5259 
  3642 
  5260 
  3643 
  5261 
  3644 function_block_body:
  5262 function_block_body:
  3671 	  * are no longer valid!
  5289 	  * are no longer valid!
  3672 	  */
  5290 	  */
  3673 	 variable_name_symtable.pop();
  5291 	 variable_name_symtable.pop();
  3674 	}
  5292 	}
  3675 /* ERROR_CHECK_BEGIN */
  5293 /* ERROR_CHECK_BEGIN */
       
  5294 | PROGRAM program_var_declarations_list function_block_body END_PROGRAM
       
  5295   {$$ = NULL;
       
  5296 	 yynerrs++;
       
  5297 	 print_err_msg(current_filename, locf(@1), locl(@2), "no program name defined in program declaration.");
       
  5298 	}
       
  5299 | PROGRAM error program_var_declarations_list function_block_body END_PROGRAM
       
  5300 	{$$ = NULL;
       
  5301 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid program name in program declaration.");
       
  5302 	 yyerrok;
       
  5303 	}
       
  5304 | PROGRAM program_type_name function_block_body END_PROGRAM
       
  5305 	{$$ = NULL;
       
  5306 	 yynerrs++;
       
  5307 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared in program declaration.");
       
  5308 	}
       
  5309 | PROGRAM program_type_name program_var_declarations_list END_PROGRAM
       
  5310 	{$$ = NULL;
       
  5311 	 yynerrs++;
       
  5312 	 print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in program declaration.");
       
  5313 	}
       
  5314 | PROGRAM program_type_name END_PROGRAM
       
  5315 	{$$ = NULL;
       
  5316 	 yynerrs++;
       
  5317 	 print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared and body defined in program declaration.");
       
  5318 	}
  3676 | PROGRAM error END_PROGRAM
  5319 | PROGRAM error END_PROGRAM
  3677 	{$$ = NULL;
  5320 	{$$ = NULL;
  3678 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in function block declaration.");
  5321 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in program declaration.");
  3679 	 /* yychar */
       
  3680 	 yyerrok;
  5322 	 yyerrok;
  3681 	}
  5323 	}
  3682 /* ERROR_CHECK_END */
  5324 /* ERROR_CHECK_END */
  3683 ;
  5325 ;
  3684 
  5326 
  3686 /* helper symbol for program_declaration */
  5328 /* helper symbol for program_declaration */
  3687 /*
  5329 /*
  3688  * NOTE: we re-use the var_declarations_list_c
  5330  * NOTE: we re-use the var_declarations_list_c
  3689  */
  5331  */
  3690 program_var_declarations_list:
  5332 program_var_declarations_list:
  3691   /* empty */
  5333   io_var_declarations
  3692 	{$$ = new var_declarations_list_c(locloc(@$));}
  5334 	{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
       
  5335 | other_var_declarations
       
  5336 	{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
       
  5337 | located_var_declarations
       
  5338 	{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
  3693 | program_var_declarations_list io_var_declarations
  5339 | program_var_declarations_list io_var_declarations
  3694 	{$$ = $1; $$->add_element($2);}
  5340 	{$$ = $1; $$->add_element($2);}
  3695 | program_var_declarations_list other_var_declarations
  5341 | program_var_declarations_list other_var_declarations
  3696 	{$$ = $1; $$->add_element($2);}
  5342 	{$$ = $1; $$->add_element($2);}
  3697 | program_var_declarations_list located_var_declarations
  5343 | program_var_declarations_list located_var_declarations
  3698 	{$$ = $1; $$->add_element($2);}
  5344 	{$$ = $1; $$->add_element($2);}
  3699 /*
  5345 /*
  3700 | program_var_declarations_list program_access_decls
  5346 | program_var_declarations_list program_access_decls
  3701 	{$$ = $1; $$->add_element($2);}
  5347 	{$$ = $1; $$->add_element($2);}
  3702 */
  5348 */
       
  5349 /* ERROR_CHECK_BEGIN */
       
  5350 | program_var_declarations_list error 
       
  5351 	{$$ = NULL;
       
  5352 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in program declaration.");
       
  5353 	 yyerrok;
       
  5354 	}
       
  5355 /* ERROR_CHECK_END */
  3703 ;
  5356 ;
  3704 
  5357 
  3705 
  5358 
  3706 /* TODO ... */
  5359 /* TODO ... */
  3707 /*
  5360 /*
  3745 	{$$ = $1; $$->add_element($2);}
  5398 	{$$ = $1; $$->add_element($2);}
  3746 | sfc_network transition
  5399 | sfc_network transition
  3747 	{$$ = $1; $$->add_element($2);}
  5400 	{$$ = $1; $$->add_element($2);}
  3748 | sfc_network action
  5401 | sfc_network action
  3749 	{$$ = $1; $$->add_element($2);}
  5402 	{$$ = $1; $$->add_element($2);}
       
  5403 /* ERROR_CHECK_BEGIN */
       
  5404 | sfc_network error 
       
  5405 	{$$ = NULL;
       
  5406 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after SFC network in sequencial function chart.");
       
  5407 	 yyerrok;
       
  5408 	}
       
  5409 /* ERROR_CHECK_END */
  3750 ;
  5410 ;
  3751 
  5411 
  3752 initial_step:
  5412 initial_step:
  3753   INITIAL_STEP step_name ':' action_association_list END_STEP
  5413   INITIAL_STEP step_name ':' action_association_list END_STEP
  3754 //  INITIAL_STEP identifier ':' action_association_list END_STEP
  5414 //  INITIAL_STEP identifier ':' action_association_list END_STEP
  3755 	{$$ = new initial_step_c($2, $4, locloc(@$));}
  5415 	{$$ = new initial_step_c($2, $4, locloc(@$));}
       
  5416 /* ERROR_CHECK_BEGIN */
       
  5417 | INITIAL_STEP ':' action_association_list END_STEP
       
  5418   {$$ = NULL;
       
  5419 	 yynerrs++;
       
  5420 	 print_err_msg(current_filename, locf(@1), locl(@2), "no step name defined in initial step declaration.");
       
  5421 	}
       
  5422 | INITIAL_STEP error ':' action_association_list END_STEP
       
  5423 	{$$ = NULL;
       
  5424 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid step name defined in initial step declaration.");
       
  5425 	 yyerrok;
       
  5426 	}
       
  5427 | INITIAL_STEP step_name action_association_list END_STEP
       
  5428 	{$$ = NULL;
       
  5429 	 yynerrs++;
       
  5430 	 print_err_msg(current_filename, locf(@2), locl(@3), "':' missing after step name in initial step declaration.");
       
  5431 	}
       
  5432 | INITIAL_STEP step_name error action_association_list END_STEP
       
  5433 	{$$ = NULL;
       
  5434 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':' after step name in initial step declaration.");
       
  5435 	 yyerrok;
       
  5436 	}
       
  5437 | INITIAL_STEP step_name ':' error END_STEP
       
  5438 	{$$ = NULL;
       
  5439 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid action association list in initial step declaration.");
       
  5440 	 yyerrok;
       
  5441 	}
       
  5442 | INITIAL_STEP error END_STEP
       
  5443 	{$$ = NULL;
       
  5444 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in initial step declaration.");
       
  5445 	 yyerrok;
       
  5446 	}
       
  5447 /* ERROR_CHECK_END */
  3756 ;
  5448 ;
  3757 
  5449 
  3758 step:
  5450 step:
  3759   STEP step_name ':' action_association_list END_STEP
  5451   STEP step_name ':' action_association_list END_STEP
  3760 //  STEP identifier ':' action_association_list END_STEP
  5452 //  STEP identifier ':' action_association_list END_STEP
  3761 	{$$ = new step_c($2, $4, locloc(@$));}
  5453 	{$$ = new step_c($2, $4, locloc(@$));}
       
  5454 /* ERROR_CHECK_BEGIN */
       
  5455 | STEP ':' action_association_list END_STEP
       
  5456   {$$ = NULL;
       
  5457 	 yynerrs++;
       
  5458 	 print_err_msg(current_filename, locf(@1), locl(@2), "no step name defined in step declaration.");
       
  5459 	}
       
  5460 | STEP error ':' action_association_list END_STEP
       
  5461 	{$$ = NULL;
       
  5462 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid step name defined in step declaration.");
       
  5463 	 yyerrok;
       
  5464 	}
       
  5465 | STEP step_name action_association_list END_STEP
       
  5466 	{$$ = NULL;
       
  5467 	 yynerrs++;
       
  5468 	 print_err_msg(current_filename, locf(@2), locl(@3), "':' missing after step name in step declaration.");
       
  5469 	}
       
  5470 | STEP step_name error action_association_list END_STEP
       
  5471 	{$$ = NULL;
       
  5472 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':' after step name in step declaration.");
       
  5473 	 yyerrok;
       
  5474 	}
       
  5475 | STEP step_name ':' error END_STEP
       
  5476 	{$$ = NULL;
       
  5477 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid action association list in step declaration.");
       
  5478 	 yyerrok;
       
  5479 	}
       
  5480 | STEP error END_STEP
       
  5481 	{$$ = NULL;
       
  5482 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in step declaration.");
       
  5483 	 yyerrok;
       
  5484 	}
       
  5485 /* ERROR_CHECK_END */
  3762 ;
  5486 ;
  3763 
  5487 
  3764 /* helper symbol for:
  5488 /* helper symbol for:
  3765  *  - initial_step
  5489  *  - initial_step
  3766  *  - step
  5490  *  - step
  3768 action_association_list:
  5492 action_association_list:
  3769   /* empty */
  5493   /* empty */
  3770 	{$$ = new action_association_list_c(locloc(@$));}
  5494 	{$$ = new action_association_list_c(locloc(@$));}
  3771 | action_association_list action_association ';'
  5495 | action_association_list action_association ';'
  3772 	{$$ = $1; $$->add_element($2);}
  5496 	{$$ = $1; $$->add_element($2);}
       
  5497 /* ERROR_CHECK_BEGIN */
       
  5498 | action_association_list action_association error
       
  5499 	{$$ = NULL;
       
  5500 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of action association declaration.");
       
  5501 	 yyerrok;
       
  5502 	}
       
  5503 | action_association_list ';'
       
  5504 	{$$ = NULL;
       
  5505 	 yynerrs++;
       
  5506 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after action association declaration.");
       
  5507 	}
       
  5508 /* ERROR_CHECK_END */
  3773 ;
  5509 ;
  3774 
  5510 
  3775 
  5511 
  3776 // step_name: identifier;
  5512 // step_name: identifier;
  3777 step_name: any_identifier;
  5513 step_name: any_identifier;
  3778 
  5514 
  3779 action_association:
  5515 action_association:
  3780   action_name '(' {cmd_goto_sfc_qualifier_state()} action_qualifier {cmd_pop_state()} indicator_name_list ')'
  5516   action_name '(' {cmd_goto_sfc_qualifier_state()} action_qualifier {cmd_pop_state()} indicator_name_list ')'
  3781 	{$$ = new action_association_c($1, $4, $6, locloc(@$));}
  5517 	{$$ = new action_association_c($1, $4, $6, locloc(@$));}
       
  5518 /* ERROR_CHECK_BEGIN */
       
  5519 /*| action_name '(' error indicator_name_list ')'
       
  5520   {$$ = NULL;
       
  5521 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid qualifier defined in action association.");
       
  5522 	 yyerrok;
       
  5523 	}*/
       
  5524 /* ERROR_CHECK_END */
  3782 ;
  5525 ;
  3783 
  5526 
  3784 /* helper symbol for action_association */
  5527 /* helper symbol for action_association */
  3785 indicator_name_list:
  5528 indicator_name_list:
  3786   /* empty */
  5529   /* empty */
  3787 	{$$ = new indicator_name_list_c(locloc(@$));}
  5530 	{$$ = new indicator_name_list_c(locloc(@$));}
  3788 | indicator_name_list ',' indicator_name
  5531 | indicator_name_list ',' indicator_name
  3789 	{$$ = $1; $$->add_element($3);}
  5532 	{$$ = $1; $$->add_element($3);}
       
  5533 /* ERROR_CHECK_BEGIN */
       
  5534 | indicator_name_list indicator_name
       
  5535 	{$$ = NULL;
       
  5536 	 yynerrs++;
       
  5537 	 print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at end of action association declaration.");
       
  5538 	}
       
  5539 | indicator_name_list ',' error
       
  5540 	{$$ = NULL;
       
  5541 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected token after ',' in indicator list.");
       
  5542 	 yyerrok;
       
  5543 	}
       
  5544 /* ERROR_CHECK_END */
  3790 ;
  5545 ;
  3791 
  5546 
  3792 // action_name: identifier;
  5547 // action_name: identifier;
  3793 action_name: any_identifier;
  5548 action_name: any_identifier;
  3794 
  5549 
  3797 	{$$ = NULL;}
  5552 	{$$ = NULL;}
  3798 | qualifier
  5553 | qualifier
  3799 	{$$ = new action_qualifier_c($1, NULL, locloc(@$));}
  5554 	{$$ = new action_qualifier_c($1, NULL, locloc(@$));}
  3800 | timed_qualifier ',' action_time
  5555 | timed_qualifier ',' action_time
  3801 	{$$ = new action_qualifier_c($1, $3, locloc(@$));}
  5556 	{$$ = new action_qualifier_c($1, $3, locloc(@$));}
       
  5557 /* ERROR_CHECK_BEGIN */
       
  5558 | timed_qualifier action_time
       
  5559 	{$$ = NULL;
       
  5560 	 yynerrs++;
       
  5561 	 print_err_msg(current_filename, locf(@1), locl(@1), "',' missing between timed qualifier and action time in action qualifier.");
       
  5562 	}
       
  5563 | timed_qualifier ',' error
       
  5564 	{$$ = NULL;
       
  5565 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected token after ',' in action qualifier.");
       
  5566 	 yyerrok;
       
  5567 	}
       
  5568 /* ERROR_CHECK_END */
  3802 ;
  5569 ;
  3803 
  5570 
  3804 qualifier:
  5571 qualifier:
  3805   N		{$$ = new qualifier_c(strdup("N"), locloc(@$));}
  5572   N		{$$ = new qualifier_c(strdup("N"), locloc(@$));}
  3806 | R		{$$ = new qualifier_c(strdup("R"), locloc(@$));}
  5573 | R		{$$ = new qualifier_c(strdup("R"), locloc(@$));}
  3830 steps:
  5597 steps:
  3831   step_name
  5598   step_name
  3832 	{$$ = new steps_c($1, NULL, locloc(@$));}
  5599 	{$$ = new steps_c($1, NULL, locloc(@$));}
  3833 | '(' step_name_list ')'
  5600 | '(' step_name_list ')'
  3834 	{$$ = new steps_c(NULL, $2, locloc(@$));}
  5601 	{$$ = new steps_c(NULL, $2, locloc(@$));}
       
  5602 /* ERROR_CHECK_BEGIN */
       
  5603 | '(' step_name_list error
       
  5604 	{$$ = NULL;
       
  5605 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting ')' at the end of step list in transition declaration.");
       
  5606 	 yyerrok;
       
  5607 	}
       
  5608 | '(' error ')'
       
  5609 	{$$ = NULL;
       
  5610 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid step list in transition declaration.");
       
  5611 	 yyerrok;
       
  5612 	}
       
  5613 /* ERROR_CHECK_END */
  3835 ;
  5614 ;
  3836 
  5615 
  3837 step_name_list:
  5616 step_name_list:
  3838   step_name ',' step_name
  5617   step_name ',' step_name
  3839 	{$$ = new step_name_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
  5618 	{$$ = new step_name_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
  3840 | step_name_list ',' step_name
  5619 | step_name_list ',' step_name
  3841 	{$$ = $1; $$->add_element($3);}
  5620 	{$$ = $1; $$->add_element($3);}
       
  5621 /* ERROR_CHECK_BEGIN */
       
  5622 | step_name_list step_name
       
  5623 	{$$ = NULL;
       
  5624 	 yynerrs++;
       
  5625 	 print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in step list.");
       
  5626 	}
       
  5627 | step_name_list ',' error
       
  5628 	{$$ = NULL;
       
  5629 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid step name in step list.");
       
  5630 	 yyerrok;
       
  5631 	}
       
  5632 /* ERROR_CHECK_END */
  3842 ;
  5633 ;
  3843 
  5634 
  3844 
  5635 
  3845 /* NOTE: flex will automatically pop() out of body_state to previous state.
  5636 /* NOTE: flex will automatically pop() out of body_state to previous state.
  3846  *       We do not need to give a command from bison to return to previous flex state,
  5637  *       We do not need to give a command from bison to return to previous flex state,
  3847  *       after forcing flex to go to body_state.
  5638  *       after forcing flex to go to body_state.
  3848  */
  5639  */
  3849 transition:
  5640 transition:
  3850   TRANSITION 
  5641   TRANSITION transition_priority
  3851     FROM steps TO steps 
  5642     FROM steps TO steps 
  3852     {cmd_goto_body_state();} transition_condition 
  5643     {cmd_goto_body_state();} transition_condition 
  3853   END_TRANSITION 
  5644   END_TRANSITION 
  3854 	{$$ = new transition_c(NULL, NULL, $3, $5, $7, locloc(@$));}
  5645 	{$$ = new transition_c(NULL, $2, $4, $6, $8, locloc(@$));}
  3855 //| TRANSITION identifier FROM steps TO steps ... 
  5646 //| TRANSITION identifier FROM steps TO steps ... 
  3856 | TRANSITION transition_name 
  5647 | TRANSITION transition_name transition_priority
  3857     FROM steps TO steps 
  5648     FROM steps TO steps 
  3858     {cmd_goto_body_state();} transition_condition 
  5649     {cmd_goto_body_state();} transition_condition 
  3859   END_TRANSITION 
  5650   END_TRANSITION 
  3860 	{$$ = new transition_c($2, NULL, $4, $6, $8, locloc(@$));}
  5651 	{$$ = new transition_c($2, $3, $5, $7, $9, locloc(@$));}
  3861 | TRANSITION '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' 
  5652 /* ERROR_CHECK_BEGIN */
  3862     FROM steps TO steps 
  5653 | TRANSITION error transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
  3863     {cmd_goto_body_state();} transition_condition 
  5654 	{$$ = NULL;
  3864   END_TRANSITION
  5655 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid transition name defined in transition declaration.");
  3865         {$$ = new transition_c(NULL, $7, $10, $12, $14, locloc(@$));}
  5656 	 yyerrok;
  3866 //| TRANSITION identifier '(' PRIORITY ASSIGN integer ')' FROM steps TO steps ...
  5657 	} 
  3867 | TRANSITION transition_name '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' 
  5658 | TRANSITION transition_name error FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
  3868     FROM steps TO steps 
  5659 	{$$ = NULL;
  3869     {cmd_goto_body_state();} transition_condition 
  5660 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid transition priority defined in transition declaration.");
  3870   END_TRANSITION
  5661 	 yyerrok;
  3871         {$$ = new transition_c($2, $8, $11, $13, $15, locloc(@$));}
  5662 	}
  3872 ;
  5663 | TRANSITION transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
  3873 
  5664 	{$$ = NULL;
       
  5665 	 yynerrs++;
       
  5666 	 print_err_msg(current_filename, locf(@3), locl(@4), "no origin step(s) defined in transition declaration.");
       
  5667 	}
       
  5668 | TRANSITION transition_name transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5669 	{$$ = NULL;
       
  5670 	 yynerrs++;
       
  5671 	 print_err_msg(current_filename, locf(@4), locl(@5), "no origin step(s) defined in transition declaration.");
       
  5672 	}
       
  5673 | TRANSITION transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5674 	{$$ = NULL;
       
  5675 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid origin step(s) defined in transition declaration.");
       
  5676 	 yyerrok;
       
  5677 	}
       
  5678 | TRANSITION transition_name transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5679 	{$$ = NULL;
       
  5680 	 print_err_msg(current_filename, locf(@4), locl(@6), "invalid origin step(s) defined in transition declaration.");
       
  5681 	 yyerrok;
       
  5682 	}
       
  5683 | TRANSITION transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5684 	{$$ = NULL;
       
  5685 	 yynerrs++;
       
  5686 	 print_err_msg(current_filename, locf(@4), locl(@5), "'TO' missing between origin step(s) and destination step(s) in transition declaration.");
       
  5687 	}
       
  5688 | TRANSITION transition_name transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5689 	{$$ = NULL;
       
  5690 	 yynerrs++;
       
  5691 	 print_err_msg(current_filename, locf(@5), locl(@6), "'TO' missing between origin step(s) and destination step(s) in transition declaration.");
       
  5692 	}
       
  5693 | TRANSITION transition_priority FROM steps error steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5694 	{$$ = NULL;
       
  5695 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between origin step(s) and destination step(s) in transition declaration.");
       
  5696 	 yyerrok;
       
  5697 	}
       
  5698 | TRANSITION transition_name transition_priority FROM steps error steps {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5699 	{$$ = NULL;
       
  5700 	 print_err_msg(current_filename, locf(@5), locl(@7), "expecting 'TO' between origin step(s) and destination step(s) in transition declaration.");
       
  5701 	 yyerrok;
       
  5702 	}
       
  5703 | TRANSITION transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5704 	{$$ = NULL;
       
  5705 	 yynerrs++;
       
  5706 	 print_err_msg(current_filename, locf(@5), locl(@7), "no destination step(s) defined in transition declaration.");
       
  5707 	}
       
  5708 | TRANSITION transition_name transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5709 	{$$ = NULL;
       
  5710 	 yynerrs++;
       
  5711 	 print_err_msg(current_filename, locf(@6), locl(@8), "no destination step(s) defined in transition declaration.");
       
  5712 	}
       
  5713 | TRANSITION transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5714 	{$$ = NULL;
       
  5715 	 print_err_msg(current_filename, locf(@5), locl(@8), "invalid destination step(s) defined in transition declaration.");
       
  5716 	 yyerrok;
       
  5717 	}
       
  5718 | TRANSITION transition_name transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5719 	{$$ = NULL;
       
  5720 	 print_err_msg(current_filename, locf(@6), locl(@9), "invalid destination step(s) defined in transition declaration.");
       
  5721 	 yyerrok;
       
  5722 	}
       
  5723 | TRANSITION transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5724 	{$$ = NULL;
       
  5725 	 yynerrs++;
       
  5726 	 print_err_msg(current_filename, locf(@2), locl(@4), "no origin and destination step(s) defined in transition declaration.");
       
  5727 	}
       
  5728 | TRANSITION transition_name transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
       
  5729 	{$$ = NULL;
       
  5730 	 yynerrs++;
       
  5731 	 print_err_msg(current_filename, locf(@3), locl(@5), "no origin and destination step(s) defined in transition declaration.");
       
  5732 	}
       
  5733 | TRANSITION error END_TRANSITION
       
  5734 	{$$ = NULL;
       
  5735 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in transition declaration.");
       
  5736 	 yyerrok;
       
  5737 	}
       
  5738 /* ERROR_CHECK_END */
       
  5739 ;
       
  5740 
       
  5741 transition_priority:
       
  5742   /* empty */
       
  5743   {$$ = NULL;}
       
  5744 | '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')'
       
  5745 	{$$ = $6;}
       
  5746 ;
  3874 
  5747 
  3875 
  5748 
  3876 transition_condition:
  5749 transition_condition:
  3877   ':' eol_list simple_instr_list
  5750   ':' eol_list simple_instr_list
  3878 	{$$ = new transition_condition_c($3, NULL, locloc(@$));}
  5751 	{$$ = new transition_condition_c($3, NULL, locloc(@$));}
  3879 | ASSIGN expression ';'
  5752 | ASSIGN expression ';'
  3880 	{$$ = new transition_condition_c(NULL, $2, locloc(@$));}
  5753 	{$$ = new transition_condition_c(NULL, $2, locloc(@$));}
       
  5754 /* ERROR_CHECK_BEGIN */
       
  5755 | eol_list simple_instr_list
       
  5756 	{$$ = NULL;
       
  5757 	 yynerrs++;
       
  5758 	 print_err_msg(current_filename, locf(@1), locl(@1), "':' missing before IL condition in transition declaration.");
       
  5759 	}
       
  5760 | ':' eol_list error
       
  5761 	{$$ = NULL;
       
  5762 	 print_err_msg(current_filename, locf(@2), locl(@2), "no instructions defined in IL condition of transition declaration.");
       
  5763 	 yyerrok;
       
  5764 	}
       
  5765 | ASSIGN ';'
       
  5766 	{$$ = NULL;
       
  5767 	 print_err_msg(current_filename, locf(@2), locl(@2), "no expression defined in ST condition of transition declaration.");
       
  5768 	 yyerrok;
       
  5769 	}
       
  5770 | ASSIGN error ';'
       
  5771 	{$$ = NULL;
       
  5772 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression defined in ST condition of transition declaration.");
       
  5773 	 yyerrok;
       
  5774 	}
       
  5775 | ASSIGN expression error
       
  5776 	{$$ = NULL;
       
  5777 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting ';' after expression defined in ST condition of transition declaration.");
       
  5778 	 yyerrok;
       
  5779 	}
       
  5780 /* ERROR_CHECK_END */
  3881 ;
  5781 ;
  3882 
  5782 
  3883 
  5783 
  3884 
  5784 
  3885 action:
  5785 action:
  3886 //  ACTION identifier ':' ... 
  5786 //  ACTION identifier ':' ... 
  3887   ACTION action_name ':' {cmd_goto_body_state();} function_block_body END_ACTION
  5787   ACTION action_name ':' {cmd_goto_body_state();} function_block_body END_ACTION
  3888 	{$$ = new action_c($2, $5, locloc(@$));}
  5788 	{$$ = new action_c($2, $5, locloc(@$));}
       
  5789 /* ERROR_CHECK_BEGIN */
       
  5790 | ACTION ':' {cmd_goto_body_state();} function_block_body END_ACTION
       
  5791   {$$ = NULL;
       
  5792 	 yynerrs++;
       
  5793 	 print_err_msg(current_filename, locf(@1), locl(@2), "no action name defined in action declaration.");
       
  5794 	}
       
  5795 | ACTION error ':' {cmd_goto_body_state();} function_block_body END_ACTION
       
  5796 	{$$ = NULL;
       
  5797 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid action name defined in action declaration.");
       
  5798 	 yyerrok;
       
  5799 	}
       
  5800 | ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION
       
  5801 	{$$ = NULL;
       
  5802 	 yynerrs++;
       
  5803 	 print_err_msg(current_filename, locf(@2), locl(@4), "':' missing after action name in action declaration.");
       
  5804 	}
       
  5805 | ACTION action_name ':' END_ACTION
       
  5806 	{$$ = NULL;
       
  5807 	 print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in action declaration.");
       
  5808 	 yyerrok;
       
  5809 	}
       
  5810 | ACTION error END_ACTION
       
  5811 	{$$ = NULL;
       
  5812 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in action declaration.");
       
  5813 	 yyerrok;
       
  5814 	}
       
  5815 /* ERROR_CHECK_END */
  3889 ;
  5816 ;
  3890 
  5817 
  3891 
  5818 
  3892 /********************************/
  5819 /********************************/
  3893 /* B 1.7 Configuration elements */
  5820 /* B 1.7 Configuration elements */
  3913  * namespace for each of the name types (resource names, program names,
  5840  * namespace for each of the name types (resource names, program names,
  3914  * global varaiable names), i.e. letting the names be re-used across
  5841  * global varaiable names), i.e. letting the names be re-used across
  3915  * each of the groups (resource, program, global variables), produces
  5842  * each of the groups (resource, program, global variables), produces
  3916  * reduce/reduce conflicts in the syntax parser. Actually, it is only
  5843  * reduce/reduce conflicts in the syntax parser. Actually, it is only
  3917  * the resource names that need to be distinguished into a 
  5844  * the resource names that need to be distinguished into a 
  3918  * prev_delcared_resource_name so as not to conflict with [gloabl] variable
  5845  * prev_declared_resource_name so as not to conflict with [gloabl] variable
  3919  * names in the 'data' construct.
  5846  * names in the 'data' construct.
  3920  * The program names are only tracked to make sure that two programs do not
  5847  * The program names are only tracked to make sure that two programs do not
  3921  * get the same name.
  5848  * get the same name.
  3922  *
  5849  *
  3923  * Using a single namespace does have the drawback that the user will
  5850  * Using a single namespace does have the drawback that the user will
  3974 	{$$ = new configuration_declaration_c($2, $3, $4, $5, $6, locloc(@$));
  5901 	{$$ = new configuration_declaration_c($2, $3, $4, $5, $6, locloc(@$));
  3975 	 library_element_symtable.insert($2, prev_declared_configuration_name_token);
  5902 	 library_element_symtable.insert($2, prev_declared_configuration_name_token);
  3976 	 variable_name_symtable.pop();
  5903 	 variable_name_symtable.pop();
  3977 }
  5904 }
  3978 /* ERROR_CHECK_BEGIN */
  5905 /* ERROR_CHECK_BEGIN */
       
  5906 | CONFIGURATION 
       
  5907    optional_global_var_declarations
       
  5908    single_resource_declaration
       
  5909    {variable_name_symtable.pop();}
       
  5910    optional_access_declarations
       
  5911    optional_instance_specific_initializations
       
  5912   END_CONFIGURATION
       
  5913   {$$ = NULL;
       
  5914 	 yynerrs++;
       
  5915 	 print_err_msg(current_filename, locf(@1), locl(@2), "no configuration name defined in configuration declaration.");
       
  5916 	}
       
  5917 | CONFIGURATION
       
  5918    optional_global_var_declarations
       
  5919    resource_declaration_list
       
  5920    optional_access_declarations
       
  5921    optional_instance_specific_initializations
       
  5922   END_CONFIGURATION
       
  5923   {$$ = NULL;
       
  5924 	 yynerrs++;
       
  5925 	 print_err_msg(current_filename, locf(@1), locl(@2), "no configuration name defined in configuration declaration.");
       
  5926 	}
       
  5927 | CONFIGURATION error
       
  5928    optional_global_var_declarations
       
  5929    single_resource_declaration
       
  5930    {variable_name_symtable.pop();}
       
  5931    optional_access_declarations
       
  5932    optional_instance_specific_initializations
       
  5933   END_CONFIGURATION
       
  5934   {$$ = NULL;
       
  5935 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid configuration name defined in configuration declaration.");
       
  5936 	 yyerrok;
       
  5937 	}
       
  5938 | CONFIGURATION error
       
  5939    optional_global_var_declarations
       
  5940    resource_declaration_list
       
  5941    optional_access_declarations
       
  5942    optional_instance_specific_initializations
       
  5943   END_CONFIGURATION
       
  5944   {$$ = NULL;
       
  5945 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid configuration name defined in configuration declaration.");
       
  5946 	 yyerrok;
       
  5947 	}
       
  5948 | CONFIGURATION configuration_name
       
  5949    optional_global_var_declarations
       
  5950    optional_access_declarations
       
  5951    optional_instance_specific_initializations
       
  5952   END_CONFIGURATION
       
  5953   {$$ = NULL;
       
  5954 	 print_err_msg(current_filename, locf(@1), locl(@2), "no resource(s) defined in configuration declaration.");
       
  5955 	 yyerrok;
       
  5956 	}
       
  5957 | CONFIGURATION configuration_name
       
  5958    optional_global_var_declarations
       
  5959    error
       
  5960    optional_access_declarations
       
  5961    optional_instance_specific_initializations
       
  5962   END_CONFIGURATION
       
  5963   {$$ = NULL;
       
  5964 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid resource(s) defined in configuration declaration.");
       
  5965 	 yyerrok;
       
  5966 	}
  3979 | CONFIGURATION error END_CONFIGURATION
  5967 | CONFIGURATION error END_CONFIGURATION
  3980 	{$$ = NULL;
  5968 	{$$ = NULL;
  3981 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in configuration declaration.");
  5969 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in configuration declaration.");
  3982 	 /* yychar */
       
  3983 	 yyerrok;
  5970 	 yyerrok;
  3984 	}
  5971 	}
  3985 /* ERROR_CHECK_END */
  5972 /* ERROR_CHECK_END */
  3986 ;
  5973 ;
  3987 
  5974 
  4014 resource_declaration_list:
  6001 resource_declaration_list:
  4015   resource_declaration
  6002   resource_declaration
  4016 	{$$ = new resource_declaration_list_c(locloc(@$)); $$->add_element($1);}
  6003 	{$$ = new resource_declaration_list_c(locloc(@$)); $$->add_element($1);}
  4017 | resource_declaration_list resource_declaration
  6004 | resource_declaration_list resource_declaration
  4018 	{$$ = $1; $$->add_element($2);}
  6005 	{$$ = $1; $$->add_element($2);}
       
  6006 /* ERROR_CHECK_BEGIN */
       
  6007 | resource_declaration_list error
       
  6008 	{$$ = NULL;
       
  6009 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after resource declaration.");
       
  6010 	 yyerrok;
       
  6011 	}
       
  6012 /* ERROR_CHECK_END */
  4019 ;
  6013 ;
  4020 
  6014 
  4021 
  6015 
  4022 resource_declaration:
  6016 resource_declaration:
  4023   RESOURCE {variable_name_symtable.push();} resource_name ON resource_type_name
  6017   RESOURCE {variable_name_symtable.push();} resource_name ON resource_type_name
  4026   END_RESOURCE
  6020   END_RESOURCE
  4027 	{$$ = new resource_declaration_c($3, $5, $6, $7, locloc(@$));
  6021 	{$$ = new resource_declaration_c($3, $5, $6, $7, locloc(@$));
  4028 	 variable_name_symtable.pop();
  6022 	 variable_name_symtable.pop();
  4029 	 variable_name_symtable.insert($3, prev_declared_resource_name_token);
  6023 	 variable_name_symtable.insert($3, prev_declared_resource_name_token);
  4030 	}
  6024 	}
       
  6025 /* ERROR_CHECK_BEGIN */
       
  6026 | RESOURCE {variable_name_symtable.push();} ON resource_type_name
       
  6027    optional_global_var_declarations
       
  6028    single_resource_declaration
       
  6029   END_RESOURCE
       
  6030   {$$ = NULL;
       
  6031 	 yynerrs++;
       
  6032 	 print_err_msg(current_filename, locf(@1), locl(@3), "no resource name defined in resource declaration.");
       
  6033 	}
       
  6034 | RESOURCE error END_RESOURCE
       
  6035 	{$$ = NULL;
       
  6036 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in resource declaration.");
       
  6037 	 yyerrok;
       
  6038 	}
       
  6039 /* ERROR_CHECK_END */
  4031 ;
  6040 ;
  4032 
  6041 
  4033 
  6042 
  4034 single_resource_declaration:
  6043 single_resource_declaration:
  4035  task_configuration_list program_configuration_list
  6044  task_configuration_list program_configuration_list
  4041 task_configuration_list:
  6050 task_configuration_list:
  4042   // empty
  6051   // empty
  4043 	{$$ = new task_configuration_list_c(locloc(@$));}
  6052 	{$$ = new task_configuration_list_c(locloc(@$));}
  4044 | task_configuration_list task_configuration ';'
  6053 | task_configuration_list task_configuration ';'
  4045 	{$$ = $1; $$->add_element($2);}
  6054 	{$$ = $1; $$->add_element($2);}
       
  6055 /* ERROR_CHECK_BEGIN */
       
  6056 | task_configuration_list task_configuration error
       
  6057   {$$ = NULL;
       
  6058 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of task configuration in resource declaration.");
       
  6059 	 yyerrok;
       
  6060 	}
       
  6061 | task_configuration_list ';'
       
  6062   {$$ = NULL;
       
  6063 	 yynerrs++;
       
  6064 	 print_err_msg(current_filename, locf(@1), locl(@1), "unexpected ';' after task configuration in resource declaration.");
       
  6065 	}
       
  6066 /* ERROR_CHECK_END */
  4046 ;
  6067 ;
  4047 
  6068 
  4048 
  6069 
  4049 // helper symbol for single_resource_declaration //
  6070 // helper symbol for single_resource_declaration //
  4050 program_configuration_list:
  6071 program_configuration_list:
  4051   program_configuration ';'
  6072   program_configuration ';'
  4052 	{$$ = new program_configuration_list_c(locloc(@$)); $$->add_element($1);}
  6073 	{$$ = new program_configuration_list_c(locloc(@$)); $$->add_element($1);}
  4053 | program_configuration_list program_configuration ';'
  6074 | program_configuration_list program_configuration ';'
  4054 	{$$ = $1; $$->add_element($2);}
  6075 	{$$ = $1; $$->add_element($2);}
       
  6076 /* ERROR_CHECK_BEGIN */
       
  6077 | program_configuration error
       
  6078   {$$ = NULL;
       
  6079 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of program configuration in resource declaration.");
       
  6080 	 yyerrok;
       
  6081 	}
       
  6082 | program_configuration_list program_configuration error
       
  6083   {$$ = NULL;
       
  6084 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of program configuration in resource declaration.");
       
  6085 	 yyerrok;
       
  6086 	}
       
  6087 | program_configuration_list ';'
       
  6088   {$$ = NULL;
       
  6089 	 yynerrs++;
       
  6090 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after program configuration in resource declaration.");
       
  6091 	}
       
  6092 /* ERROR_CHECK_END */
  4055 ;
  6093 ;
  4056 
  6094 
  4057 
  6095 
  4058 resource_name: identifier;
  6096 resource_name: identifier;
  4059 
  6097 
  4060 /*
  6098 /*
  4061 access_declarations:
  6099 access_declarations:
  4062  VAR_ACCESS access_declaration_list END_VAR
  6100  VAR_ACCESS access_declaration_list END_VAR
  4063 	{$$ = NULL;}
  6101 	{$$ = NULL;}
       
  6102 // ERROR_CHECK_BEGIN //
       
  6103 | VAR_ACCESS END_VAR
       
  6104 	{$$ = NULL;
       
  6105 	 yynerrs++;
       
  6106 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in access variable(s) declaration.");
       
  6107 	}
       
  6108 | VAR_ACCESS error access_declaration_list END_VAR
       
  6109 	{$$ = NULL;
       
  6110 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_ACCESS' in access variable(s) declaration.");
       
  6111 	 yyerrok;
       
  6112 	}
       
  6113 | VAR_ACCESS error END_VAR
       
  6114 	{$$ = NULL;
       
  6115 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in access variable(s) declaration.");
       
  6116 	 yyerrok;
       
  6117 	}
       
  6118 // ERROR_CHECK_END //
  4064 ;
  6119 ;
  4065 
  6120 
  4066 // helper symbol for access_declarations //
  6121 // helper symbol for access_declarations //
  4067 access_declaration_list:
  6122 access_declaration_list:
  4068   access_declaration ';'
  6123   access_declaration ';'
  4069 | access_declaration_list access_declaration ';'
  6124 | access_declaration_list access_declaration ';'
       
  6125 // ERROR_CHECK_BEGIN //
       
  6126 | access_declaration error
       
  6127   {$$ = NULL;
       
  6128 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of access variable declaration.");
       
  6129 	 yyerrok;
       
  6130 	}
       
  6131 | access_declaration_list access_declaration error
       
  6132   {$$ = NULL;
       
  6133 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of access variable declaration.");
       
  6134 	 yyerrok;
       
  6135 	}
       
  6136 | access_declaration_list ';'
       
  6137   {$$ = NULL;
       
  6138 	 yynerrs++;
       
  6139 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after access variable declaration.");
       
  6140 	}
       
  6141 // ERROR_CHECK_END //
  4070 ;
  6142 ;
  4071 
  6143 
  4072 
  6144 
  4073 access_declaration:
  6145 access_declaration:
  4074   access_name ':' access_path ':' non_generic_type_name
  6146   access_name ':' access_path ':' non_generic_type_name
  4076 ;
  6148 ;
  4077 
  6149 
  4078 
  6150 
  4079 access_path:
  6151 access_path:
  4080   direct_variable
  6152   direct_variable
  4081 | prev_delcared_resource_name '.' direct_variable
  6153 | prev_declared_resource_name '.' direct_variable
  4082 | any_fb_name_list symbolic_variable
  6154 | any_fb_name_list symbolic_variable
  4083 | prev_delcared_resource_name '.' any_fb_name_list symbolic_variable
  6155 | prev_declared_resource_name '.' any_fb_name_list symbolic_variable
  4084 | prev_delcared_program_name '.'  any_fb_name_list symbolic_variable
  6156 | prev_declared_program_name '.'  any_fb_name_list symbolic_variable
  4085 | prev_delcared_resource_name '.' prev_delcared_program_name '.' any_fb_name_list symbolic_variable
  6157 | prev_declared_resource_name '.' prev_declared_program_name '.' any_fb_name_list symbolic_variable
  4086 ;
  6158 ;
  4087 */
  6159 */
  4088 
  6160 
  4089 // helper symbol for
  6161 // helper symbol for
  4090 //  - access_path
  6162 //  - access_path
  4156 */
  6228 */
  4157 
  6229 
  4158 task_configuration:
  6230 task_configuration:
  4159   TASK task_name task_initialization
  6231   TASK task_name task_initialization
  4160 	{$$ = new task_configuration_c($2, $3, locloc(@$));}
  6232 	{$$ = new task_configuration_c($2, $3, locloc(@$));}
       
  6233 /* ERROR_CHECK_BEGIN */
       
  6234 | TASK task_initialization
       
  6235   {$$ = NULL;
       
  6236 	 yynerrs++;
       
  6237 	 print_err_msg(current_filename, locf(@1), locl(@2), "no task name defined in task declaration.");
       
  6238 	}
       
  6239 | TASK error task_initialization
       
  6240   {$$ = NULL;
       
  6241 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid task name defined in task declaration.");
       
  6242 	 yyerrok;
       
  6243 	}
       
  6244 | TASK task_name error
       
  6245   {$$ = NULL;
       
  6246 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid task initialization in task declaration.");
       
  6247 	 yyerrok;
       
  6248 	}
       
  6249 /* ERROR_CHECK_END */
  4161 ;
  6250 ;
  4162 
  6251 
  4163 /* NOTE: The specification does not mention the namespace to which task names
  6252 /* NOTE: The specification does not mention the namespace to which task names
  4164  *       should belong to. Unlike resource and program names, for the moment we
  6253  *       should belong to. Unlike resource and program names, for the moment we
  4165  *       let the task names belong to their own private namespace, as they do not
  6254  *       let the task names belong to their own private namespace, as they do not
  4181 // [SINGLE ASSIGN data_source ',']
  6270 // [SINGLE ASSIGN data_source ',']
  4182   /* empty */
  6271   /* empty */
  4183 	{$$ = NULL;}
  6272 	{$$ = NULL;}
  4184 | SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} 
  6273 | SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} 
  4185 	{$$ = $4;}
  6274 	{$$ = $4;}
       
  6275 /* ERROR_CHECK_BEGIN */
       
  6276 | SINGLE {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
       
  6277   {$$ = NULL;
       
  6278 	 yynerrs++;
       
  6279 	 print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'SINGLE' in task initialization.");
       
  6280 	}
       
  6281 | SINGLE error {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
       
  6282   {$$ = NULL;
       
  6283 	 print_err_msg(current_filename, locf(@1), locl(@4), "expecteing ':=' after 'SINGLE' in task initialization.");
       
  6284 	 yyerrok;
       
  6285 	}
       
  6286 | SINGLE ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
       
  6287   {$$ = NULL;
       
  6288 	 yynerrs++;
       
  6289 	 print_err_msg(current_filename, locf(@2), locl(@4), "no data source defined in 'SINGLE' statement of task initialization.");
       
  6290 	}
       
  6291 | SINGLE ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
       
  6292   {$$ = NULL;
       
  6293 	 print_err_msg(current_filename, locf(@2), locl(@5), "invalid data source defined in 'SINGLE' statement of task initialization.");
       
  6294 	 yyerrok;
       
  6295 	}
       
  6296 /* ERROR_CHECK_END */
  4186 ;
  6297 ;
  4187 
  6298 
  4188 
  6299 
  4189 task_initialization_interval:
  6300 task_initialization_interval:
  4190 // [INTERVAL ASSIGN data_source ','] 
  6301 // [INTERVAL ASSIGN data_source ','] 
  4191   /* empty */
  6302   /* empty */
  4192 	{$$ = NULL;}
  6303 	{$$ = NULL;}
  4193 | INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
  6304 | INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
  4194 	{$$ = $4;}
  6305 	{$$ = $4;}
       
  6306 /* ERROR_CHECK_BEGIN */
       
  6307 | INTERVAL {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
       
  6308   {$$ = NULL;
       
  6309 	 yynerrs++;
       
  6310 	 print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'INTERVAL' in task initialization.");
       
  6311 	}
       
  6312 | INTERVAL error {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
       
  6313   {$$ = NULL;
       
  6314 	 print_err_msg(current_filename, locf(@1), locl(@4), "expecting ':=' after 'INTERVAL' in task initialization.");
       
  6315 	 yyerrok;
       
  6316 	}
       
  6317 | INTERVAL ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
       
  6318   {$$ = NULL;
       
  6319 	 yynerrs++;
       
  6320 	 print_err_msg(current_filename, locf(@2), locl(@4), "no data source defined in 'INTERVAL' statement of task initialization.");
       
  6321 	}
       
  6322 | INTERVAL ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
       
  6323   {$$ = NULL;
       
  6324 	 print_err_msg(current_filename, locf(@2), locl(@5), "invalid data source defined in 'INTERVAL' statement of task initialization.");
       
  6325 	 yyerrok;
       
  6326 	}
       
  6327 /* ERROR_CHECK_END */
  4195 ;
  6328 ;
  4196 
  6329 
  4197 
  6330 
  4198 
  6331 
  4199 task_initialization_priority:
  6332 task_initialization_priority:
  4200 // PRIORITY ASSIGN integer
  6333 // PRIORITY ASSIGN integer
  4201   PRIORITY ASSIGN {cmd_pop_state();} integer 
  6334   PRIORITY ASSIGN {cmd_pop_state();} integer 
  4202 	{$$ = $4;}
  6335 	{$$ = $4;}
       
  6336 /* ERROR_CHECK_BEGIN */
       
  6337 | PRIORITY {cmd_pop_state();} integer
       
  6338   {$$ = NULL;
       
  6339 	 yynerrs++;
       
  6340 	 print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'PRIORITY' in task initialization.");
       
  6341 	}
       
  6342 | PRIORITY error {cmd_pop_state();} integer 
       
  6343   {$$ = NULL;
       
  6344 	 print_err_msg(current_filename, locf(@1), locl(@4), "expecting ':=' after 'PRIORITY' in task initialization.");
       
  6345 	 yyerrok;
       
  6346 	}
       
  6347 | PRIORITY ASSIGN {cmd_pop_state();} error
       
  6348   {$$ = NULL;
       
  6349 	 yynerrs++;
       
  6350 	 print_err_msg(current_filename, locf(@2), locl(@2), "no priority number defined in 'PRIORITY' statement of task initialization.");
       
  6351 	}
       
  6352 /* ERROR_CHECK_END */
  4203 ;
  6353 ;
  4204 
  6354 
  4205 
  6355 
  4206 
  6356 
  4207 data_source:
  6357 data_source:
  4223 	}
  6373 	}
  4224 | PROGRAM NON_RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
  6374 | PROGRAM NON_RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
  4225 	{$$ = new program_configuration_c(new non_retain_option_c(locloc(@2)), $3, $4, $6, $7, locloc(@$));
  6375 	{$$ = new program_configuration_c(new non_retain_option_c(locloc(@2)), $3, $4, $6, $7, locloc(@$));
  4226 	 variable_name_symtable.insert($3, prev_declared_program_name_token);
  6376 	 variable_name_symtable.insert($3, prev_declared_program_name_token);
  4227 	}
  6377 	}
       
  6378 /* ERROR_CHECK_BEGIN */
       
  6379 | PROGRAM program_name optional_task_name ':' identifier optional_prog_conf_elements
       
  6380   {$$ = NULL;
       
  6381 	 yynerrs++;
       
  6382 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown program type name after ':' in program configuration.");
       
  6383 	}
       
  6384 | PROGRAM RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
       
  6385   {$$ = NULL;
       
  6386 	 yynerrs++;
       
  6387 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown program type name after ':' in program configuration.");
       
  6388 	}
       
  6389 | PROGRAM NON_RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
       
  6390   {$$ = NULL;
       
  6391 	 yynerrs++;
       
  6392 	 print_err_msg(current_filename, locf(@2), locl(@4), "unknown program type name after ':' in program configuration.");
       
  6393 	}
       
  6394 | PROGRAM error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6395   {$$ = NULL;
       
  6396 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'PROGRAM' in program configuration.");
       
  6397 	 yyerrok;
       
  6398 	}
       
  6399 | PROGRAM RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6400   {$$ = NULL;
       
  6401 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive program configuration.");
       
  6402 	 yyerrok;
       
  6403 	}
       
  6404 | PROGRAM NON_RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6405   {$$ = NULL;
       
  6406 	 print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive program configuration.");
       
  6407 	 yyerrok;
       
  6408 	}
       
  6409 | PROGRAM optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6410   {$$ = NULL;
       
  6411 	 yynerrs++;
       
  6412 	 print_err_msg(current_filename, locf(@1), locl(@2), "no program name defined in program configuration.");
       
  6413 	}
       
  6414 | PROGRAM RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6415   {$$ = NULL;
       
  6416 	 yynerrs++;
       
  6417 	 print_err_msg(current_filename, locf(@2), locl(@3), "no program name defined in retentive program configuration.");
       
  6418 	}
       
  6419 | PROGRAM NON_RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6420   {$$ = NULL;
       
  6421 	 yynerrs++;
       
  6422 	 print_err_msg(current_filename, locf(@2), locl(@3), "no program name defined in non-retentive program configuration.");
       
  6423 	}
       
  6424 | PROGRAM error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6425   {$$ = NULL;
       
  6426 	 print_err_msg(current_filename, locf(@1), locl(@3), "no program name defined in program configuration.");
       
  6427 	 yyerrok;
       
  6428 	}
       
  6429 | PROGRAM RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6430   {$$ = NULL;
       
  6431 	 print_err_msg(current_filename, locf(@2), locl(@4), "no program name defined in retentive program configuration.");
       
  6432 	 yyerrok;
       
  6433 	}
       
  6434 | PROGRAM NON_RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
       
  6435   {$$ = NULL;
       
  6436 	 print_err_msg(current_filename, locf(@2), locl(@4), "no program name defined in non-retentive program configuration.");
       
  6437 	 yyerrok;
       
  6438 	}
       
  6439 | PROGRAM program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
       
  6440   {$$ = NULL;
       
  6441 	 yynerrs++;
       
  6442 	 print_err_msg(current_filename, locf(@3), locl(@4), "':' missing after program name or optional task name in program configuration.");
       
  6443 	}
       
  6444 | PROGRAM RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
       
  6445   {$$ = NULL;
       
  6446 	 yynerrs++;
       
  6447 	 print_err_msg(current_filename, locf(@4), locl(@5), "':' missing after program name or optional task name in program configuration.");
       
  6448 	}
       
  6449 | PROGRAM NON_RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
       
  6450   {$$ = NULL;
       
  6451 	 yynerrs++;
       
  6452 	 print_err_msg(current_filename, locf(@4), locl(@5), "':' missing after program name or optional task name in program configuration.");
       
  6453 	}
       
  6454 | PROGRAM program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
       
  6455   {$$ = NULL;
       
  6456 	 print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' after program name or optional task name in program configuration.");
       
  6457 	 yyerrok;
       
  6458 	}
       
  6459 | PROGRAM RETAIN program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
       
  6460   {$$ = NULL;
       
  6461 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting ':' after program name or optional task name in program configuration.");
       
  6462 	 yyerrok;
       
  6463 	}
       
  6464 | PROGRAM NON_RETAIN program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
       
  6465   {$$ = NULL;
       
  6466 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting ':' after program name or optional task name in program configuration.");
       
  6467 	 yyerrok;
       
  6468 	}
       
  6469 | PROGRAM program_name optional_task_name ':' optional_prog_conf_elements
       
  6470   {$$ = NULL;
       
  6471 	 yynerrs++;
       
  6472 	 print_err_msg(current_filename, locf(@4), locl(@5), "no program type defined in program configuration.");
       
  6473 	}
       
  6474 | PROGRAM RETAIN program_name optional_task_name ':' optional_prog_conf_elements
       
  6475   {$$ = NULL;
       
  6476 	 yynerrs++;
       
  6477 	 print_err_msg(current_filename, locf(@5), locl(@6), "no program type defined in program configuration.");
       
  6478 	}
       
  6479 | PROGRAM NON_RETAIN program_name optional_task_name ':' optional_prog_conf_elements
       
  6480   {$$ = NULL;
       
  6481 	 yynerrs++;
       
  6482 	 print_err_msg(current_filename, locf(@5), locl(@6), "no program type defined in program configuration.");
       
  6483   }
       
  6484 /* ERROR_CHECK_END */
  4228 ;
  6485 ;
  4229 
  6486 
  4230 // helper symbol for program_configuration //
  6487 // helper symbol for program_configuration //
  4231 optional_task_name:
  6488 optional_task_name:
  4232   // empty //
  6489   // empty //
  4233 	{$$ = NULL;}
  6490 	{$$ = NULL;}
  4234 | WITH task_name
  6491 | WITH task_name
  4235 	{$$ = $2;}
  6492 	{$$ = $2;}
       
  6493 /* ERROR_CHECK_BEGIN */
       
  6494 | WITH error
       
  6495   {$$ = NULL;
       
  6496 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid tack name in optional task name of program configuration.");
       
  6497 	 yyerrok;
       
  6498 	}
       
  6499 /* ERROR_CHECK_END */
  4236 ;
  6500 ;
  4237 
  6501 
  4238 // helper symbol for program_configuration //
  6502 // helper symbol for program_configuration //
  4239 optional_prog_conf_elements:
  6503 optional_prog_conf_elements:
  4240   // empty //
  6504   // empty //
  4241 	{$$ = NULL;}
  6505 	{$$ = NULL;}
  4242 | '(' prog_conf_elements ')'
  6506 | '(' prog_conf_elements ')'
  4243 	{$$ = $2;}
  6507 	{$$ = $2;}
       
  6508 /* ERROR_CHECK_BEGIN */
       
  6509 | '(' error ')'
       
  6510   {$$ = NULL;
       
  6511 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid program configuration elements in program configuration.");
       
  6512 	 yyerrok;
       
  6513 	}
       
  6514 | '(' prog_conf_elements error
       
  6515   {$$ = NULL;
       
  6516 	 print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of program configuration elements in program configuration.");
       
  6517 	 yyerrok;
       
  6518 	}
       
  6519 /* ERROR_CHECK_END */
  4244 ;
  6520 ;
  4245 
  6521 
  4246 
  6522 
  4247 prog_conf_elements:
  6523 prog_conf_elements:
  4248   prog_conf_element
  6524   prog_conf_element
  4249 	{$$ = new prog_conf_elements_c(locloc(@$)); $$->add_element($1);}
  6525 	{$$ = new prog_conf_elements_c(locloc(@$)); $$->add_element($1);}
  4250 | prog_conf_elements ',' prog_conf_element
  6526 | prog_conf_elements ',' prog_conf_element
  4251 	{$$ = $1; $$->add_element($3);}
  6527 	{$$ = $1; $$->add_element($3);}
       
  6528 /* ERROR_CHECK_BEGIN */
       
  6529 | prog_conf_elements prog_conf_element
       
  6530   {$$ = NULL;
       
  6531 	 yynerrs++;
       
  6532 	 print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in program configuration elements list.");
       
  6533 	}
       
  6534 | prog_conf_elements ',' error
       
  6535   {$$ = NULL;
       
  6536 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for program configuration element in program configuration list.");
       
  6537 	 yyerrok;
       
  6538 	}
       
  6539 /* ERROR_CHECK_END */
  4252 ;
  6540 ;
  4253 
  6541 
  4254 
  6542 
  4255 prog_conf_element:
  6543 prog_conf_element:
  4256   fb_task
  6544   fb_task
  4264  *       that have been declared in a scope outside the one we are
  6552  *       that have been declared in a scope outside the one we are
  4265  *       currently parsing, so we must accept them to be any_identifier!
  6553  *       currently parsing, so we must accept them to be any_identifier!
  4266  */
  6554  */
  4267   any_identifier WITH task_name
  6555   any_identifier WITH task_name
  4268 	{$$ = new fb_task_c($1, $3, locloc(@$));}
  6556 	{$$ = new fb_task_c($1, $3, locloc(@$));}
       
  6557 /* ERROR_CHECK_BEGIN */
       
  6558 | any_identifier WITH error
       
  6559   {$$ = NULL;
       
  6560 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid task name in function block configuration.");
       
  6561 	 yyerrok;
       
  6562 	}
       
  6563 /* ERROR_CHECK_END */
  4269 ;
  6564 ;
  4270 
  6565 
  4271 
  6566 
  4272 /* NOTE:
  6567 /* NOTE:
  4273  *  The semantics of configuring a program are rather confusing, so here is
  6568  *  The semantics of configuring a program are rather confusing, so here is
  4302 prog_cnxn:
  6597 prog_cnxn:
  4303   any_symbolic_variable ASSIGN prog_data_source
  6598   any_symbolic_variable ASSIGN prog_data_source
  4304 	{$$ = new prog_cnxn_assign_c($1, $3, locloc(@$));}
  6599 	{$$ = new prog_cnxn_assign_c($1, $3, locloc(@$));}
  4305 | any_symbolic_variable SENDTO data_sink
  6600 | any_symbolic_variable SENDTO data_sink
  4306 	{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));}
  6601 	{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));}
       
  6602 /* ERROR_CHECK_BEGIN */
       
  6603 | any_symbolic_variable constant
       
  6604   {$$ = NULL;
       
  6605 	 yynerrs++;
       
  6606 	 print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between parameter and value in program configuration element.");
       
  6607 	}
       
  6608 | any_symbolic_variable enumerated_value
       
  6609   {$$ = NULL;
       
  6610 	 yynerrs++;
       
  6611 	 print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between parameter and value in program configuration element.");
       
  6612 	}
       
  6613 | any_symbolic_variable data_sink
       
  6614   {$$ = NULL;
       
  6615 	 yynerrs++;
       
  6616 	 print_err_msg(current_filename, locf(@2), locl(@2), "':=' or '=>' missing between parameter and variable in program configuration element.");
       
  6617 	}
       
  6618 | any_symbolic_variable error prog_data_source
       
  6619   {$$ = NULL;
       
  6620 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting ':=' or '=>' after parameter in program configuration element.");
       
  6621 	 yyerrok;
       
  6622 	}
       
  6623 | any_symbolic_variable ASSIGN error
       
  6624   {$$ = NULL;
       
  6625 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid value or variable in program configuration assignment element.");
       
  6626 	 yyerrok;
       
  6627 	}
       
  6628 | any_symbolic_variable SENDTO error
       
  6629   {$$ = NULL;
       
  6630 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid variable in program configuration sendto element.");
       
  6631 	 yyerrok;
       
  6632 	}
       
  6633 /* ERROR_CHECK_END */
  4307 ;
  6634 ;
  4308 
  6635 
  4309 prog_data_source:
  6636 prog_data_source:
  4310   constant
  6637   constant
  4311 | enumerated_value
  6638 | enumerated_value
  4319 ;
  6646 ;
  4320 
  6647 
  4321 instance_specific_initializations:
  6648 instance_specific_initializations:
  4322  VAR_CONFIG instance_specific_init_list END_VAR
  6649  VAR_CONFIG instance_specific_init_list END_VAR
  4323 	{$$ = new instance_specific_initializations_c($2, locloc(@$));}
  6650 	{$$ = new instance_specific_initializations_c($2, locloc(@$));}
       
  6651 /* ERROR_CHECK_BEGIN */
       
  6652 | VAR_CONFIG END_VAR
       
  6653 	{$$ = NULL;
       
  6654 	 yynerrs++;
       
  6655 	 print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in configuration variable(s) initialization.");
       
  6656 	}
       
  6657 | VAR_CONFIG error instance_specific_init_list END_VAR
       
  6658 	{$$ = NULL;
       
  6659 	 print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_CONFIG' in configuration variable(s) initialization.");
       
  6660 	 yyerrok;
       
  6661 	}
       
  6662 | VAR_CONFIG error END_VAR
       
  6663 	{$$ = NULL;
       
  6664 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in configuration variable(s) initialization.");
       
  6665 	 yyerrok;
       
  6666 	}
       
  6667 /* ERROR_CHECK_END */
  4324 ;
  6668 ;
  4325 
  6669 
  4326 // helper symbol for instance_specific_initializations //
  6670 // helper symbol for instance_specific_initializations //
  4327 instance_specific_init_list:
  6671 instance_specific_init_list:
  4328   instance_specific_init ';'
  6672   instance_specific_init ';'
  4329 	{$$ = new instance_specific_init_list_c(locloc(@$)); $$->add_element($1);}
  6673 	{$$ = new instance_specific_init_list_c(locloc(@$)); $$->add_element($1);}
  4330 | instance_specific_init_list instance_specific_init ';'
  6674 | instance_specific_init_list instance_specific_init ';'
  4331 	{$$ = $1; $$->add_element($2);}
  6675 	{$$ = $1; $$->add_element($2);}
       
  6676 /* ERROR_CHECK_BEGIN */
       
  6677 | instance_specific_init error
       
  6678   {$$ = NULL;
       
  6679 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of configuration variable initialization.");
       
  6680 	 yyerrok;
       
  6681 	}
       
  6682 | instance_specific_init_list instance_specific_init error
       
  6683   {$$ = NULL;
       
  6684 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of configuration variable initialization.");
       
  6685 	 yyerrok;
       
  6686 	}
       
  6687 | instance_specific_init_list ';'
       
  6688   {$$ = NULL;
       
  6689 	 yynerrs++;
       
  6690 	 print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after configuration variable initialization.");
       
  6691 	}
       
  6692 /* ERROR_CHECK_END */
  4332 ;
  6693 ;
  4333 
  6694 
  4334 
  6695 
  4335 instance_specific_init:
  6696 instance_specific_init:
  4336 //
  6697 //
  4356 
  6717 
  4357 /* helper symbol for instance_specific_init */
  6718 /* helper symbol for instance_specific_init */
  4358 fb_initialization:
  6719 fb_initialization:
  4359   function_block_type_name ASSIGN structure_initialization
  6720   function_block_type_name ASSIGN structure_initialization
  4360 	{$$ = new fb_initialization_c($1, $3, locloc(@$));}
  6721 	{$$ = new fb_initialization_c($1, $3, locloc(@$));}
       
  6722 /* ERROR_CHECK_BEGIN */
       
  6723 | function_block_type_name structure_initialization
       
  6724   {$$ = NULL;
       
  6725 	 yynerrs++;
       
  6726 	 print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between function block name and initialization in function block initialization.");
       
  6727 	}
       
  6728 | function_block_type_name error structure_initialization
       
  6729   {$$ = NULL;
       
  6730 	 print_err_msg(current_filename, locf(@2), locl(@2), "expecting ':=' after function block name in function block initialization.");
       
  6731 	 yyerrok;
       
  6732 	}
       
  6733 /* ERROR_CHECK_END */
  4361 ;
  6734 ;
  4362 
  6735 
  4363 /***********************************/
  6736 /***********************************/
  4364 /* B 2.1 Instructions and Operands */
  6737 /* B 2.1 Instructions and Operands */
  4365 /***********************************/
  6738 /***********************************/
  4380 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
  6753 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
  4381 | instruction_list il_instruction
  6754 | instruction_list il_instruction
  4382 	{$$ = $1; $$->add_element($2);}
  6755 	{$$ = $1; $$->add_element($2);}
  4383 | instruction_list pragma
  6756 | instruction_list pragma
  4384 	{$$ = $1; $$->add_element($2);}
  6757 	{$$ = $1; $$->add_element($2);}
       
  6758 /* ERROR_CHECK_BEGIN */
       
  6759 | instruction_list error
       
  6760   {$$ = NULL;
       
  6761 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid IL instruction.");
       
  6762 	 yyerrok;
       
  6763 	}
       
  6764 /* ERROR_CHECK_END */
  4385 ;
  6765 ;
  4386 
  6766 
  4387 
  6767 
  4388 
  6768 
  4389 il_instruction:
  6769 il_instruction:
  4392 | label ':' il_incomplete_instruction eol_list
  6772 | label ':' il_incomplete_instruction eol_list
  4393 	{$$ = new il_instruction_c($1, $3, locloc(@$));}
  6773 	{$$ = new il_instruction_c($1, $3, locloc(@$));}
  4394 /* ERROR_CHECK_BEGIN */
  6774 /* ERROR_CHECK_BEGIN */
  4395 | error eol_list
  6775 | error eol_list
  4396 	{$$ = NULL;
  6776 	{$$ = NULL;
  4397 	 print_err_msg(current_filename, locf(@1), locl(@1), "error in IL instruction.");
  6777 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid IL instruction.");
  4398 	 yyerrok;
  6778 	 yyerrok;
  4399 	}
  6779 	}
  4400 /* ERROR_CHECK_END */
  6780 | il_incomplete_instruction error
  4401 /* ERROR_CHECK_BEGIN */
  6781 	{$$ = NULL;
       
  6782 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of IL instruction.");
       
  6783 	 yyerrok;
       
  6784 	}
       
  6785 | error ':' il_incomplete_instruction eol_list
       
  6786 	{$$ = NULL;
       
  6787 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid label in IL instruction.");
       
  6788 	 yyerrok;
       
  6789 	}
       
  6790 | label il_incomplete_instruction eol_list
       
  6791 	{$$ = NULL;
       
  6792 	 yynerrs++;
       
  6793 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after label in IL instruction.");
       
  6794 	}
       
  6795 | label error il_incomplete_instruction eol_list
       
  6796 	{$$ = NULL;
       
  6797 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' after label in IL instruction.");
       
  6798 	 yyerrok;
       
  6799 	}
  4402 | label ':' error eol_list
  6800 | label ':' error eol_list
  4403 	{$$ = NULL;
  6801 	{$$ = NULL;
  4404 	 print_err_msg(current_filename, locf(@1), locl(@3), "error in IL instruction.");
  6802 	 print_err_msg(current_filename, locf(@2), locl(@4), "invalid IL instruction.");
       
  6803 	 yyerrok;
       
  6804 	}
       
  6805 | label ':' il_incomplete_instruction error
       
  6806 	{$$ = NULL;
       
  6807 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of IL instruction.");
  4405 	 yyerrok;
  6808 	 yyerrok;
  4406 	}
  6809 	}
  4407 /* ERROR_CHECK_END */
  6810 /* ERROR_CHECK_END */
  4408 ;
  6811 ;
  4409 
  6812 
  4518 	{$$ = new il_expression_c($1, $3, NULL, locloc(@$));}
  6921 	{$$ = new il_expression_c($1, $3, NULL, locloc(@$));}
  4519 | il_expr_operator_clash '(' il_operand eol_list simple_instr_list ')'
  6922 | il_expr_operator_clash '(' il_operand eol_list simple_instr_list ')'
  4520 	{$$ = new il_expression_c($1, $3, $5, locloc(@$));}
  6923 	{$$ = new il_expression_c($1, $3, $5, locloc(@$));}
  4521 | il_expr_operator_clash_eol_list simple_instr_list ')'
  6924 | il_expr_operator_clash_eol_list simple_instr_list ')'
  4522 	{$$ = new il_expression_c($1, NULL, $2, locloc(@$));}
  6925 	{$$ = new il_expression_c($1, NULL, $2, locloc(@$));}
       
  6926 /* ERROR_CHECK_BEGIN */
       
  6927 | il_expr_operator_noclash '(' eol_list error
       
  6928   {$$ = NULL;
       
  6929 	 print_err_msg(current_filename, locf(@3), locl(@3), "')' missing at the end of IL expression.");
       
  6930 	 yyerrok;
       
  6931 	}
       
  6932 | il_expr_operator_noclash '(' il_operand eol_list error
       
  6933   {$$ = NULL;
       
  6934 	 print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
       
  6935 	 yyerrok;
       
  6936 	}
       
  6937 | il_expr_operator_noclash '(' eol_list simple_instr_list error
       
  6938   {$$ = NULL;
       
  6939 	 print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
       
  6940 	 yyerrok;
       
  6941 	}
       
  6942 | il_expr_operator_noclash '(' il_operand eol_list simple_instr_list error
       
  6943   {$$ = NULL;
       
  6944 	 print_err_msg(current_filename, locf(@5), locl(@5), "')' missing at the end of IL expression.");
       
  6945 	 yyerrok;
       
  6946 	}
       
  6947 | il_expr_operator_clash '(' il_operand eol_list error
       
  6948   {$$ = NULL;
       
  6949 	 print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
       
  6950 	 yyerrok;
       
  6951 	}
       
  6952 | il_expr_operator_clash '(' il_operand eol_list simple_instr_list error
       
  6953   {$$ = NULL;
       
  6954 	 print_err_msg(current_filename, locf(@5), locl(@5), "')' missing at the end of IL expression.");
       
  6955 	 yyerrok;
       
  6956 	}
       
  6957 | il_expr_operator_clash_eol_list simple_instr_list error
       
  6958   {$$ = NULL;
       
  6959 	 print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of IL expression.");
       
  6960 	 yyerrok;
       
  6961 	}
       
  6962 /* ERROR_CHECK_END */
  4523 ;
  6963 ;
  4524 
  6964 
  4525 
  6965 
  4526 il_jump_operation:
  6966 il_jump_operation:
  4527   il_jump_operator label
  6967   il_jump_operator label
  4528 	{$$ = new il_jump_operation_c($1, $2, locloc(@$));}
  6968 	{$$ = new il_jump_operation_c($1, $2, locloc(@$));}
       
  6969 /* ERROR_CHECK_BEGIN */
       
  6970 | il_jump_operator error
       
  6971   {$$ = NULL;
       
  6972 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid label defined in IL jump operation.");
       
  6973 	 yyerrok;
       
  6974 	}
       
  6975 /* ERROR_CHECK_END */
  4529 ;
  6976 ;
  4530 
  6977 
  4531 
  6978 
  4532 il_fb_call:
  6979 il_fb_call:
  4533 // il_call_operator fb_name ['(' (EOL {EOL} [il_param_list]) | [il_operand_list] ')']
  6980 // il_call_operator fb_name ['(' (EOL {EOL} [il_param_list]) | [il_operand_list] ')']
  4539 	{$$ = new il_fb_call_c($1, $2, NULL, NULL, locloc(@$));}
  6986 	{$$ = new il_fb_call_c($1, $2, NULL, NULL, locloc(@$));}
  4540 | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
  6987 | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
  4541 	{$$ = new il_fb_call_c($1, $2, $4, NULL, locloc(@$));}
  6988 	{$$ = new il_fb_call_c($1, $2, $4, NULL, locloc(@$));}
  4542 | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
  6989 | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
  4543 	{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));}
  6990 	{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));}
       
  6991 /* ERROR_CHECK_BEGIN */
       
  6992 | il_call_operator error
       
  6993   {$$ = NULL;
       
  6994 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid function block name defined in IL function block call.");
       
  6995 	 yyerrok;
       
  6996 	}
       
  6997 | il_call_operator '(' ')'
       
  6998   {$$ = NULL;
       
  6999 	 yynerrs++;
       
  7000 	 print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
       
  7001 	}
       
  7002 | il_call_operator '(' eol_list ')'
       
  7003   {$$ = NULL;
       
  7004 	 yynerrs++;
       
  7005 	 print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
       
  7006 	}
       
  7007 | il_call_operator '(' il_operand_list ')'
       
  7008   {$$ = NULL;
       
  7009 	 yynerrs++;
       
  7010 	 print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
       
  7011 	}
       
  7012 | il_call_operator '(' eol_list il_param_list ')'
       
  7013   {$$ = NULL;
       
  7014 	 yynerrs++;
       
  7015 	 print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
       
  7016 	}
       
  7017 | il_call_operator error '(' ')'
       
  7018   {$$ = NULL;
       
  7019 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
       
  7020 	 yyerrok;
       
  7021 	}
       
  7022 | il_call_operator error '(' eol_list ')'
       
  7023   {$$ = NULL;
       
  7024 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
       
  7025 	 yyerrok;
       
  7026 	}
       
  7027 | il_call_operator error '(' il_operand_list ')'
       
  7028   {$$ = NULL;
       
  7029 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
       
  7030 	 yyerrok;
       
  7031 	}
       
  7032 | il_call_operator error '(' eol_list il_param_list ')'
       
  7033   {$$ = NULL;
       
  7034 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
       
  7035 	 yyerrok;
       
  7036 	}
       
  7037 | il_call_operator prev_declared_fb_name ')'
       
  7038   {$$ = NULL;
       
  7039 	 yynerrs++;
       
  7040 	 print_err_msg(current_filename, locf(@2), locl(@3), "'(' missing after function block name defined in IL function block call.");
       
  7041 	}
       
  7042 | il_call_operator prev_declared_fb_name il_operand_list ')'
       
  7043   {$$ = NULL;
       
  7044 	 yynerrs++;
       
  7045 	 print_err_msg(current_filename, locf(@2), locl(@3), "'(' missing after function block name defined in IL function block call.");
       
  7046 	}
       
  7047 | il_call_operator prev_declared_fb_name '(' error
       
  7048   {$$ = NULL;
       
  7049 	 print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
       
  7050 	 yyerrok;
       
  7051 	}
       
  7052 | il_call_operator prev_declared_fb_name '(' eol_list error
       
  7053   {$$ = NULL;
       
  7054 	 print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
       
  7055 	 yyerrok;
       
  7056 	}
       
  7057 | il_call_operator prev_declared_fb_name '(' il_operand_list error
       
  7058   {$$ = NULL;
       
  7059 	 print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
       
  7060 	 yyerrok;
       
  7061 	}
       
  7062 /* ERROR_CHECK_END */
  4544 ;
  7063 ;
  4545 
  7064 
  4546 
  7065 
  4547 /* NOTE: Please read note above the definition of function_name_without_clashes */
  7066 /* NOTE: Please read note above the definition of function_name_without_clashes */
  4548 il_formal_funct_call:
  7067 il_formal_funct_call:
  4605  * This is a lot of work, so I put it in a function
  7124  * This is a lot of work, so I put it in a function
  4606  * at the end of this file... il_operator_c_2_identifier_c()
  7125  * at the end of this file... il_operator_c_2_identifier_c()
  4607  */
  7126  */
  4608 | il_expr_operator_clash_eol_list il_param_list ')'
  7127 | il_expr_operator_clash_eol_list il_param_list ')'
  4609 	{$$ = new il_formal_funct_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));}
  7128 	{$$ = new il_formal_funct_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));}
       
  7129 /* ERROR_CHECK_BEGIN */
       
  7130 | function_name_no_clashes '(' eol_list error ')'
       
  7131   {$$ = NULL;
       
  7132 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid parameter list defined in IL formal function call.");
       
  7133 	 yyerrok;
       
  7134 	} 
       
  7135 | function_name_simpleop_clashes '(' eol_list error ')'
       
  7136   {$$ = NULL;
       
  7137 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid parameter list defined in IL formal function call.");
       
  7138 	 yyerrok;
       
  7139 	} 
       
  7140 | il_expr_operator_clash_eol_list error ')'
       
  7141   {$$ = NULL;
       
  7142 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter list defined in IL formal function call.");
       
  7143 	 yyerrok;
       
  7144 	} 
       
  7145 /* ERROR_CHECK_END */
  4610 ;
  7146 ;
  4611 
  7147 
  4612 
  7148 
  4613 il_expr_operator_clash_eol_list:
  7149 il_expr_operator_clash_eol_list:
  4614   il_expr_operator_clash '(' eol_list
  7150   il_expr_operator_clash '(' eol_list
  4615 	{$$ = $1;}
  7151 	{$$ = $1;}
       
  7152 /* ERROR_CHECK_BEGIN */
       
  7153 | il_expr_operator_clash '(' error
       
  7154   {$$ = NULL;
       
  7155 	 yynerrs++;
       
  7156 	 print_err_msg(current_filename, locf(@1), locl(@2), "EOL missing after '(' in IL instruction.");
       
  7157 	}
       
  7158 /* ERROR_CHECK_END */
  4616 ;
  7159 ;
  4617 
  7160 
  4618 
  7161 
  4619 il_operand:
  7162 il_operand:
  4620   variable
  7163   variable
  4634 il_operand_list2:
  7177 il_operand_list2:
  4635   il_operand ',' il_operand 
  7178   il_operand ',' il_operand 
  4636 	{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
  7179 	{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
  4637 | il_operand_list2 ',' il_operand
  7180 | il_operand_list2 ',' il_operand
  4638 	{$$ = $1; $$->add_element($3);}
  7181 	{$$ = $1; $$->add_element($3);}
       
  7182 /* ERROR_CHECK_BEGIN */
       
  7183 | il_operand_list2 il_operand
       
  7184   {$$ = NULL;
       
  7185 	 yynerrs++;
       
  7186 	 print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in IL operand list.");
       
  7187 	}
       
  7188 | il_formal_funct_call error il_operand
       
  7189   {$$ = NULL;
       
  7190 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting ',' in IL operand list.");
       
  7191 	 yyerrok;
       
  7192 	}
       
  7193 | il_formal_funct_call ',' error
       
  7194   {$$ = NULL;
       
  7195 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid operand in IL operand list.");
       
  7196 	 yyerrok;
       
  7197 	}
       
  7198 /* ERROR_CHECK_END */
  4639 ;
  7199 ;
  4640 
  7200 
  4641 
  7201 
  4642 simple_instr_list:
  7202 simple_instr_list:
  4643   il_simple_instruction
  7203   il_simple_instruction
  4649 
  7209 
  4650 il_simple_instruction:
  7210 il_simple_instruction:
  4651   il_simple_operation eol_list
  7211   il_simple_operation eol_list
  4652 | il_expression eol_list
  7212 | il_expression eol_list
  4653 | il_formal_funct_call eol_list
  7213 | il_formal_funct_call eol_list
       
  7214 /* ERROR_CHECK_BEGIN */
       
  7215 | il_expression error
       
  7216   {$$ = NULL;
       
  7217 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing after expression IL instruction.");
       
  7218 	 yyerrok;
       
  7219 	}
       
  7220 | il_formal_funct_call error
       
  7221   {$$ = NULL;
       
  7222 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing after formal function call IL instruction.");
       
  7223 	 yyerrok;
       
  7224 	}
       
  7225 /* ERROR_CHECK_END */
  4654 ;
  7226 ;
  4655 
  7227 
  4656 
  7228 
  4657 /* NOTE: the correct definition of il_param_list is
  7229 /* NOTE: the correct definition of il_param_list is
  4658  * il_param_list ::= {il_param_instruction} il_param_last_instruction
  7230  * il_param_list ::= {il_param_instruction} il_param_last_instruction
  4671 il_param_list:
  7243 il_param_list:
  4672   il_param_instruction_list il_param_last_instruction
  7244   il_param_instruction_list il_param_last_instruction
  4673 	{$$ = $1; $$->add_element($2);}
  7245 	{$$ = $1; $$->add_element($2);}
  4674 | il_param_last_instruction
  7246 | il_param_last_instruction
  4675 	{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
  7247 	{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
       
  7248 /* ERROR_CHECK_BEGIN */
       
  7249 | il_param_instruction_list error
       
  7250   {$$ = NULL;
       
  7251 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter assignment in parameter assignment list.");
       
  7252 	 yyerrok;
       
  7253 	}
       
  7254 | il_param_last_instruction il_param_last_instruction
       
  7255   {$$ = NULL;
       
  7256 	 yynerrs++;
       
  7257 	 print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at the end of parameter assignment in parameter assignment list.");
       
  7258 	}
       
  7259 | il_param_instruction_list il_param_last_instruction il_param_last_instruction
       
  7260   {$$ = NULL;
       
  7261 	 yynerrs++;
       
  7262 	 print_err_msg(current_filename, locf(@2), locl(@2), "',' missing at the end of parameter assignment in parameter assignment list.");
       
  7263 	}
       
  7264 /* ERROR_CHECK_END */
  4676 ;
  7265 ;
  4677 
  7266 
  4678 
  7267 
  4679 /* Helper symbol for il_param_list */
  7268 /* Helper symbol for il_param_list */
  4680 il_param_instruction_list:
  7269 il_param_instruction_list:
  4681   il_param_instruction
  7270   il_param_instruction
  4682 	{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
  7271 	{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
  4683 | il_param_instruction_list il_param_instruction
  7272 | il_param_instruction_list il_param_instruction
  4684 	{$$ = $1; $$->add_element($2);}
  7273 	{$$ = $1; $$->add_element($2);}
       
  7274 /* ERROR_CHECK_BEGIN */
       
  7275 | il_param_last_instruction il_param_instruction
       
  7276   {$$ = NULL;
       
  7277 	 yynerrs++;
       
  7278 	 print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at the end of parameter assignment in parameter assignment list.");
       
  7279 	}
       
  7280 | il_param_instruction_list il_param_last_instruction il_param_instruction
       
  7281   {$$ = NULL;
       
  7282 	 yynerrs++;
       
  7283 	 print_err_msg(current_filename, locf(@2), locl(@2), "',' missing at the end of parameter assignment in parameter assignment list.");
       
  7284 	}
       
  7285 /* ERROR_CHECK_END */
  4685 ;
  7286 ;
  4686 
  7287 
  4687 
  7288 
  4688 il_param_instruction:
  7289 il_param_instruction:
  4689   il_param_assignment ',' eol_list
  7290   il_param_assignment ',' eol_list
  4690 | il_param_out_assignment ',' eol_list
  7291 | il_param_out_assignment ',' eol_list
       
  7292 /* ERROR_CHECK_BEGIN */
       
  7293 | il_param_assignment ',' error
       
  7294   {$$ = NULL;
       
  7295 	 print_err_msg(current_filename, locf(@2), locl(@2), "EOL missing at the end of parameter assignment in parameter assignment list.");
       
  7296 	 yyerrok;
       
  7297 	}
       
  7298 | il_param_out_assignment ',' error
       
  7299   {$$ = NULL;
       
  7300 	 print_err_msg(current_filename, locf(@2), locl(@2), "EOL missing at the end of parameter out assignment in parameter assignment list.");
       
  7301 	 yyerrok;
       
  7302 	}
       
  7303 /* ERROR_CHECK_END */
  4691 ;
  7304 ;
  4692 
  7305 
  4693 
  7306 
  4694 il_param_last_instruction:
  7307 il_param_last_instruction:
  4695   il_param_assignment eol_list
  7308   il_param_assignment eol_list
  4696 | il_param_out_assignment eol_list
  7309 | il_param_out_assignment eol_list
       
  7310 /* ERROR_CHECK_BEGIN */
       
  7311 | il_param_assignment error
       
  7312   {$$ = NULL;
       
  7313 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of last parameter assignment in parameter assignment list.");
       
  7314 	 yyerrok;
       
  7315 	}
       
  7316 | il_param_out_assignment error
       
  7317   {$$ = NULL;
       
  7318 	 print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of last parameter out assignment in parameter assignment list.");
       
  7319 	 yyerrok;
       
  7320 	}
       
  7321 /* ERROR_CHECK_END */
       
  7322 
  4697 ;
  7323 ;
  4698 
  7324 
  4699 
  7325 
  4700 il_param_assignment:
  7326 il_param_assignment:
  4701   il_assign_operator il_operand
  7327   il_assign_operator il_operand
  4702 	{$$ = new il_param_assignment_c($1, $2, NULL, locloc(@$));}
  7328 	{$$ = new il_param_assignment_c($1, $2, NULL, locloc(@$));}
  4703 | il_assign_operator '(' eol_list simple_instr_list ')'
  7329 | il_assign_operator '(' eol_list simple_instr_list ')'
  4704 	{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));}
  7330 	{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));}
       
  7331 /* ERROR_CHECK_BEGIN */
       
  7332 | error il_operand
       
  7333   {$$ = NULL;
       
  7334 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid operator in parameter assignment.");
       
  7335 	 yyerrok;
       
  7336 	}
       
  7337 | error '(' eol_list simple_instr_list ')'
       
  7338   {$$ = NULL;
       
  7339 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid operator in parameter assignment.");
       
  7340 	 yyerrok;
       
  7341 	}
       
  7342 | il_assign_operator error
       
  7343   {$$ = NULL;
       
  7344 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid operand defined in parameter assignment.");
       
  7345 	 yyerrok;
       
  7346 	}
       
  7347 | il_assign_operator '(' ')'
       
  7348   {$$ = NULL;
       
  7349 	 print_err_msg(current_filename, locf(@1), locl(@1), "no instruction list defined in parameter assignment.");
       
  7350 	 yyerrok;
       
  7351 	}
       
  7352 | il_assign_operator '(' error ')'
       
  7353   {$$ = NULL;
       
  7354 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid instruction list defined in parameter assignment.");
       
  7355 	 yyerrok;
       
  7356 	}
       
  7357 | il_assign_operator '(' eol_list simple_instr_list error
       
  7358   {$$ = NULL;
       
  7359 	 print_err_msg(current_filename, locf(@1), locl(@1), "')' missing at the end of instruction list defined in parameter assignment.");
       
  7360 	 yyerrok;
       
  7361 	}
       
  7362 /* ERROR_CHECK_END */
  4705 ;
  7363 ;
  4706 
  7364 
  4707 
  7365 
  4708 il_param_out_assignment:
  7366 il_param_out_assignment:
  4709   il_assign_out_operator variable
  7367   il_assign_out_operator variable
  4710 	{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));}
  7368 	{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));}
       
  7369 /* ERROR_CHECK_BEGIN */
       
  7370 | il_assign_out_operator error
       
  7371   {$$ = NULL;
       
  7372 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid variable defined in parameter out assignment.");
       
  7373 	 yyerrok;
       
  7374 	}
       
  7375 /* ERROR_CHECK_END */
  4711 ;
  7376 ;
  4712 
  7377 
  4713 
  7378 
  4714 
  7379 
  4715 /*******************/
  7380 /*******************/
  4846 
  7511 
  4847 
  7512 
  4848 il_assign_operator:
  7513 il_assign_operator:
  4849 /*  variable_name ASSIGN */
  7514 /*  variable_name ASSIGN */
  4850   any_identifier ASSIGN
  7515   any_identifier ASSIGN
       
  7516 /* ERROR_CHECK_BEGIN */
       
  7517 | error ASSIGN
       
  7518   {$$ = NULL;
       
  7519 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter defined in parameter assignment.");
       
  7520 	 yyerrok;
       
  7521 	}
       
  7522 /* ERROR_CHECK_END */
  4851 ;
  7523 ;
  4852 
  7524 
  4853 
  7525 
  4854 il_assign_out_operator:
  7526 il_assign_out_operator:
  4855 /*  variable_name SENDTO */
  7527 /*  variable_name SENDTO */
  4857   sendto_identifier SENDTO
  7529   sendto_identifier SENDTO
  4858 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  7530 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  4859 /*| NOT variable_name SENDTO */
  7531 /*| NOT variable_name SENDTO */
  4860 | NOT sendto_identifier SENDTO
  7532 | NOT sendto_identifier SENDTO
  4861 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
  7533 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
       
  7534 /* ERROR_CHECK_BEGIN */
       
  7535 | error SENDTO
       
  7536   {$$ = NULL;
       
  7537 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter defined in parameter out assignment.");
       
  7538 	 yyerrok;
       
  7539 	}
       
  7540 | NOT SENDTO
       
  7541   {$$ = NULL;
       
  7542 	 yynerrs++;
       
  7543 	 print_err_msg(current_filename, locf(@1), locl(@2), "no paramter defined in parameter out assignment.");
       
  7544 	}
       
  7545 | NOT error SENDTO
       
  7546   {$$ = NULL;
       
  7547 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter defined in parameter out assignment.");
       
  7548 	 yyerrok;
       
  7549 	}
       
  7550 /* ERROR_CHECK_END */
  4862 ;
  7551 ;
  4863 
  7552 
  4864 
  7553 
  4865 il_call_operator:
  7554 il_call_operator:
  4866   CAL_operator
  7555   CAL_operator
  4888 /***********************/
  7577 /***********************/
  4889 expression:
  7578 expression:
  4890   xor_expression
  7579   xor_expression
  4891 | expression OR xor_expression
  7580 | expression OR xor_expression
  4892 	{$$ = new or_expression_c($1, $3, locloc(@$));}
  7581 	{$$ = new or_expression_c($1, $3, locloc(@$));}
       
  7582 /* ERROR_CHECK_BEGIN */
       
  7583 | expression OR error
       
  7584   {$$ = NULL;
       
  7585 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'OR' in ST expression.");
       
  7586 	 yyerrok;
       
  7587 	}
       
  7588 /* ERROR_CHECK_END */
  4893 ;
  7589 ;
  4894 
  7590 
  4895 xor_expression:
  7591 xor_expression:
  4896   and_expression
  7592   and_expression
  4897 | xor_expression XOR and_expression
  7593 | xor_expression XOR and_expression
  4898 	{$$ = new xor_expression_c($1, $3, locloc(@$));}
  7594 	{$$ = new xor_expression_c($1, $3, locloc(@$));}
       
  7595 /* ERROR_CHECK_BEGIN */
       
  7596 | xor_expression XOR error
       
  7597   {$$ = NULL;
       
  7598 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'XOR' in ST expression.");
       
  7599 	 yyerrok;
       
  7600 	}
       
  7601 /* ERROR_CHECK_END */
  4899 ;
  7602 ;
  4900 
  7603 
  4901 and_expression:
  7604 and_expression:
  4902   comparison
  7605   comparison
  4903 | and_expression '&' comparison
  7606 | and_expression '&' comparison
  4911  *       but we leave it in nevertheless just in case we later decide
  7614  *       but we leave it in nevertheless just in case we later decide
  4912  *       to remove theh AND2 token...
  7615  *       to remove theh AND2 token...
  4913  */
  7616  */
  4914 | and_expression AND2 comparison
  7617 | and_expression AND2 comparison
  4915 	{$$ = new and_expression_c($1, $3, locloc(@$));}
  7618 	{$$ = new and_expression_c($1, $3, locloc(@$));}
       
  7619 /* ERROR_CHECK_BEGIN */
       
  7620 | and_expression '&' error
       
  7621   {$$ = NULL;
       
  7622 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '&' in ST expression.");
       
  7623 	 yyerrok;
       
  7624 	}
       
  7625 | and_expression AND error
       
  7626   {$$ = NULL;
       
  7627 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'AND' in ST expression.");
       
  7628 	 yyerrok;
       
  7629 	}
       
  7630 | and_expression AND2 error
       
  7631   {$$ = NULL;
       
  7632 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '&' in ST expression.");
       
  7633 	 yyerrok;
       
  7634 	}
       
  7635 /* ERROR_CHECK_END */
  4916 ;
  7636 ;
  4917 
  7637 
  4918 comparison:
  7638 comparison:
  4919   equ_expression
  7639   equ_expression
  4920 | comparison '=' equ_expression
  7640 | comparison '=' equ_expression
  4921 	{$$ = new equ_expression_c($1, $3, locloc(@$));}
  7641 	{$$ = new equ_expression_c($1, $3, locloc(@$));}
  4922 | comparison OPER_NE equ_expression
  7642 | comparison OPER_NE equ_expression
  4923 	{$$ = new notequ_expression_c($1, $3, locloc(@$));}
  7643 	{$$ = new notequ_expression_c($1, $3, locloc(@$));}
       
  7644 /* ERROR_CHECK_BEGIN */
       
  7645 | comparison '=' error
       
  7646   {$$ = NULL;
       
  7647 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '=' in ST expression.");
       
  7648 	 yyerrok;
       
  7649 	}
       
  7650 | comparison OPER_NE error
       
  7651   {$$ = NULL;
       
  7652 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<>' in ST expression.");
       
  7653 	 yyerrok;
       
  7654 	}
       
  7655 /* ERROR_CHECK_END */
  4924 ;
  7656 ;
  4925 
  7657 
  4926 equ_expression:
  7658 equ_expression:
  4927   add_expression
  7659   add_expression
  4928 | equ_expression '<' add_expression
  7660 | equ_expression '<' add_expression
  4931 	{$$ = new gt_expression_c($1, $3, locloc(@$));}
  7663 	{$$ = new gt_expression_c($1, $3, locloc(@$));}
  4932 | equ_expression OPER_LE add_expression
  7664 | equ_expression OPER_LE add_expression
  4933 	{$$ = new le_expression_c($1, $3, locloc(@$));}
  7665 	{$$ = new le_expression_c($1, $3, locloc(@$));}
  4934 | equ_expression OPER_GE add_expression
  7666 | equ_expression OPER_GE add_expression
  4935 	{$$ = new ge_expression_c($1, $3, locloc(@$));}
  7667 	{$$ = new ge_expression_c($1, $3, locloc(@$));}
       
  7668 /* ERROR_CHECK_BEGIN */
       
  7669 | equ_expression '<' error
       
  7670   {$$ = NULL;
       
  7671 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<' in ST expression.");
       
  7672 	 yyerrok;
       
  7673 	}
       
  7674 | equ_expression '>' error
       
  7675   {$$ = NULL;
       
  7676 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '>' in ST expression.");
       
  7677 	 yyerrok;
       
  7678 	}
       
  7679 | equ_expression OPER_LE error
       
  7680   {$$ = NULL;
       
  7681 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<=' in ST expression.");
       
  7682 	 yyerrok;
       
  7683 	}
       
  7684 | equ_expression OPER_GE error
       
  7685   {$$ = NULL;
       
  7686 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '>=' in ST expression.");
       
  7687 	 yyerrok;
       
  7688 	}
       
  7689 /* ERROR_CHECK_END */
  4936 ;
  7690 ;
  4937 
  7691 
  4938 /* Not required...
  7692 /* Not required...
  4939 comparison_operator: '<' | '>' | '>=' '<='
  7693 comparison_operator: '<' | '>' | '>=' '<='
  4940 */
  7694 */
  4943   term
  7697   term
  4944 | add_expression '+' term
  7698 | add_expression '+' term
  4945 	{$$ = new add_expression_c($1, $3, locloc(@$));}
  7699 	{$$ = new add_expression_c($1, $3, locloc(@$));}
  4946 | add_expression '-' term
  7700 | add_expression '-' term
  4947 	{$$ = new sub_expression_c($1, $3, locloc(@$));}
  7701 	{$$ = new sub_expression_c($1, $3, locloc(@$));}
       
  7702 /* ERROR_CHECK_BEGIN */
       
  7703 | add_expression '+' error
       
  7704   {$$ = NULL;
       
  7705 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '+' in ST expression.");
       
  7706 	 yyerrok;
       
  7707 	}
       
  7708 | add_expression '-' error
       
  7709   {$$ = NULL;
       
  7710 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '-' in ST expression.");
       
  7711 	 yyerrok;
       
  7712 	}
       
  7713 /* ERROR_CHECK_END */
  4948 ;
  7714 ;
  4949 
  7715 
  4950 /* Not required...
  7716 /* Not required...
  4951 add_operator: '+' | '-'
  7717 add_operator: '+' | '-'
  4952 */
  7718 */
  4957 	{$$ = new mul_expression_c($1, $3, locloc(@$));}
  7723 	{$$ = new mul_expression_c($1, $3, locloc(@$));}
  4958 | term '/' power_expression
  7724 | term '/' power_expression
  4959 	{$$ = new div_expression_c($1, $3, locloc(@$));}
  7725 	{$$ = new div_expression_c($1, $3, locloc(@$));}
  4960 | term MOD power_expression
  7726 | term MOD power_expression
  4961 	{$$ = new mod_expression_c($1, $3, locloc(@$));}
  7727 	{$$ = new mod_expression_c($1, $3, locloc(@$));}
       
  7728 /* ERROR_CHECK_BEGIN */
       
  7729 | term '*' error
       
  7730   {$$ = NULL;
       
  7731 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '*' in ST expression.");
       
  7732 	 yyerrok;
       
  7733 	}
       
  7734 | term '/' error
       
  7735   {$$ = NULL;
       
  7736 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '/' in ST expression.");
       
  7737 	 yyerrok;
       
  7738 	}
       
  7739 | term MOD error
       
  7740   {$$ = NULL;
       
  7741 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'MOD' in ST expression.");
       
  7742 	 yyerrok;
       
  7743 	}
       
  7744 /* ERROR_CHECK_END */
  4962 ;
  7745 ;
  4963 
  7746 
  4964 /* Not required...
  7747 /* Not required...
  4965 multiply_operator: '*' | '/' | 'MOD'
  7748 multiply_operator: '*' | '/' | 'MOD'
  4966 */
  7749 */
  4967 
  7750 
  4968 power_expression:
  7751 power_expression:
  4969   unary_expression
  7752   unary_expression
  4970 | power_expression OPER_EXP unary_expression
  7753 | power_expression OPER_EXP unary_expression
  4971 	{$$ = new power_expression_c($1, $3, locloc(@$));}
  7754 	{$$ = new power_expression_c($1, $3, locloc(@$));}
       
  7755 /* ERROR_CHECK_BEGIN */
       
  7756 | power_expression OPER_EXP error
       
  7757   {$$ = NULL;
       
  7758 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '**' in ST expression.");
       
  7759 	 yyerrok;
       
  7760 	}
       
  7761 /* ERROR_CHECK_END */
  4972 ;
  7762 ;
  4973 
  7763 
  4974 
  7764 
  4975 unary_expression:
  7765 unary_expression:
  4976   primary_expression
  7766   primary_expression
  4977 | '-' primary_expression
  7767 | '-' primary_expression
  4978 	{$$ = new neg_expression_c($2, locloc(@$));}
  7768 	{$$ = new neg_expression_c($2, locloc(@$));}
  4979 | NOT primary_expression
  7769 | NOT primary_expression
  4980 	{$$ = new not_expression_c($2, locloc(@$));}
  7770 	{$$ = new not_expression_c($2, locloc(@$));}
       
  7771 /* ERROR_CHECK_BEGIN */
       
  7772 | '-' error
       
  7773   {$$ = NULL;
       
  7774 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after '-' in ST expression.");
       
  7775 	 yyerrok;
       
  7776 	}
       
  7777 | NOT error
       
  7778   {$$ = NULL;
       
  7779 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after 'NOT' in ST expression.");
       
  7780 	 yyerrok;
       
  7781 	}
       
  7782 /* ERROR_CHECK_END */
  4981 ;
  7783 ;
  4982 
  7784 
  4983 /* Not required...
  7785 /* Not required...
  4984 unary_operator: '-' | 'NOT'
  7786 unary_operator: '-' | 'NOT'
  4985 */
  7787 */
  5015 | enumerated_value
  7817 | enumerated_value
  5016 | variable
  7818 | variable
  5017 | '(' expression ')'
  7819 | '(' expression ')'
  5018 	{$$ = $2;}
  7820 	{$$ = $2;}
  5019 |  function_invocation
  7821 |  function_invocation
       
  7822 /* ERROR_CHECK_BEGIN */
       
  7823 | '(' expression error
       
  7824   {$$ = NULL;
       
  7825 	 print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of expression in ST expression.");
       
  7826 	 yyerrok;
       
  7827 	}
       
  7828 /* ERROR_CHECK_END */
  5020 ;
  7829 ;
  5021 
  7830 
  5022 
  7831 
  5023 /* intermediate helper symbol for primary_expression */
  7832 /* intermediate helper symbol for primary_expression */
  5024 /* NOTE: function_name includes the standard function name 'NOT' !
  7833 /* NOTE: function_name includes the standard function name 'NOT' !
  5050 /*  function_name '(' [param_assignment_list] ')' */
  7859 /*  function_name '(' [param_assignment_list] ')' */
  5051   function_name_no_NOT_clashes '(' param_assignment_formal_list ')'
  7860   function_name_no_NOT_clashes '(' param_assignment_formal_list ')'
  5052 	{$$ = new function_invocation_c($1, $3, locloc(@$));}
  7861 	{$$ = new function_invocation_c($1, $3, locloc(@$));}
  5053 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
  7862 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
  5054 	{$$ = new function_invocation_c($1, $3, locloc(@$));}
  7863 	{$$ = new function_invocation_c($1, $3, locloc(@$));}
       
  7864 /* ERROR_CHECK_BEGIN */ 
       
  7865 | function_name_no_NOT_clashes param_assignment_formal_list ')'
       
  7866   {$$ = NULL;
       
  7867 	 yynerrs++;
       
  7868 	 print_err_msg(current_filename, locf(@1), locl(@2), "'(' missing after function name in ST expression.");
       
  7869 	}
       
  7870 | function_name_no_NOT_clashes error param_assignment_formal_list ')'
       
  7871   {$$ = NULL;
       
  7872 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '(' after function name in ST expression.");
       
  7873 	 yyerrok;
       
  7874 	}
       
  7875 | function_name_no_NOT_clashes error param_assignment_nonformal_list ')'
       
  7876   {$$ = NULL;
       
  7877 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting '(' after function name in ST expression.");
       
  7878 	 yyerrok;
       
  7879 	}
       
  7880 | function_name_no_NOT_clashes '(' ')'
       
  7881   {$$ = NULL;
       
  7882 	 yynerrs++;
       
  7883 	 print_err_msg(current_filename, locf(@1), locl(@3), "no parameter defined in function invocation of ST expression.");
       
  7884 	}
       
  7885 | function_name_no_NOT_clashes '(' error ')'
       
  7886   {$$ = NULL;
       
  7887 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter(s) defined in function invocation of ST expression.");
       
  7888 	 yyerrok;
       
  7889 	}
       
  7890 | function_name_no_NOT_clashes '(' param_assignment_formal_list error
       
  7891   {$$ = NULL;
       
  7892 	 print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of function invocation in ST expression.");
       
  7893 	 yyerrok;
       
  7894 	}
       
  7895 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list error
       
  7896   {$$ = NULL;
       
  7897 	 print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of function invocation in ST expression.");
       
  7898 	 yyerrok;
       
  7899 	}
       
  7900 /* ERROR_CHECK_END */
  5055 ;
  7901 ;
  5056 
  7902 
  5057 
  7903 
  5058 /********************/
  7904 /********************/
  5059 /* B 3.2 Statements */
  7905 /* B 3.2 Statements */
  5066 | statement_list statement ';'
  7912 | statement_list statement ';'
  5067 	{$$ = $1; $$->add_element($2);}
  7913 	{$$ = $1; $$->add_element($2);}
  5068 | statement_list pragma
  7914 | statement_list pragma
  5069 	{$$ = $1; $$->add_element($2);}
  7915 	{$$ = $1; $$->add_element($2);}
  5070 /* ERROR_CHECK_BEGIN */
  7916 /* ERROR_CHECK_BEGIN */
       
  7917 | statement_list error
       
  7918 	{$$ = $1;
       
  7919 	 print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of statement in ST statement.");
       
  7920 	 yyerrok;
       
  7921 	}
  5071 | statement_list error ';'
  7922 | statement_list error ';'
  5072 	{$$ = $1;
  7923 	{$$ = $1;
  5073 	 print_err_msg(current_filename, locf(@2), locl(@2), "error in statement.");
  7924 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid statement in ST statement.");
  5074 	 /* yychar */
  7925 	 yyerrok;
       
  7926 	}
       
  7927 | statement_list statement error
       
  7928 	{$$ = $1;
       
  7929 	 print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of statement in ST statement.");
  5075 	 yyerrok;
  7930 	 yyerrok;
  5076 	}
  7931 	}
  5077 /* ERROR_CHECK_END */
  7932 /* ERROR_CHECK_END */
  5078 ;
  7933 ;
  5079 
  7934 
  5090 /* B 3.2.1 Assignment Statements */
  7945 /* B 3.2.1 Assignment Statements */
  5091 /*********************************/
  7946 /*********************************/
  5092 assignment_statement:
  7947 assignment_statement:
  5093   variable ASSIGN expression
  7948   variable ASSIGN expression
  5094 	{$$ = new assignment_statement_c($1, $3, locloc(@$));}
  7949 	{$$ = new assignment_statement_c($1, $3, locloc(@$));}
       
  7950 /* ERROR_CHECK_BEGIN */
       
  7951 | variable ASSIGN error
       
  7952 	{$$ = $1;
       
  7953 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after ':=' in ST assignment statement.");
       
  7954 	 yyerrok;
       
  7955 	}
       
  7956 /* ERROR_CHECK_END */
  5095 ;
  7957 ;
  5096 
  7958 
  5097 
  7959 
  5098 
  7960 
  5099 
  7961 
  5117 	{$$ = new fb_invocation_c($1, NULL, locloc(@$));	}
  7979 	{$$ = new fb_invocation_c($1, NULL, locloc(@$));	}
  5118 | prev_declared_fb_name '(' param_assignment_formal_list ')'
  7980 | prev_declared_fb_name '(' param_assignment_formal_list ')'
  5119 	{$$ = new fb_invocation_c($1, $3, locloc(@$));}
  7981 	{$$ = new fb_invocation_c($1, $3, locloc(@$));}
  5120 | prev_declared_fb_name '(' param_assignment_nonformal_list ')'
  7982 | prev_declared_fb_name '(' param_assignment_nonformal_list ')'
  5121 	{$$ = new fb_invocation_c($1, $3, locloc(@$));}
  7983 	{$$ = new fb_invocation_c($1, $3, locloc(@$));}
       
  7984 /* ERROR_CHECK_BEGIN */
       
  7985 | prev_declared_fb_name ')'
       
  7986 	{$$ = $1;
       
  7987 	 yynerrs++;
       
  7988 	 print_err_msg(current_filename, locf(@1), locl(@1), "'(' missing after function block name in ST statement.");
       
  7989 	}
       
  7990 | prev_declared_fb_name param_assignment_formal_list ')'
       
  7991 	{$$ = $1;
       
  7992 	 yynerrs++;
       
  7993 	 print_err_msg(current_filename, locf(@1), locl(@1), "'(' missing after function block name in ST statement.");
       
  7994 	}
       
  7995 | prev_declared_fb_name error ')'
       
  7996 	{$$ = $1;
       
  7997 	 print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
       
  7998 	 yyerrok;
       
  7999 	}
       
  8000 | prev_declared_fb_name error param_assignment_formal_list ')'
       
  8001 	{$$ = $1;
       
  8002 	 print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
       
  8003 	 yyerrok;
       
  8004 	}
       
  8005 | prev_declared_fb_name error param_assignment_nonformal_list ')'
       
  8006 	{$$ = $1;
       
  8007 	 print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
       
  8008 	 yyerrok;
       
  8009 	}
       
  8010 | prev_declared_fb_name '(' error ')'
       
  8011 	{$$ = $1;
       
  8012 	 print_err_msg(current_filename, locf(@1), locl(@1), "invalid parameter list in function block invocation in ST statement.");
       
  8013 	 yyerrok;
       
  8014 	}
       
  8015 | prev_declared_fb_name '(' error
       
  8016 	{$$ = $1;
       
  8017 	 print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
       
  8018 	 yyerrok;
       
  8019 	}
       
  8020 | prev_declared_fb_name '(' param_assignment_formal_list error
       
  8021 	{$$ = $1;
       
  8022 	 print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
       
  8023 	 yyerrok;
       
  8024 	}
       
  8025 | prev_declared_fb_name '(' param_assignment_nonformal_list error
       
  8026 	{$$ = $1;
       
  8027 	 print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
       
  8028 	 yyerrok;
       
  8029 	}
       
  8030 /* ERROR_CHECK_END */
  5122 ;
  8031 ;
  5123 
  8032 
  5124 
  8033 
  5125 /* helper symbol for
  8034 /* helper symbol for
  5126  * - fb_invocation
  8035  * - fb_invocation
  5129 param_assignment_formal_list:
  8038 param_assignment_formal_list:
  5130   param_assignment_formal
  8039   param_assignment_formal
  5131 	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
  8040 	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
  5132 | param_assignment_formal_list ',' param_assignment_formal
  8041 | param_assignment_formal_list ',' param_assignment_formal
  5133 	{$$ = $1; $$->add_element($3);}
  8042 	{$$ = $1; $$->add_element($3);}
       
  8043 /* ERROR_CHECK_BEGIN */
       
  8044 | param_assignment_formal_list error param_assignment_formal
       
  8045   {$$ = NULL;
       
  8046 	 print_err_msg(current_filename, locf(@1), locl(@3), "expecting ',' in ST parameter assignment list.");
       
  8047 	 yyerrok;
       
  8048 	}
       
  8049 | param_assignment_formal_list ',' error
       
  8050   {$$ = NULL;
       
  8051 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter assignment in ST parameter assignment list.");
       
  8052 	 yyerrok;
       
  8053 	}
       
  8054 /* ERROR_CHECK_END */
  5134 ;
  8055 ;
  5135 
  8056 
  5136 /* helper symbol for
  8057 /* helper symbol for
  5137  * - fb_invocation
  8058  * - fb_invocation
  5138  * - function_invocation
  8059  * - function_invocation
  5140 param_assignment_nonformal_list:
  8061 param_assignment_nonformal_list:
  5141   param_assignment_nonformal
  8062   param_assignment_nonformal
  5142 	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
  8063 	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
  5143 | param_assignment_nonformal_list ',' param_assignment_nonformal
  8064 | param_assignment_nonformal_list ',' param_assignment_nonformal
  5144 	{$$ = $1; $$->add_element($3);}
  8065 	{$$ = $1; $$->add_element($3);}
       
  8066 /* ERROR_CHECK_BEGIN */
       
  8067 | param_assignment_nonformal_list ',' error
       
  8068   {$$ = NULL;
       
  8069 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid parameter assignment in ST parameter assignment list.");
       
  8070 	 yyerrok;
       
  8071 	}
       
  8072 /* ERROR_CHECK_END */
  5145 ;
  8073 ;
  5146 
  8074 
  5147 
  8075 
  5148 /* NOTE: According to the IEC 61131-3 standard, there are two possible
  8076 /* NOTE: According to the IEC 61131-3 standard, there are two possible
  5149  *       syntaxes for calling function blocks within ST.
  8077  *       syntaxes for calling function blocks within ST.
  5186 	{$$ = new output_variable_param_assignment_c(NULL,$1, $3, locloc(@$));}
  8114 	{$$ = new output_variable_param_assignment_c(NULL,$1, $3, locloc(@$));}
  5187 /*| NOT variable_name SENDTO variable */
  8115 /*| NOT variable_name SENDTO variable */
  5188 /*| NOT any_identifier SENDTO variable*/
  8116 /*| NOT any_identifier SENDTO variable*/
  5189 | NOT sendto_identifier SENDTO variable
  8117 | NOT sendto_identifier SENDTO variable
  5190 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)),$2, $4, locloc(@$));}
  8118 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)),$2, $4, locloc(@$));}
       
  8119 /* ERROR_CHECK_BEGIN */
       
  8120 | any_identifier ASSIGN error
       
  8121   {$$ = NULL;
       
  8122 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter assignment.");
       
  8123 	 yyerrok;
       
  8124 	} 
       
  8125 | sendto_identifier SENDTO error
       
  8126   {$$ = NULL;
       
  8127 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter out assignment.");
       
  8128 	 yyerrok;
       
  8129 	}
       
  8130 | NOT SENDTO variable
       
  8131   {$$ = NULL;
       
  8132 	 yynerrs++;
       
  8133 	 print_err_msg(current_filename, locf(@1), locl(@2), "no parameter name defined in ST formal parameter out negated assignment.");
       
  8134 	}
       
  8135 | NOT error SENDTO variable
       
  8136   {$$ = NULL;
       
  8137 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment.");
       
  8138 	 yyerrok;
       
  8139 	}
       
  8140 | NOT sendto_identifier SENDTO error
       
  8141   {$$ = NULL;
       
  8142 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter out negated assignment.");
       
  8143 	 yyerrok;
       
  8144 	}
       
  8145 /* ERROR_CHECK_END */
  5191 ;
  8146 ;
  5192 
  8147 
  5193 
  8148 
  5194 
  8149 
  5195 
  8150 
  5206 if_statement:
  8161 if_statement:
  5207   IF expression THEN statement_list elseif_statement_list END_IF
  8162   IF expression THEN statement_list elseif_statement_list END_IF
  5208 	{$$ = new if_statement_c($2, $4, $5, NULL, locloc(@$));}
  8163 	{$$ = new if_statement_c($2, $4, $5, NULL, locloc(@$));}
  5209 | IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF
  8164 | IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF
  5210 	{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));}
  8165 	{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));}
       
  8166 /* ERROR_CHECK_BEGIN */
       
  8167 | IF THEN statement_list elseif_statement_list END_IF
       
  8168   {$$ = NULL;
       
  8169 	 yynerrs++;
       
  8170 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'IF' statement.");
       
  8171 	}
       
  8172 | IF THEN statement_list elseif_statement_list ELSE statement_list END_IF
       
  8173   {$$ = NULL;
       
  8174 	 yynerrs++;
       
  8175 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'IF' statement.");
       
  8176 	}
       
  8177 | IF error THEN statement_list elseif_statement_list END_IF
       
  8178   {$$ = NULL;
       
  8179 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'IF' statement.");
       
  8180 	 yyerrok;
       
  8181 	}
       
  8182 | IF error THEN statement_list elseif_statement_list ELSE statement_list END_IF
       
  8183   {$$ = NULL;
       
  8184 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'IF' statement.");
       
  8185 	 yyerrok;
       
  8186 	}
       
  8187 | IF expression error statement_list elseif_statement_list END_IF
       
  8188   {$$ = NULL;
       
  8189 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in ST 'IF' statement.");
       
  8190 	 yyerrok;
       
  8191 	}
       
  8192 | IF expression error statement_list elseif_statement_list ELSE statement_list END_IF
       
  8193   {$$ = NULL;
       
  8194 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in ST 'IF' statement.");
       
  8195 	 yyerrok;
       
  8196 	}
       
  8197 | IF expression THEN elseif_statement_list END_IF
       
  8198   {$$ = NULL;
       
  8199 	 yynerrs++;
       
  8200 	 print_err_msg(current_filename, locf(@3), locl(@4), "no statement defined after 'THEN' in ST 'IF' statement.");
       
  8201 	}
       
  8202 | IF expression THEN elseif_statement_list ELSE statement_list END_IF
       
  8203   {$$ = NULL;
       
  8204 	 yynerrs++;
       
  8205 	 print_err_msg(current_filename, locf(@3), locl(@4), "no statement defined after 'THEN' in ST 'IF' statement.");
       
  8206 	}
       
  8207 | IF expression THEN statement_list elseif_statement_list ELSE END_IF
       
  8208   {$$ = NULL;
       
  8209 	 yynerrs++;
       
  8210 	 print_err_msg(current_filename, locf(@6), locl(@7), "no statement defined after 'ELSE' in ST 'IF' statement.");
       
  8211 	}
       
  8212 | IF expression THEN statement_list elseif_statement_list ELSE error END_IF
       
  8213   {$$ = NULL;
       
  8214 	 print_err_msg(current_filename, locf(@6), locl(@8), "invalid statement defined after 'ELSE' in ST 'IF' statement.");
       
  8215 	 yyerrok;
       
  8216 	}
       
  8217 | IF error END_IF
       
  8218   {$$ = NULL;
       
  8219 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'IF' statement.");
       
  8220 	 yyerrok;
       
  8221 	}
       
  8222 /* ERROR_CHECK_END */
  5211 ;
  8223 ;
  5212 
  8224 
  5213 /* helper symbol for if_statement */
  8225 /* helper symbol for if_statement */
  5214 elseif_statement_list:
  8226 elseif_statement_list:
  5215   /* empty */
  8227   /* empty */
  5220 
  8232 
  5221 /* helper symbol for elseif_statement_list */
  8233 /* helper symbol for elseif_statement_list */
  5222 elseif_statement:
  8234 elseif_statement:
  5223   ELSIF expression THEN statement_list
  8235   ELSIF expression THEN statement_list
  5224 	{$$ = new elseif_statement_c($2, $4, locloc(@$));}
  8236 	{$$ = new elseif_statement_c($2, $4, locloc(@$));}
       
  8237 /* ERROR_CHECK_BEGIN */
       
  8238 | ELSIF THEN statement_list
       
  8239   {$$ = NULL;
       
  8240 	 yynerrs++;
       
  8241 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined for 'ELSEIF' statement in ST 'IF' statement.");
       
  8242 	}
       
  8243 | ELSIF error THEN statement_list
       
  8244   {$$ = NULL;
       
  8245 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for 'ELSEIF' statement in ST 'IF' statement.");
       
  8246 	 yyerrok;
       
  8247 	}
       
  8248 | ELSIF expression error statement_list
       
  8249   {$$ = NULL;
       
  8250 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in 'ELSEIF' statement of ST 'IF' statement.");
       
  8251 	 yyerrok;
       
  8252 	}
       
  8253 | ELSIF expression THEN error
       
  8254   {$$ = NULL;
       
  8255 	 print_err_msg(current_filename, locf(@3), locl(@3), "invalid statement list in 'ELSEIF' statement of ST 'IF' statement.");
       
  8256 	 yyerrok;
       
  8257 	}
       
  8258 /* ERROR_CHECK_END */
  5225 ;
  8259 ;
  5226 
  8260 
  5227 
  8261 
  5228 case_statement:
  8262 case_statement:
  5229   CASE expression OF case_element_list END_CASE
  8263   CASE expression OF case_element_list END_CASE
  5230 	{$$ = new case_statement_c($2, $4, NULL, locloc(@$));}
  8264 	{$$ = new case_statement_c($2, $4, NULL, locloc(@$));}
  5231 | CASE expression OF case_element_list ELSE statement_list END_CASE
  8265 | CASE expression OF case_element_list ELSE statement_list END_CASE
  5232 	{$$ = new case_statement_c($2, $4, $6, locloc(@$));}
  8266 	{$$ = new case_statement_c($2, $4, $6, locloc(@$));}
       
  8267 /* ERROR_CHECK_BEGIN */
       
  8268 | CASE OF case_element_list END_CASE
       
  8269   {$$ = NULL;
       
  8270 	 yynerrs++;
       
  8271 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'CASE' statement.");
       
  8272 	}
       
  8273 | CASE OF case_element_list ELSE statement_list END_CASE
       
  8274   {$$ = NULL;
       
  8275 	 yynerrs++;
       
  8276 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'CASE' statement.");
       
  8277 	}
       
  8278 | CASE error OF case_element_list END_CASE
       
  8279   {$$ = NULL;
       
  8280 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'CASE' statement.");
       
  8281 	 yyerrok;
       
  8282 	}
       
  8283 | CASE error OF case_element_list ELSE statement_list END_CASE
       
  8284   {$$ = NULL;
       
  8285 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'CASE' statement.");
       
  8286 	 yyerrok;
       
  8287 	}
       
  8288 | CASE expression error case_element_list END_CASE
       
  8289   {$$ = NULL;
       
  8290 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'OF' after test expression in ST 'CASE' statement.");
       
  8291 	 yyerrok;
       
  8292 	}
       
  8293 | CASE expression error case_element_list ELSE statement_list END_CASE
       
  8294   {$$ = NULL;
       
  8295 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'OF' after test expression in ST 'CASE' statement.");
       
  8296 	 yyerrok;
       
  8297 	}
       
  8298 | CASE expression OF END_CASE
       
  8299   {$$ = NULL;
       
  8300 	 yynerrs++;
       
  8301 	 print_err_msg(current_filename, locf(@3), locl(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement.");
       
  8302 	}
       
  8303 | CASE expression OF ELSE statement_list END_CASE
       
  8304   {$$ = NULL;
       
  8305 	 yynerrs++;
       
  8306 	 print_err_msg(current_filename, locf(@3), locl(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement.");
       
  8307 	}
       
  8308 | CASE expression OF error END_CASE
       
  8309   {$$ = NULL;
       
  8310 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid case element(s) defined after 'OF' in ST 'CASE' statement.");
       
  8311 	 yyerrok;
       
  8312 	}
       
  8313 | CASE expression OF error ELSE statement_list END_CASE
       
  8314   {$$ = NULL;
       
  8315 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid case element(s) defined after 'OF' in ST 'CASE' statement.");
       
  8316 	 yyerrok;
       
  8317 	}
       
  8318 | CASE expression OF case_element_list ELSE END_CASE
       
  8319   {$$ = NULL;
       
  8320 	 yynerrs++;
       
  8321 	 print_err_msg(current_filename, locf(@5), locl(@6), "no statement defined after 'ELSE' in ST 'CASE' statement.");
       
  8322 	}
       
  8323 | CASE expression OF case_element_list ELSE error END_CASE
       
  8324   {$$ = NULL;
       
  8325 	 print_err_msg(current_filename, locf(@5), locl(@7), "invalid statement defined after 'ELSE' in ST 'CASE' statement.");
       
  8326 	 yyerrok;
       
  8327 	}
       
  8328 | CASE error END_CASE
       
  8329   {$$ = NULL;
       
  8330 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'CASE' statement.");
       
  8331 	 yyerrok;
       
  8332 	}
       
  8333 /* ERROR_CHECK_END */
  5233 ;
  8334 ;
  5234 
  8335 
  5235 
  8336 
  5236 /* helper symbol for case_statement */
  8337 /* helper symbol for case_statement */
  5237 case_element_list:
  8338 case_element_list:
  5243 
  8344 
  5244 
  8345 
  5245 case_element:
  8346 case_element:
  5246   case_list ':' statement_list
  8347   case_list ':' statement_list
  5247 	{$$ = new case_element_c($1, $3, locloc(@$));}
  8348 	{$$ = new case_element_c($1, $3, locloc(@$));}
       
  8349 /* ERROR_CHECK_BEGIN */
       
  8350 | case_list statement_list
       
  8351   {$$ = NULL;
       
  8352 	 yynerrs++;
       
  8353 	 print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after case list in ST 'CASE' statement.");
       
  8354 	}
       
  8355 | case_list ':' error
       
  8356   {$$ = NULL;
       
  8357 	 print_err_msg(current_filename, locf(@1), locl(@2), "invalid statement in case element of ST 'CASE' statement.");
       
  8358 	 yyerrok;
       
  8359 	}
       
  8360 /* ERROR_CHECK_END */
  5248 ;
  8361 ;
  5249 
  8362 
  5250 
  8363 
  5251 case_list:
  8364 case_list:
  5252   case_list_element
  8365   case_list_element
  5253 	{$$ = new case_list_c(locloc(@$)); $$->add_element($1);}
  8366 	{$$ = new case_list_c(locloc(@$)); $$->add_element($1);}
  5254 | case_list ',' case_list_element
  8367 | case_list ',' case_list_element
  5255 	{$$ = $1; $$->add_element($3);}
  8368 	{$$ = $1; $$->add_element($3);}
       
  8369 /* ERROR_CHECK_BEGIN */
       
  8370 | case_list ',' error
       
  8371   {$$ = NULL;
       
  8372 	 print_err_msg(current_filename, locf(@2), locl(@2), "invalid case in case list of ST parameter assignment list.");
       
  8373 	 yyerrok;
       
  8374 	}
       
  8375 /* ERROR_CHECK_END */
  5256 ;
  8376 ;
  5257 
  8377 
  5258 
  8378 
  5259 case_list_element:
  8379 case_list_element:
  5260   signed_integer
  8380   signed_integer
  5280 for_statement:
  8400 for_statement:
  5281   FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_FOR
  8401   FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_FOR
  5282 	{$$ = new for_statement_c($2, $4, $6, $8, $10, locloc(@$));}
  8402 	{$$ = new for_statement_c($2, $4, $6, $8, $10, locloc(@$));}
  5283 | FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR
  8403 | FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR
  5284 	{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));}
  8404 	{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));}
       
  8405 /* ERROR_CHECK_BEGIN */
       
  8406 | FOR ASSIGN expression TO expression BY expression DO statement_list END_FOR
       
  8407   {$$ = NULL;
       
  8408 	 yynerrs++;
       
  8409 	 print_err_msg(current_filename, locf(@1), locl(@2), "no control variable defined in ST 'FOR' statement.");
       
  8410 	}
       
  8411 | FOR ASSIGN expression TO expression DO statement_list END_FOR
       
  8412   {$$ = NULL;
       
  8413 	 yynerrs++;
       
  8414 	 print_err_msg(current_filename, locf(@1), locl(@2), "no control variable defined in ST 'FOR' statement.");
       
  8415 	}
       
  8416 | FOR error ASSIGN expression TO expression BY expression DO statement_list END_FOR
       
  8417   {$$ = NULL;
       
  8418 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid control variable defined for ST 'FOR' statement.");
       
  8419 	 yyerrok;
       
  8420 	}
       
  8421 | FOR error ASSIGN expression TO expression DO statement_list END_FOR
       
  8422   {$$ = NULL;
       
  8423 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid control variable defined for ST 'FOR' statement.");
       
  8424 	 yyerrok;
       
  8425 	}
       
  8426 | FOR control_variable expression TO expression BY expression DO statement_list END_FOR
       
  8427   {$$ = NULL;
       
  8428 	 yynerrs++;
       
  8429 	 print_err_msg(current_filename, locf(@2), locl(@3), "':=' missing between control variable and start expression in ST 'FOR' statement.");
       
  8430 	}
       
  8431 | FOR control_variable expression TO expression DO statement_list END_FOR
       
  8432   {$$ = NULL;
       
  8433 	 yynerrs++;
       
  8434 	 print_err_msg(current_filename, locf(@2), locl(@3), "':=' missing between control variable and start expression in ST 'FOR' statement.");
       
  8435 	}
       
  8436 | FOR control_variable error expression TO expression BY expression DO statement_list END_FOR
       
  8437   {$$ = NULL;
       
  8438 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':=' between control variable and start expression in ST 'FOR' statement.");
       
  8439 	 yyerrok;
       
  8440 	}
       
  8441 | FOR control_variable error expression TO expression DO statement_list END_FOR
       
  8442   {$$ = NULL;
       
  8443 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':=' between control variable and start expression in ST 'FOR' statement.");
       
  8444 	 yyerrok;
       
  8445 	}
       
  8446 | FOR control_variable ASSIGN TO expression BY expression DO statement_list END_FOR
       
  8447   {$$ = NULL;
       
  8448 	 yynerrs++;
       
  8449 	 print_err_msg(current_filename, locf(@3), locl(@4), "no start expression defined in ST 'FOR' statement.");
       
  8450 	}
       
  8451 | FOR control_variable ASSIGN TO expression DO statement_list END_FOR
       
  8452   {$$ = NULL;
       
  8453 	 yynerrs++;
       
  8454 	 print_err_msg(current_filename, locf(@3), locl(@4), "no start expression defined in ST 'FOR' statement.");
       
  8455 	}
       
  8456 | FOR control_variable ASSIGN error TO expression BY expression DO statement_list END_FOR
       
  8457   {$$ = NULL;
       
  8458 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid start expression defined in ST 'FOR' statement.");
       
  8459 	 yyerrok;
       
  8460 	}
       
  8461 | FOR control_variable ASSIGN error TO expression DO statement_list END_FOR
       
  8462   {$$ = NULL;
       
  8463 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid start expression in ST 'FOR' statement.");
       
  8464 	 yyerrok;
       
  8465 	}
       
  8466 | FOR control_variable ASSIGN expression error expression BY expression DO statement_list END_FOR
       
  8467   {$$ = NULL;
       
  8468 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between start expression and end expression in ST 'FOR' statement.");
       
  8469 	 yyerrok;
       
  8470 	}
       
  8471 | FOR control_variable ASSIGN expression error expression DO statement_list END_FOR
       
  8472   {$$ = NULL;
       
  8473 	 print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between start expression and end expression in ST 'FOR' statement.");
       
  8474 	 yyerrok;
       
  8475 	}
       
  8476 | FOR control_variable ASSIGN expression TO expression error expression DO statement_list END_FOR
       
  8477   {$$ = NULL;
       
  8478 	 print_err_msg(current_filename, locf(@6), locl(@8), "expecting 'BY' between end expression and step expression in ST 'FOR' statement.");
       
  8479 	 yyerrok;
       
  8480 	}
       
  8481 | FOR control_variable ASSIGN expression TO expression BY expression error statement_list END_FOR
       
  8482   {$$ = NULL;
       
  8483 	 print_err_msg(current_filename, locf(@8), locl(@10), "expecting 'DO' after step expression in ST 'FOR' statement.");
       
  8484 	 yyerrok;
       
  8485 	}
       
  8486 | FOR control_variable ASSIGN expression TO expression error statement_list END_FOR
       
  8487   {$$ = NULL;
       
  8488 	 print_err_msg(current_filename, locf(@6), locl(@8), "expecting 'DO' after end expression in ST 'FOR' statement.");
       
  8489 	 yyerrok;
       
  8490 	}
       
  8491 | FOR control_variable ASSIGN expression TO expression BY expression DO END_FOR
       
  8492   {$$ = NULL;
       
  8493 	 print_err_msg(current_filename, locf(@9), locl(@10), "no statement(s) defined after 'DO' in ST 'FOR' statement.");
       
  8494 	 yyerrok;
       
  8495 	}
       
  8496 | FOR control_variable ASSIGN expression TO expression DO END_FOR
       
  8497   {$$ = NULL;
       
  8498 	 print_err_msg(current_filename, locf(@7), locl(@8), "no statement(s) defined after 'DO' in ST 'FOR' statement.");
       
  8499 	 yyerrok;
       
  8500 	}
       
  8501 | FOR control_variable ASSIGN expression TO expression BY expression DO error END_FOR
       
  8502   {$$ = NULL;
       
  8503 	 print_err_msg(current_filename, locf(@9), locl(@11), "invalid statement(s) defined after 'DO' in ST 'FOR' statement.");
       
  8504 	 yyerrok;
       
  8505 	}
       
  8506 | FOR control_variable ASSIGN expression TO expression DO error END_FOR
       
  8507   {$$ = NULL;
       
  8508 	 print_err_msg(current_filename, locf(@7), locl(@9), "invalid statement(s) defined after 'DO' in ST 'FOR' statement.");
       
  8509 	 yyerrok;
       
  8510 	}
       
  8511 /* ERROR_CHECK_END */
  5285 ;
  8512 ;
  5286 
  8513 
  5287 /* The spec has the syntax
  8514 /* The spec has the syntax
  5288  * control_variable: identifier;
  8515  * control_variable: identifier;
  5289  * but then defines the semantics of control_variable
  8516  * but then defines the semantics of control_variable
  5310 
  8537 
  5311 
  8538 
  5312 while_statement:
  8539 while_statement:
  5313   WHILE expression DO statement_list END_WHILE
  8540   WHILE expression DO statement_list END_WHILE
  5314 	{$$ = new while_statement_c($2, $4, locloc(@$));}
  8541 	{$$ = new while_statement_c($2, $4, locloc(@$));}
       
  8542 /* ERROR_CHECK_BEGIN */
       
  8543 | WHILE DO statement_list END_WHILE
       
  8544   {$$ = NULL;
       
  8545 	 yynerrs++;
       
  8546 	 print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'WHILE' statement.");
       
  8547 	}
       
  8548 | WHILE error DO statement_list END_WHILE
       
  8549   {$$ = NULL;
       
  8550 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'WHILE' statement.");
       
  8551 	 yyerrok;
       
  8552 	}
       
  8553 | WHILE expression error statement_list END_WHILE
       
  8554   {$$ = NULL;
       
  8555 	 print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'DO' after test expression in ST 'WHILE' statement.");
       
  8556 	 yyerrok;
       
  8557 	}
       
  8558 | WHILE expression DO END_WHILE
       
  8559   {$$ = NULL;
       
  8560 	 yynerrs++;
       
  8561 	 print_err_msg(current_filename, locf(@3), locl(@4), "no statement(s) defined after 'DO' in ST 'WHILE' statement.");
       
  8562 	}
       
  8563 | WHILE expression DO error END_WHILE
       
  8564   {$$ = NULL;
       
  8565 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid statement(s) defined after 'DO' in ST 'WHILE' statement.");
       
  8566 	 yyerrok;
       
  8567 	}
       
  8568 | WHILE error END_WHILE
       
  8569   {$$ = NULL;
       
  8570 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'WHILE' statement.");
       
  8571 	 yyerrok;
       
  8572 	}
       
  8573 /* ERROR_CHECK_END */
  5315 ;
  8574 ;
  5316 
  8575 
  5317 
  8576 
  5318 repeat_statement:
  8577 repeat_statement:
  5319   REPEAT statement_list UNTIL expression END_REPEAT
  8578   REPEAT statement_list UNTIL expression END_REPEAT
  5320 	{$$ = new repeat_statement_c($2, $4, locloc(@$));}
  8579 	{$$ = new repeat_statement_c($2, $4, locloc(@$));}
       
  8580 /* ERROR_CHECK_BEGIN */
       
  8581 | REPEAT UNTIL expression END_REPEAT
       
  8582   {$$ = NULL;
       
  8583 	 yynerrs++;
       
  8584 	 print_err_msg(current_filename, locf(@1), locl(@2), "no statement(s) defined after 'REPEAT' in ST 'REPEAT' statement.");
       
  8585 	}
       
  8586 | REPEAT error UNTIL expression END_REPEAT
       
  8587   {$$ = NULL;
       
  8588 	 print_err_msg(current_filename, locf(@1), locl(@3), "invalid statement(s) defined after 'REPEAT' for ST 'REPEAT' statement.");
       
  8589 	 yyerrok;
       
  8590 	}
       
  8591 | REPEAT statement_list UNTIL END_REPEAT
       
  8592   {$$ = NULL;
       
  8593 	 yynerrs++;
       
  8594 	 print_err_msg(current_filename, locf(@3), locl(@4), "no test expression defined after 'UNTIL' in ST 'REPEAT' statement.");
       
  8595 	}
       
  8596 | REPEAT statement_list UNTIL error END_REPEAT
       
  8597   {$$ = NULL;
       
  8598 	 print_err_msg(current_filename, locf(@3), locl(@5), "invalid test expression defined after 'UNTIL' in ST 'REPEAT' statement.");
       
  8599 	 yyerrok;
       
  8600 	}
       
  8601 | REPEAT error END_REPEAT
       
  8602   {$$ = NULL;
       
  8603 	 print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'REPEAT' statement.");
       
  8604 	 yyerrok;
       
  8605 	}
       
  8606 /* ERROR_CHECK_END */
  5321 ;
  8607 ;
  5322 
  8608 
  5323 
  8609 
  5324 exit_statement:
  8610 exit_statement:
  5325   EXIT	{$$ = new exit_statement_c(locloc(@$));}
  8611   EXIT	{$$ = new exit_statement_c(locloc(@$));}
  5374                    int first_line,
  8660                    int first_line,
  5375                    int first_column,
  8661                    int first_column,
  5376                    int last_line,
  8662                    int last_line,
  5377                    int last_column,
  8663                    int last_column,
  5378                    const char *additional_error_msg) {
  8664                    const char *additional_error_msg) {
  5379   fprintf(stderr, "error %d: %s\n", yynerrs /* a global variable */, additional_error_msg);
  8665   fprintf(stderr, "%s:%d: error : %s\n", filename, first_line, additional_error_msg);
       
  8666   //fprintf(stderr, "error %d: %s\n", yynerrs /* a global variable */, additional_error_msg);
  5380   print_include_stack();
  8667   print_include_stack();
  5381   fprintf(stderr, "%s(%d-%d): %s\n", filename, first_line, last_line, current_error_msg);
  8668   //fprintf(stderr, "%s(%d-%d): %s\n", filename, first_line, last_line, current_error_msg);
  5382 }
  8669 }
  5383 
  8670 
  5384 
  8671 
  5385 
  8672 
  5386 /* convert between an il_operator to a function name */
  8673 /* convert between an il_operator to a function name */