stage1_2/iec.y
changeset 146 eef5e62048c7
parent 143 73372bdeeffb
child 147 f34f9084a20e
equal deleted inserted replaced
145:72ae82e65dbc 146:eef5e62048c7
   654 %type  <leaf>	input_declarations
   654 %type  <leaf>	input_declarations
   655 /* helper symbol for input_declarations */
   655 /* helper symbol for input_declarations */
   656 %type  <list>	input_declaration_list
   656 %type  <list>	input_declaration_list
   657 %type  <leaf>	input_declaration
   657 %type  <leaf>	input_declaration
   658 %type  <leaf>	edge_declaration
   658 %type  <leaf>	edge_declaration
       
   659 %type  <leaf>	en_param_declaration
   659 %type  <leaf>	var_init_decl
   660 %type  <leaf>	var_init_decl
   660 %type  <leaf>	var1_init_decl
   661 %type  <leaf>	var1_init_decl
   661 %type  <list>	var1_list
   662 %type  <list>	var1_list
   662 %type  <leaf>	array_var_init_decl
   663 %type  <leaf>	array_var_init_decl
   663 %type  <leaf>	structured_var_init_decl
   664 %type  <leaf>	structured_var_init_decl
   667 /* helper symbol for fb_name_list_with_colon */
   668 /* helper symbol for fb_name_list_with_colon */
   668 %type  <list>	var1_list_with_colon
   669 %type  <list>	var1_list_with_colon
   669 // %type  <list>	fb_name_list
   670 // %type  <list>	fb_name_list
   670 // %type  <leaf>	fb_name
   671 // %type  <leaf>	fb_name
   671 %type  <leaf>	output_declarations
   672 %type  <leaf>	output_declarations
       
   673 %type  <leaf>	var_output_init_decl
       
   674 %type  <list>	var_output_init_decl_list
       
   675 %type  <leaf>	en_param_declaration
   672 %type  <leaf>	input_output_declarations
   676 %type  <leaf>	input_output_declarations
   673 /* helper symbol for input_output_declarations */
   677 /* helper symbol for input_output_declarations */
   674 %type  <list>	var_declaration_list
   678 %type  <list>	var_declaration_list
   675 %type  <leaf>	var_declaration
   679 %type  <leaf>	var_declaration
   676 %type  <leaf>	temp_var_decl
   680 %type  <leaf>	temp_var_decl
   709 %type  <leaf>	var_spec
   713 %type  <leaf>	var_spec
   710 /* helper symbol for var_spec */
   714 /* helper symbol for var_spec */
   711 %type  <leaf>	string_spec
   715 %type  <leaf>	string_spec
   712 /* intermediate helper symbol for:
   716 /* intermediate helper symbol for:
   713  *  - non_retentive_var_decls
   717  *  - non_retentive_var_decls
   714  *  - output_declarations
   718  *  - var_declarations
   715  */
   719  */
   716 %type  <list>	var_init_decl_list
   720 %type  <list>	var_init_decl_list
   717 
   721 
   718 %token  <ID>	incompl_location_token
   722 %token  <ID>	incompl_location_token
   719 
   723 
  2962 /* B 1.4 - Variables */
  2966 /* B 1.4 - Variables */
  2963 /*********************/
  2967 /*********************/
  2964 variable:
  2968 variable:
  2965   symbolic_variable
  2969   symbolic_variable
  2966 | direct_variable
  2970 | direct_variable
       
  2971 | eno_param
  2967 ;
  2972 ;
  2968 
  2973 
  2969 
  2974 
  2970 symbolic_variable:
  2975 symbolic_variable:
  2971 /* NOTE: To be entirely correct, variable_name must be replacemed by
  2976 /* NOTE: To be entirely correct, variable_name must be replacemed by
  3158 
  3163 
  3159 
  3164 
  3160 input_declaration:
  3165 input_declaration:
  3161   var_init_decl
  3166   var_init_decl
  3162 | edge_declaration
  3167 | edge_declaration
       
  3168 | en_param_declaration
  3163 ;
  3169 ;
  3164 
  3170 
  3165 
  3171 
  3166 edge_declaration:
  3172 edge_declaration:
  3167   var1_list ':' BOOL R_EDGE
  3173   var1_list ':' BOOL R_EDGE
  3168 	{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3174 	{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3169 | var1_list ':' BOOL F_EDGE
  3175 | var1_list ':' BOOL F_EDGE
  3170 	{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3176 	{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
  3171 /* ERROR_CHECK_BEGIN */
  3177 /* ERROR_CHECK_BEGIN */
  3172 | var1_list BOOL R_EDGE
  3178 | var1_list BOOL R_EDGE
  3173 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification."); yynerrs++;}
  3179 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;}
  3174 | var1_list BOOL F_EDGE
  3180 | var1_list BOOL F_EDGE
  3175 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification."); yynerrs++;}
  3181 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;}
  3176 | var1_list ':' BOOL R_EDGE F_EDGE
  3182 | var1_list ':' BOOL R_EDGE F_EDGE
  3177 	{$$ = NULL; print_err_msg(locf(@5), locl(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;}
  3183 	{$$ = NULL; print_err_msg(locf(@5), locl(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;}
  3178 | var1_list ':' R_EDGE
  3184 | var1_list ':' R_EDGE
  3179 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
  3185 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
  3180 | var1_list ':' F_EDGE
  3186 | var1_list ':' F_EDGE
  3181 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
  3187 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
  3182 /* ERROR_CHECK_END */
  3188 /* ERROR_CHECK_END */
  3183 ;
  3189 ;
  3184 
  3190 
       
  3191 en_param_declaration:
       
  3192   en_param ':' BOOL ASSIGN boolean_literal
       
  3193   {$$ = new en_param_declaration_c(locloc(@$));}
       
  3194 | en_param ':' BOOL ASSIGN integer
       
  3195   {$$ = new en_param_declaration_c(locloc(@$));}
       
  3196 /* ERROR_CHECK_BEGIN */
       
  3197 | en_param BOOL ASSIGN boolean_literal
       
  3198 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;}
       
  3199 | en_param BOOL ASSIGN integer
       
  3200 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;}
       
  3201 | en_param ':' ASSIGN boolean_literal
       
  3202   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;}
       
  3203 | en_param ':' ASSIGN integer
       
  3204 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;}
       
  3205 | en_param ':' BOOL ASSIGN error
       
  3206 	{$$ = NULL;
       
  3207 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in EN declaration.");}
       
  3208 	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in EN declaration."); yyclearin;}
       
  3209 	 yyerrok;
       
  3210 	}
       
  3211 /* ERROR_CHECK_END */
       
  3212 ;
  3185 
  3213 
  3186 var_init_decl:
  3214 var_init_decl:
  3187   var1_init_decl
  3215   var1_init_decl
  3188 | array_var_init_decl
  3216 | array_var_init_decl
  3189 | structured_var_init_decl
  3217 | structured_var_init_decl
  3339 // fb_name: identifier;
  3367 // fb_name: identifier;
  3340 
  3368 
  3341 
  3369 
  3342 
  3370 
  3343 output_declarations:
  3371 output_declarations:
  3344   VAR_OUTPUT var_init_decl_list END_VAR
  3372   VAR_OUTPUT var_output_init_decl_list END_VAR
  3345 	{$$ = new output_declarations_c(NULL, $2, locloc(@$));}
  3373 	{$$ = new output_declarations_c(NULL, $2, locloc(@$));}
  3346 | VAR_OUTPUT RETAIN var_init_decl_list END_VAR
  3374 | VAR_OUTPUT RETAIN var_output_init_decl_list END_VAR
  3347 	{$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3375 	{$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
  3348 | VAR_OUTPUT NON_RETAIN var_init_decl_list END_VAR
  3376 | VAR_OUTPUT NON_RETAIN var_output_init_decl_list END_VAR
  3349 	{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  3377 	{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
  3350 /* ERROR_CHECK_BEGIN */
  3378 /* ERROR_CHECK_BEGIN */
  3351 | VAR_OUTPUT END_VAR
  3379 | VAR_OUTPUT END_VAR
  3352 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;}
  3380 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;}
  3353 | VAR_OUTPUT RETAIN END_VAR
  3381 | VAR_OUTPUT RETAIN END_VAR
  3354 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;}
  3382 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;}
  3355 | VAR_OUTPUT NON_RETAIN END_VAR
  3383 | VAR_OUTPUT NON_RETAIN END_VAR
  3356 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive output variable(s) declaration."); yynerrs++;}
  3384 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive output variable(s) declaration."); yynerrs++;}
  3357 | VAR_OUTPUT error var_init_decl_list END_VAR
  3385 | VAR_OUTPUT error var_output_init_decl_list END_VAR
  3358 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_OUPUT' in output variable(s) declaration."); yyerrok;}
  3386 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_OUPUT' in output variable(s) declaration."); yyerrok;}
  3359 | VAR_OUTPUT RETAIN error var_init_decl_list END_VAR
  3387 | VAR_OUTPUT RETAIN error var_output_init_decl_list END_VAR
  3360 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive output variable(s) declaration."); yyerrok;}
  3388 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive output variable(s) declaration."); yyerrok;}
  3361 | VAR_OUTPUT NON_RETAIN error var_init_decl_list END_VAR
  3389 | VAR_OUTPUT NON_RETAIN error var_output_init_decl_list END_VAR
  3362 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive output variable(s) declaration."); yyerrok;}
  3390 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive output variable(s) declaration."); yyerrok;}
  3363 | VAR_OUTPUT var_init_decl_list error END_OF_INPUT
  3391 | VAR_OUTPUT var_output_init_decl_list error END_OF_INPUT
  3364 	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed output variable(s) declaration."); yyerrok;}
  3392 	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed output variable(s) declaration."); yyerrok;}
  3365 | VAR_OUTPUT RETAIN var_init_decl_list error END_OF_INPUT
  3393 | VAR_OUTPUT RETAIN var_output_init_decl_list error END_OF_INPUT
  3366 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive output variable(s) declaration."); yyerrok;}
  3394 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive output variable(s) declaration."); yyerrok;}
  3367 | VAR_OUTPUT NON_RETAIN var_init_decl_list error END_OF_INPUT
  3395 | VAR_OUTPUT NON_RETAIN var_output_init_decl_list error END_OF_INPUT
  3368 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive output variable(s) declaration."); yyerrok;}
  3396 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive output variable(s) declaration."); yyerrok;}
  3369 | VAR_OUTPUT error END_VAR
  3397 | VAR_OUTPUT error END_VAR
  3370 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in output variable(s) declaration."); yyerrok;}
  3398 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in output variable(s) declaration."); yyerrok;}
  3371 | VAR_OUTPUT RETAIN error END_VAR
  3399 | VAR_OUTPUT RETAIN error END_VAR
  3372 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive output variable(s) declaration."); yyerrok;}
  3400 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive output variable(s) declaration."); yyerrok;}
  3373 | VAR_OUTPUT NON_RETAIN error END_VAR
  3401 | VAR_OUTPUT NON_RETAIN error END_VAR
  3374 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive output variable(s) declaration."); yyerrok;}
  3402 	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive output variable(s) declaration."); yyerrok;}
  3375 /* ERROR_CHECK_END */
  3403 /* ERROR_CHECK_END */
  3376 ;
  3404 ;
  3377 
  3405 
       
  3406 var_output_init_decl:
       
  3407   var_init_decl
       
  3408 | eno_param_declaration
       
  3409 ;
       
  3410 
       
  3411 var_output_init_decl_list:
       
  3412   var_output_init_decl ';'
       
  3413 	{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}
       
  3414 | var_output_init_decl_list var_output_init_decl ';'
       
  3415 	{$$ = $1; $$->add_element($2);}
       
  3416 /* ERROR_CHECK_BEGIN */
       
  3417 | var_output_init_decl_list var_output_init_decl error
       
  3418 	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;}
       
  3419 | var_output_init_decl_list error ';'
       
  3420 	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;}
       
  3421 /* ERROR_CHECK_END */
       
  3422 ;
       
  3423 
       
  3424 eno_param_declaration:
       
  3425   eno_param ':' BOOL
       
  3426   {$$ = new eno_param_declaration_c(locloc(@$));}
       
  3427 /* ERROR_CHECK_BEGIN */
       
  3428 | en_param BOOL
       
  3429 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN0 declaration."); yynerrs++;}
       
  3430 | en_param ':' error
       
  3431 	{$$ = NULL;
       
  3432 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in ENO declaration.");}
       
  3433 	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in ENO declaration."); yyclearin;}
       
  3434 	 yyerrok;
       
  3435 	}
       
  3436 /* ERROR_CHECK_END */
       
  3437 ;
  3378 
  3438 
  3379 
  3439 
  3380 input_output_declarations:
  3440 input_output_declarations:
  3381   VAR_IN_OUT var_declaration_list END_VAR
  3441   VAR_IN_OUT var_declaration_list END_VAR
  3382 	{$$ = new input_output_declarations_c($2, locloc(@$));}
  3442 	{$$ = new input_output_declarations_c($2, locloc(@$));}
  4061 
  4121 
  4062 
  4122 
  4063 
  4123 
  4064 /* intermediate helper symbol for:
  4124 /* intermediate helper symbol for:
  4065  *  - non_retentive_var_decls
  4125  *  - non_retentive_var_decls
  4066  *  - output_declarations
       
  4067  *  - var_declarations
  4126  *  - var_declarations
  4068  */
  4127  */
  4069 var_init_decl_list:
  4128 var_init_decl_list:
  4070   var_init_decl ';'
  4129   var_init_decl ';'
  4071 	{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}
  4130 	{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}