stage1_2/iec_bison.yy
changeset 520 fb381d2cd25b
parent 516 8591746fa134
child 547 dab341e80664
equal deleted inserted replaced
519:018093957030 520:fb381d2cd25b
  1907 ;
  1907 ;
  1908 
  1908 
  1909 
  1909 
  1910 integer_literal:
  1910 integer_literal:
  1911   integer_type_name '#' signed_integer
  1911   integer_type_name '#' signed_integer
  1912 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1912 	{$$ = new integer_literal_c($1, $3, locloc(@$));}
  1913 | integer_type_name '#' binary_integer
  1913 | integer_type_name '#' binary_integer
  1914 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1914 	{$$ = new integer_literal_c($1, $3, locloc(@$));}
  1915 | integer_type_name '#' octal_integer
  1915 | integer_type_name '#' octal_integer
  1916 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1916 	{$$ = new integer_literal_c($1, $3, locloc(@$));}
  1917 | integer_type_name '#' hex_integer
  1917 | integer_type_name '#' hex_integer
  1918 	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@3));}
  1918 	{$$ = new integer_literal_c($1, $3, locloc(@$));}
  1919 /* NOTE: see note in the definition of constant for reason
  1919 /* NOTE: see note in the definition of constant for reason
  1920  * why signed_integer, binary_integer, octal_integer
  1920  * why signed_integer, binary_integer, octal_integer
  1921  * and hex_integer are missing here!
  1921  * and hex_integer are missing here!
  1922  */
  1922  */
  1923 /* ERROR_CHECK_BEGIN */
  1923 /* ERROR_CHECK_BEGIN */
  1949 /* NOTE: see note in the definition of constant for reason
  1949 /* NOTE: see note in the definition of constant for reason
  1950  * why signed_real is missing here!
  1950  * why signed_real is missing here!
  1951  */
  1951  */
  1952 /*  signed_real */
  1952 /*  signed_real */
  1953   real_type_name '#' signed_real
  1953   real_type_name '#' signed_real
  1954 	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
  1954 	{$$ = new real_literal_c($1, $3, locloc(@$));}
  1955 /* ERROR_CHECK_BEGIN */
  1955 /* ERROR_CHECK_BEGIN */
  1956 | real_type_name signed_real
  1956 | real_type_name signed_real
  1957 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;}
  1957 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;}
  1958 | real_type_name '#' error
  1958 | real_type_name '#' error
  1959   {$$ = NULL;
  1959   {$$ = NULL;
  1973 
  1973 
  1974 
  1974 
  1975 
  1975 
  1976 bit_string_literal:
  1976 bit_string_literal:
  1977   bit_string_type_name '#' integer  /* i.e. unsigned_integer */
  1977   bit_string_type_name '#' integer  /* i.e. unsigned_integer */
  1978 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1978 	{$$ = new bit_string_literal_c($1, $3, locloc(@$));}
  1979 | bit_string_type_name '#' binary_integer
  1979 | bit_string_type_name '#' binary_integer
  1980 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1980 	{$$ = new bit_string_literal_c($1, $3, locloc(@$));}
  1981 | bit_string_type_name '#' octal_integer
  1981 | bit_string_type_name '#' octal_integer
  1982 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1982 	{$$ = new bit_string_literal_c($1, $3, locloc(@$));}
  1983 | bit_string_type_name '#' hex_integer
  1983 | bit_string_type_name '#' hex_integer
  1984 	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@3));}
  1984 	{$$ = new bit_string_literal_c($1, $3, locloc(@$));}
  1985 /* NOTE: see note in the definition of constant for reason
  1985 /* NOTE: see note in the definition of constant for reason
  1986  * why unsigned_integer, binary_integer, octal_integer
  1986  * why unsigned_integer, binary_integer, octal_integer
  1987  * and hex_integer are missing here!
  1987  * and hex_integer are missing here!
  1988  */
  1988  */
  1989 /* NOTE: see note under the B 1.2.1 section of token
  1989 /* NOTE: see note under the B 1.2.1 section of token
  6285 
  6285 
  6286 instruction_list:
  6286 instruction_list:
  6287   il_instruction
  6287   il_instruction
  6288 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
  6288 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
  6289 | any_pragma eol_list
  6289 | any_pragma eol_list
  6290 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
  6290 	{$$ = new instruction_list_c(locloc(@1)); $$->add_element($1);} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6291 | instruction_list il_instruction
  6291 | instruction_list il_instruction
  6292 	{$$ = $1; $$->add_element($2);}
  6292 	{$$ = $1; $$->add_element($2);}
  6293 | instruction_list any_pragma
  6293 | instruction_list any_pragma
  6294 	{$$ = $1; $$->add_element($2);}
  6294 	{$$ = $1; $$->add_element($2);}
  6295 ;
  6295 ;
  6296 
  6296 
  6297 
  6297 
  6298 
  6298 
  6299 il_instruction:
  6299 il_instruction:
  6300   il_incomplete_instruction eol_list
  6300   il_incomplete_instruction eol_list
  6301 	{$$ = new il_instruction_c(NULL, $1, locloc(@$));}
  6301 	{$$ = new il_instruction_c(NULL, $1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6302 | label ':' il_incomplete_instruction eol_list
  6302 | label ':' il_incomplete_instruction eol_list
  6303 	{$$ = new il_instruction_c($1, $3, locloc(@$));}
  6303 	{$$ = new il_instruction_c($1, $3, locf(@1), locl(@3));} /* locf(@1), locl(@3) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6304 | label ':' eol_list
  6304 | label ':' eol_list
  6305 	{$$ = new il_instruction_c($1, NULL, locloc(@$));}
  6305 	{$$ = new il_instruction_c($1, NULL, locf(@1), locl(@2));} /* locf(@1), locl(@2) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6306 /* ERROR_CHECK_BEGIN */
  6306 /* ERROR_CHECK_BEGIN */
  6307 | error eol_list
  6307 | error eol_list
  6308 	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;}
  6308 	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;}
  6309 | il_incomplete_instruction error
  6309 | il_incomplete_instruction error
  6310 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of IL instruction."); yyerrok;}
  6310 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of IL instruction."); yyerrok;}
  6635 ;
  6635 ;
  6636 
  6636 
  6637 
  6637 
  6638 il_simple_instruction:
  6638 il_simple_instruction:
  6639   il_simple_operation eol_list
  6639   il_simple_operation eol_list
  6640 	{$$ = new il_simple_instruction_c($1, locloc(@$));}
  6640 	{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6641 | il_expression eol_list
  6641 | il_expression eol_list
  6642 	{$$ = new il_simple_instruction_c($1, locloc(@$));}
  6642 	{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6643 | il_formal_funct_call eol_list
  6643 | il_formal_funct_call eol_list
  6644 	{$$ = new il_simple_instruction_c($1, locloc(@$));}
  6644 	{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */
  6645 /* ERROR_CHECK_BEGIN */
  6645 /* ERROR_CHECK_BEGIN */
  6646 | il_expression error
  6646 | il_expression error
  6647   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after expression IL instruction."); yyerrok;}
  6647   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after expression IL instruction."); yyerrok;}
  6648 | il_formal_funct_call error
  6648 | il_formal_funct_call error
  6649   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after formal function call IL instruction."); yyerrok;}
  6649   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after formal function call IL instruction."); yyerrok;}