stage1_2/iec.y
changeset 143 73372bdeeffb
parent 142 120772c527f3
child 146 eef5e62048c7
equal deleted inserted replaced
142:120772c527f3 143:73372bdeeffb
   270 
   270 
   271 /* Where do these tokens belong ?? */
   271 /* Where do these tokens belong ?? */
   272 /* TODO: get the syntax parser to handle these tokens... */
   272 /* TODO: get the syntax parser to handle these tokens... */
   273 %token	EN
   273 %token	EN
   274 %token	ENO
   274 %token	ENO
       
   275 %type <leaf>	en_param
       
   276 %type <leaf>	eno_param
   275 
   277 
   276 
   278 
   277 
   279 
   278 /***************************/
   280 /***************************/
   279 /* B 0 - Programming Model */
   281 /* B 0 - Programming Model */
  1303 
  1305 
  1304 /* the pragmas... */
  1306 /* the pragmas... */
  1305 pragma:
  1307 pragma:
  1306   pragma_token	{$$ = new pragma_c($1, locloc(@$));}
  1308   pragma_token	{$$ = new pragma_c($1, locloc(@$));}
  1307 
  1309 
       
  1310 /* EN/ENO */
       
  1311 en_param:
       
  1312   EN	{$$ = new en_param_c(locloc(@$));}
       
  1313 ;
       
  1314 
       
  1315 eno_param:
       
  1316   ENO	{$$ = new eno_param_c(locloc(@$));}
       
  1317 ;
       
  1318 
  1308 
  1319 
  1309 
  1320 
  1310 /* NOTE:
  1321 /* NOTE:
  1311  *       short version:
  1322  *       short version:
  1312  *       identifier is used for previously undeclared identifiers
  1323  *       identifier is used for previously undeclared identifiers
  6384 
  6395 
  6385 
  6396 
  6386 il_assign_operator:
  6397 il_assign_operator:
  6387 /*  variable_name ASSIGN */
  6398 /*  variable_name ASSIGN */
  6388   any_identifier ASSIGN
  6399   any_identifier ASSIGN
       
  6400 	{$$ = new il_assign_operator_c($1, locloc(@$));}
       
  6401 | en_param ASSIGN
       
  6402 	{$$ = new il_assign_operator_c($1, locloc(@$));}
  6389 /* ERROR_CHECK_BEGIN */
  6403 /* ERROR_CHECK_BEGIN */
  6390 | error ASSIGN
  6404 | error ASSIGN
  6391   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter assignment."); yyerrok;}
  6405   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter assignment."); yyerrok;}
  6392 /* ERROR_CHECK_END */
  6406 /* ERROR_CHECK_END */
  6393 ;
  6407 ;
  6396 il_assign_out_operator:
  6410 il_assign_out_operator:
  6397 /*  variable_name SENDTO */
  6411 /*  variable_name SENDTO */
  6398 /*  any_identifier SENDTO */
  6412 /*  any_identifier SENDTO */
  6399   sendto_identifier SENDTO
  6413   sendto_identifier SENDTO
  6400 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  6414 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
       
  6415 | eno_param SENDTO
       
  6416 	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
  6401 /*| NOT variable_name SENDTO */
  6417 /*| NOT variable_name SENDTO */
  6402 | NOT sendto_identifier SENDTO
  6418 | NOT sendto_identifier SENDTO
       
  6419 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
       
  6420 | NOT eno_param SENDTO
  6403 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
  6421 	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
  6404 /* ERROR_CHECK_BEGIN */
  6422 /* ERROR_CHECK_BEGIN */
  6405 | error SENDTO
  6423 | error SENDTO
  6406   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;}
  6424   {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;}
  6407 | NOT SENDTO
  6425 | NOT SENDTO
  6812 /*****************************************/
  6830 /*****************************************/
  6813 subprogram_control_statement:
  6831 subprogram_control_statement:
  6814   fb_invocation
  6832   fb_invocation
  6815 | return_statement
  6833 | return_statement
  6816 ;
  6834 ;
  6817 
       
  6818 
  6835 
  6819 return_statement:
  6836 return_statement:
  6820   RETURN	{$$ = new return_statement_c(locloc(@$));}
  6837   RETURN	{$$ = new return_statement_c(locloc(@$));}
  6821 ;
  6838 ;
  6822 
  6839 
  6918 
  6935 
  6919 
  6936 
  6920 param_assignment_formal:
  6937 param_assignment_formal:
  6921   any_identifier ASSIGN expression
  6938   any_identifier ASSIGN expression
  6922 	{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));}
  6939 	{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));}
       
  6940 | en_param ASSIGN expression
       
  6941 	{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));}
  6923 /*| variable_name SENDTO variable */
  6942 /*| variable_name SENDTO variable */
  6924 /*| any_identifier SENDTO variable */
  6943 /*| any_identifier SENDTO variable */
  6925 | sendto_identifier SENDTO variable
  6944 | sendto_identifier SENDTO variable
  6926 	{$$ = new output_variable_param_assignment_c(NULL,$1, $3, locloc(@$));}
  6945 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
       
  6946 | eno_param SENDTO variable
       
  6947 	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
  6927 /*| NOT variable_name SENDTO variable */
  6948 /*| NOT variable_name SENDTO variable */
  6928 /*| NOT any_identifier SENDTO variable*/
  6949 /*| NOT any_identifier SENDTO variable*/
  6929 | NOT sendto_identifier SENDTO variable
  6950 | NOT sendto_identifier SENDTO variable
  6930 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)),$2, $4, locloc(@$));}
  6951 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
       
  6952 | NOT eno_param SENDTO variable
       
  6953 	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
  6931 /* ERROR_CHECK_BEGIN */
  6954 /* ERROR_CHECK_BEGIN */
  6932 | any_identifier ASSIGN error
  6955 | any_identifier ASSIGN error
  6933   {$$ = NULL;
  6956   {$$ = NULL;
  6934 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
  6957 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
  6935 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
  6958 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
  6936 	 yyerrok;
  6959 	 yyerrok;
  6937 	}
  6960 	}
       
  6961 | en_param ASSIGN error
       
  6962   {$$ = NULL;
       
  6963 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
       
  6964 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
       
  6965 	 yyerrok;
       
  6966 	}
  6938 | sendto_identifier SENDTO error
  6967 | sendto_identifier SENDTO error
       
  6968   {$$ = NULL;
       
  6969 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
       
  6970 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
       
  6971 	 yyerrok;
       
  6972 	}
       
  6973 | eno_param SENDTO error
  6939   {$$ = NULL;
  6974   {$$ = NULL;
  6940 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  6975 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
  6941 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  6976 	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
  6942 	 yyerrok;
  6977 	 yyerrok;
  6943 	}
  6978 	}
  6944 | NOT SENDTO variable
  6979 | NOT SENDTO variable
  6945   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;}
  6980   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;}
  6946 | NOT error SENDTO variable
  6981 | NOT error SENDTO variable
  6947   {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;}
  6982   {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;}
  6948 | NOT sendto_identifier SENDTO error
  6983 | NOT sendto_identifier SENDTO error
       
  6984   {$$ = NULL;
       
  6985 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
       
  6986 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
       
  6987 	 yyerrok;
       
  6988 	}
       
  6989 | NOT eno_param SENDTO error
  6949   {$$ = NULL;
  6990   {$$ = NULL;
  6950 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  6991 	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
  6951 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  6992 	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
  6952 	 yyerrok;
  6993 	 yyerrok;
  6953 	}
  6994 	}