275 %type <leaf> prev_declared_program_type_name |
277 %type <leaf> prev_declared_program_type_name |
276 |
278 |
277 |
279 |
278 |
280 |
279 |
281 |
|
282 /**********************************************************************************/ |
|
283 /* B XXX - Things that are missing from the standard, but should have been there! */ |
|
284 /**********************************************************************************/ |
|
285 |
|
286 |
280 /* The pragmas... */ |
287 /* The pragmas... */ |
281 %token <ID> pragma_token |
288 %token <ID> pragma_token |
282 %type <leaf> pragma |
289 %type <leaf> pragma |
283 |
290 |
284 |
291 |
285 /* Where do these tokens belong ?? */ |
292 /* Where do these tokens belong?? They are missing from the standard! */ |
286 /* TODO: get the syntax parser to handle these tokens... */ |
293 /* NOTE: There are other tokens related to these 'EN' ENO', that are also |
|
294 * missing from the standard. However, their location in the annex B is |
|
295 * relatively obvious, so they have been inserted in what seems to us their |
|
296 * correct place in order to ease understanding of the parser... |
|
297 */ |
287 %token EN |
298 %token EN |
288 %token ENO |
299 %token ENO |
289 %type <leaf> en_param |
300 %type <leaf> en_identifier |
290 %type <leaf> eno_param |
301 %type <leaf> eno_identifier |
|
302 |
291 |
303 |
292 |
304 |
293 |
305 |
294 /***************************/ |
306 /***************************/ |
295 /* B 0 - Programming Model */ |
307 /* B 0 - Programming Model */ |
667 %type <leaf> input_declarations |
679 %type <leaf> input_declarations |
668 /* helper symbol for input_declarations */ |
680 /* helper symbol for input_declarations */ |
669 %type <list> input_declaration_list |
681 %type <list> input_declaration_list |
670 %type <leaf> input_declaration |
682 %type <leaf> input_declaration |
671 %type <leaf> edge_declaration |
683 %type <leaf> edge_declaration |
|
684 /* en_param_declaration is not in the standard, but should be! */ |
672 %type <leaf> en_param_declaration |
685 %type <leaf> en_param_declaration |
673 %type <leaf> var_init_decl |
686 %type <leaf> var_init_decl |
674 %type <leaf> var1_init_decl |
687 %type <leaf> var1_init_decl |
675 %type <list> var1_list |
688 %type <list> var1_list |
676 %type <leaf> array_var_init_decl |
689 %type <leaf> array_var_init_decl |
683 // %type <list> fb_name_list |
696 // %type <list> fb_name_list |
684 // %type <leaf> fb_name |
697 // %type <leaf> fb_name |
685 %type <leaf> output_declarations |
698 %type <leaf> output_declarations |
686 %type <leaf> var_output_init_decl |
699 %type <leaf> var_output_init_decl |
687 %type <list> var_output_init_decl_list |
700 %type <list> var_output_init_decl_list |
|
701 /* eno_param_declaration is not in the standard, but should be! */ |
688 %type <leaf> eno_param_declaration |
702 %type <leaf> eno_param_declaration |
689 %type <leaf> input_output_declarations |
703 %type <leaf> input_output_declarations |
690 /* helper symbol for input_output_declarations */ |
704 /* helper symbol for input_output_declarations */ |
691 %type <list> var_declaration_list |
705 %type <list> var_declaration_list |
692 %type <leaf> var_declaration |
706 %type <leaf> var_declaration |
1319 /********************************************************/ |
1333 /********************************************************/ |
1320 /********************************************************/ |
1334 /********************************************************/ |
1321 /********************************************************/ |
1335 /********************************************************/ |
1322 |
1336 |
1323 |
1337 |
1324 |
|
1325 |
|
1326 |
|
1327 /*****************************/ |
|
1328 /* Prelimenary constructs... */ |
|
1329 /*****************************/ |
|
1330 start: |
1338 start: |
1331 library {$$ = $1;} |
1339 library {$$ = $1;} |
1332 ; |
1340 ; |
|
1341 |
|
1342 |
|
1343 /**********************************************************************************/ |
|
1344 /* B XXX - Things that are missing from the standard, but should have been there! */ |
|
1345 /**********************************************************************************/ |
|
1346 |
1333 |
1347 |
1334 /* the pragmas... */ |
1348 /* the pragmas... */ |
1335 pragma: |
1349 pragma: |
1336 pragma_token {$$ = new pragma_c($1, locloc(@$));} |
1350 pragma_token {$$ = new pragma_c($1, locloc(@$));} |
1337 |
1351 |
|
1352 |
1338 /* EN/ENO */ |
1353 /* EN/ENO */ |
1339 en_param: |
1354 /* Tese tokens are essentially used as variable names, so we handle them |
1340 EN {$$ = new en_param_c(locloc(@$));} |
1355 * similarly to these... |
1341 ; |
1356 */ |
1342 |
1357 en_identifier: |
1343 eno_param: |
1358 EN {$$ = new identifier_c("EN", locloc(@$));} |
1344 ENO {$$ = new eno_param_c(locloc(@$));} |
1359 ; |
1345 ; |
1360 |
1346 |
1361 eno_identifier: |
1347 |
1362 ENO {$$ = new identifier_c("ENO", locloc(@$));} |
|
1363 ; |
|
1364 |
|
1365 |
|
1366 |
|
1367 /*************************************/ |
|
1368 /* Prelimenary helpful constructs... */ |
|
1369 /*************************************/ |
1348 |
1370 |
1349 /* NOTE: |
1371 /* NOTE: |
1350 * short version: |
1372 * short version: |
1351 * identifier is used for previously undeclared identifiers |
1373 * identifier is used for previously undeclared identifiers |
1352 * any_identifier is used when any identifier, previously |
1374 * any_identifier is used when any identifier, previously |
2995 |
3017 |
2996 |
3018 |
2997 /*********************/ |
3019 /*********************/ |
2998 /* B 1.4 - Variables */ |
3020 /* B 1.4 - Variables */ |
2999 /*********************/ |
3021 /*********************/ |
|
3022 /* NOTE: The standard is erroneous in it's definition of 'variable' because: |
|
3023 * - The standard considers 'ENO' as a keyword... |
|
3024 * - ...which means that it may never be parsed as an 'identifier'... |
|
3025 * - ...and therefore may never be used as the name of a variable inside an expression. |
|
3026 * - However, a function/FB must be able to assign the ENO parameter |
|
3027 * it's value, doing it in an assignment statement, and therefore using the 'ENO' |
|
3028 * character sequence as an identifier! |
|
3029 * The solution we found was to also allow the ENO keyword to be |
|
3030 * used as the name of a variable. Note that this variable may be used |
|
3031 * even though it is not explicitly declared as a function/FB variable, |
|
3032 * as the standard requires us to define it implicitly in this case! |
|
3033 * We could not therefore handle the ENO as a normal variable that would |
|
3034 * go into the previously_declared_variable symbol table, as we may need to |
|
3035 * allow it to be used as a variable even though it is not declared as such! |
|
3036 */ |
3000 variable: |
3037 variable: |
3001 symbolic_variable |
3038 symbolic_variable |
3002 | prev_declared_direct_variable |
3039 | prev_declared_direct_variable |
3003 | eno_param |
3040 | eno_identifier |
|
3041 {$$ = new symbolic_variable_c($1, locloc(@$));} |
3004 ; |
3042 ; |
3005 |
3043 |
3006 |
3044 |
3007 symbolic_variable: |
3045 symbolic_variable: |
3008 /* NOTE: To be entirely correct, variable_name must be replacemed by |
3046 /* NOTE: To be entirely correct, variable_name must be replacemed by |
3138 /******************************************/ |
3176 /******************************************/ |
3139 /* B 1.4.3 - Declaration & Initialisation */ |
3177 /* B 1.4.3 - Declaration & Initialisation */ |
3140 /******************************************/ |
3178 /******************************************/ |
3141 input_declarations: |
3179 input_declarations: |
3142 VAR_INPUT input_declaration_list END_VAR |
3180 VAR_INPUT input_declaration_list END_VAR |
3143 {$$ = new input_declarations_c(NULL, $2, locloc(@$));} |
3181 {$$ = new input_declarations_c(NULL, $2, new explicit_definition_c(), locloc(@$));} |
3144 | VAR_INPUT RETAIN input_declaration_list END_VAR |
3182 | VAR_INPUT RETAIN input_declaration_list END_VAR |
3145 {$$ = new input_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
3183 {$$ = new input_declarations_c(new retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
3146 | VAR_INPUT NON_RETAIN input_declaration_list END_VAR |
3184 | VAR_INPUT NON_RETAIN input_declaration_list END_VAR |
3147 {$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
3185 {$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
3148 /* ERROR_CHECK_BEGIN */ |
3186 /* ERROR_CHECK_BEGIN */ |
3149 | VAR_INPUT END_VAR |
3187 | VAR_INPUT END_VAR |
3150 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in input variable(s) declaration."); yynerrs++;} |
3188 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in input variable(s) declaration."); yynerrs++;} |
3151 | VAR_INPUT RETAIN END_VAR |
3189 | VAR_INPUT RETAIN END_VAR |
3152 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive input variable(s) declaration."); yynerrs++;} |
3190 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive input variable(s) declaration."); yynerrs++;} |
3210 | var1_list BOOL R_EDGE |
3253 | var1_list BOOL R_EDGE |
3211 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
3254 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
3212 | var1_list BOOL F_EDGE |
3255 | var1_list BOOL F_EDGE |
3213 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
3256 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
3214 | var1_list ':' BOOL R_EDGE F_EDGE |
3257 | var1_list ':' BOOL R_EDGE F_EDGE |
3215 {$$ = 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++;} |
3258 {$$ = NULL; print_err_msg(locl(@5), locf(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;} |
|
3259 | var1_list ':' BOOL F_EDGE R_EDGE |
|
3260 {$$ = NULL; print_err_msg(locl(@5), locf(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;} |
3216 | var1_list ':' R_EDGE |
3261 | var1_list ':' R_EDGE |
3217 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
3262 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
3218 | var1_list ':' F_EDGE |
3263 | var1_list ':' F_EDGE |
3219 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
3264 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
3220 /* ERROR_CHECK_END */ |
3265 /* ERROR_CHECK_END */ |
3221 ; |
3266 ; |
3222 |
3267 |
|
3268 |
|
3269 /* NOTE: The formal definition of the standard is erroneous, as it simply does not |
|
3270 * consider the EN and ENO keywords! |
|
3271 * The semantic description of the languages clearly states that these may be |
|
3272 * used in several ways. One of them is to declare an EN input parameter. |
|
3273 * We have added the 'en_param_declaration' clause to cover for this. |
|
3274 */ |
3223 en_param_declaration: |
3275 en_param_declaration: |
3224 en_param ':' BOOL ASSIGN boolean_literal |
3276 en_identifier ':' BOOL ASSIGN boolean_literal |
3225 {$$ = new en_param_declaration_c(locloc(@$));} |
3277 {$$ = new en_param_declaration_c($1, new bool_type_name_c(locloc(@$)), $5, new explicit_definition_c(), locloc(@$));} |
3226 | en_param ':' BOOL ASSIGN integer |
3278 | en_identifier ':' BOOL ASSIGN integer |
3227 {$$ = new en_param_declaration_c(locloc(@$));} |
3279 {$$ = new en_param_declaration_c($1, new bool_type_name_c(locloc(@$)), $5, new explicit_definition_c(), locloc(@$));} |
3228 /* ERROR_CHECK_BEGIN */ |
3280 /* ERROR_CHECK_BEGIN */ |
3229 | en_param BOOL ASSIGN boolean_literal |
3281 | en_identifier BOOL ASSIGN boolean_literal |
3230 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
3282 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
3231 | en_param BOOL ASSIGN integer |
3283 | en_identifier BOOL ASSIGN integer |
3232 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
3284 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
3233 | en_param ':' ASSIGN boolean_literal |
3285 | en_identifier ':' ASSIGN boolean_literal |
3234 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
3286 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
3235 | en_param ':' ASSIGN integer |
3287 | en_identifier ':' ASSIGN integer |
3236 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
3288 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
3237 | en_param ':' BOOL ASSIGN error |
3289 | en_identifier ':' BOOL ASSIGN error |
3238 {$$ = NULL; |
3290 {$$ = NULL; |
3239 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in EN declaration.");} |
3291 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in EN declaration.");} |
3240 else {print_err_msg(locf(@3), locl(@3), "invalid specification in EN declaration."); yyclearin;} |
3292 else {print_err_msg(locf(@3), locl(@3), "invalid specification in EN declaration."); yyclearin;} |
3241 yyerrok; |
3293 yyerrok; |
3242 } |
3294 } |
3400 |
3452 |
3401 |
3453 |
3402 |
3454 |
3403 output_declarations: |
3455 output_declarations: |
3404 VAR_OUTPUT var_output_init_decl_list END_VAR |
3456 VAR_OUTPUT var_output_init_decl_list END_VAR |
3405 {$$ = new output_declarations_c(NULL, $2, locloc(@$));} |
3457 {$$ = new output_declarations_c(NULL, $2, new explicit_definition_c(), locloc(@$));} |
3406 | VAR_OUTPUT RETAIN var_output_init_decl_list END_VAR |
3458 | VAR_OUTPUT RETAIN var_output_init_decl_list END_VAR |
3407 {$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
3459 {$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
3408 | VAR_OUTPUT NON_RETAIN var_output_init_decl_list END_VAR |
3460 | VAR_OUTPUT NON_RETAIN var_output_init_decl_list END_VAR |
3409 {$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
3461 {$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
3410 /* ERROR_CHECK_BEGIN */ |
3462 /* ERROR_CHECK_BEGIN */ |
3411 | VAR_OUTPUT END_VAR |
3463 | VAR_OUTPUT END_VAR |
3412 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;} |
3464 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;} |
3413 | VAR_OUTPUT RETAIN END_VAR |
3465 | VAR_OUTPUT RETAIN END_VAR |
3414 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;} |
3466 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;} |
3451 | var_output_init_decl_list error ';' |
3509 | var_output_init_decl_list error ';' |
3452 {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
3510 {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
3453 /* ERROR_CHECK_END */ |
3511 /* ERROR_CHECK_END */ |
3454 ; |
3512 ; |
3455 |
3513 |
|
3514 |
|
3515 /* NOTE: The formal definition of the standard is erroneous, as it simply does not |
|
3516 * consider the EN and ENO keywords! |
|
3517 * The semantic description of the languages clearly states that these may be |
|
3518 * used in several ways. One of them is to declare an ENO output parameter. |
|
3519 * We have added the 'eno_param_declaration' clause to cover for this. |
|
3520 */ |
3456 eno_param_declaration: |
3521 eno_param_declaration: |
3457 eno_param ':' BOOL |
3522 eno_identifier ':' BOOL |
3458 {$$ = new eno_param_declaration_c(locloc(@$));} |
3523 /* NOTE We do _NOT_ include this variable in the previously_declared_variable symbol table! |
3459 /* ERROR_CHECK_BEGIN */ |
3524 * Please read the comment above the definition of 'variable' for the reason for this. |
3460 | en_param BOOL |
3525 */ |
3461 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN0 declaration."); yynerrs++;} |
3526 {$$ = new eno_param_declaration_c($1, new bool_type_name_c(locloc(@$)), new explicit_definition_c(), locloc(@$));} |
3462 | en_param ':' error |
3527 /* ERROR_CHECK_BEGIN */ |
|
3528 | en_identifier BOOL |
|
3529 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in ENO declaration."); yynerrs++;} |
|
3530 | en_identifier ':' error |
3463 {$$ = NULL; |
3531 {$$ = NULL; |
3464 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in ENO declaration.");} |
3532 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in ENO declaration.");} |
3465 else {print_err_msg(locf(@3), locl(@3), "invalid specification in ENO declaration."); yyclearin;} |
3533 else {print_err_msg(locf(@3), locl(@3), "invalid specification in ENO declaration."); yyclearin;} |
3466 yyerrok; |
3534 yyerrok; |
3467 } |
3535 } |
6521 il_assign_out_operator: |
6589 il_assign_out_operator: |
6522 /* variable_name SENDTO */ |
6590 /* variable_name SENDTO */ |
6523 /* any_identifier SENDTO */ |
6591 /* any_identifier SENDTO */ |
6524 sendto_identifier SENDTO |
6592 sendto_identifier SENDTO |
6525 {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
6593 {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
6526 | eno_param SENDTO |
6594 | eno_identifier SENDTO |
6527 {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
6595 {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
6528 /*| NOT variable_name SENDTO */ |
6596 /*| NOT variable_name SENDTO */ |
6529 | NOT sendto_identifier SENDTO |
6597 | NOT sendto_identifier SENDTO |
6530 {$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
6598 {$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
6531 | NOT eno_param SENDTO |
6599 | NOT eno_identifier SENDTO |
6532 {$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
6600 {$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
6533 /* ERROR_CHECK_BEGIN */ |
6601 /* ERROR_CHECK_BEGIN */ |
6534 | error SENDTO |
6602 | error SENDTO |
6535 {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;} |
6603 {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;} |
6536 | NOT SENDTO |
6604 | NOT SENDTO |
6862 * letting names clash! |
6930 * letting names clash! |
6863 */ |
6931 */ |
6864 function_invocation: |
6932 function_invocation: |
6865 /* function_name '(' [param_assignment_list] ')' */ |
6933 /* function_name '(' [param_assignment_list] ')' */ |
6866 function_name_no_NOT_clashes '(' param_assignment_formal_list ')' |
6934 function_name_no_NOT_clashes '(' param_assignment_formal_list ')' |
6867 {$$ = new function_invocation_c($1, $3, locloc(@$));} |
6935 {$$ = new function_invocation_c($1, $3, NULL, locloc(@$));} |
6868 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')' |
6936 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')' |
6869 {$$ = new function_invocation_c($1, $3, locloc(@$));} |
6937 {$$ = new function_invocation_c($1, NULL, $3, locloc(@$));} |
6870 /* ERROR_CHECK_BEGIN */ |
6938 /* ERROR_CHECK_BEGIN */ |
6871 | function_name_no_NOT_clashes param_assignment_formal_list ')' |
6939 | function_name_no_NOT_clashes param_assignment_formal_list ')' |
6872 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;} |
6940 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;} |
6873 | function_name_no_NOT_clashes '(' ')' |
6941 | function_name_no_NOT_clashes '(' ')' |
6874 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;} |
6942 {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;} |
6950 |
7018 |
6951 |
7019 |
6952 |
7020 |
6953 fb_invocation: |
7021 fb_invocation: |
6954 prev_declared_fb_name '(' ')' |
7022 prev_declared_fb_name '(' ')' |
6955 {$$ = new fb_invocation_c($1, NULL, locloc(@$)); } |
7023 {$$ = new fb_invocation_c($1, NULL, NULL, locloc(@$)); } |
6956 | prev_declared_fb_name '(' param_assignment_formal_list ')' |
7024 | prev_declared_fb_name '(' param_assignment_formal_list ')' |
6957 {$$ = new fb_invocation_c($1, $3, locloc(@$));} |
7025 {$$ = new fb_invocation_c($1, $3, NULL, locloc(@$));} |
6958 | prev_declared_fb_name '(' param_assignment_nonformal_list ')' |
7026 | prev_declared_fb_name '(' param_assignment_nonformal_list ')' |
6959 {$$ = new fb_invocation_c($1, $3, locloc(@$));} |
7027 {$$ = new fb_invocation_c($1, NULL, $3, locloc(@$));} |
6960 /* ERROR_CHECK_BEGIN */ |
7028 /* ERROR_CHECK_BEGIN */ |
6961 | prev_declared_fb_name ')' |
7029 | prev_declared_fb_name ')' |
6962 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
7030 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
6963 | prev_declared_fb_name param_assignment_formal_list ')' |
7031 | prev_declared_fb_name param_assignment_formal_list ')' |
6964 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
7032 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
7046 |
7114 |
7047 |
7115 |
7048 param_assignment_formal: |
7116 param_assignment_formal: |
7049 any_identifier ASSIGN expression |
7117 any_identifier ASSIGN expression |
7050 {$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
7118 {$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
7051 | en_param ASSIGN expression |
7119 | en_identifier ASSIGN expression |
7052 {$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
7120 {$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
7053 /*| variable_name SENDTO variable */ |
7121 /*| variable_name SENDTO variable */ |
7054 /*| any_identifier SENDTO variable */ |
7122 /*| any_identifier SENDTO variable */ |
7055 | sendto_identifier SENDTO variable |
7123 | sendto_identifier SENDTO variable |
7056 {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
7124 {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
7057 | eno_param SENDTO variable |
7125 | eno_identifier SENDTO variable |
7058 {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
7126 {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
7059 /*| NOT variable_name SENDTO variable */ |
7127 /*| NOT variable_name SENDTO variable */ |
7060 /*| NOT any_identifier SENDTO variable*/ |
7128 /*| NOT any_identifier SENDTO variable*/ |
7061 | NOT sendto_identifier SENDTO variable |
7129 | NOT sendto_identifier SENDTO variable |
7062 {$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
7130 {$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
7063 | NOT eno_param SENDTO variable |
7131 | NOT eno_identifier SENDTO variable |
7064 {$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
7132 {$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
7065 /* ERROR_CHECK_BEGIN */ |
7133 /* ERROR_CHECK_BEGIN */ |
7066 | any_identifier ASSIGN error |
7134 | any_identifier ASSIGN error |
7067 {$$ = NULL; |
7135 {$$ = NULL; |
7068 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
7136 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
7069 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
7137 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
7070 yyerrok; |
7138 yyerrok; |
7071 } |
7139 } |
7072 | en_param ASSIGN error |
7140 | en_identifier ASSIGN error |
7073 {$$ = NULL; |
7141 {$$ = NULL; |
7074 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
7142 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
7075 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
7143 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
7076 yyerrok; |
7144 yyerrok; |
7077 } |
7145 } |
7079 {$$ = NULL; |
7147 {$$ = NULL; |
7080 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
7148 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
7081 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
7149 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
7082 yyerrok; |
7150 yyerrok; |
7083 } |
7151 } |
7084 | eno_param SENDTO error |
7152 | eno_identifier SENDTO error |
7085 {$$ = NULL; |
7153 {$$ = NULL; |
7086 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
7154 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
7087 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
7155 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
7088 yyerrok; |
7156 yyerrok; |
7089 } |
7157 } |
7095 {$$ = NULL; |
7163 {$$ = NULL; |
7096 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
7164 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
7097 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
7165 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
7098 yyerrok; |
7166 yyerrok; |
7099 } |
7167 } |
7100 | NOT eno_param SENDTO error |
7168 | NOT eno_identifier SENDTO error |
7101 {$$ = NULL; |
7169 {$$ = NULL; |
7102 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
7170 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
7103 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
7171 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
7104 yyerrok; |
7172 yyerrok; |
7105 } |
7173 } |
7542 */ |
7615 */ |
7543 symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator) { |
7616 symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator) { |
7544 const char *name = NULL; |
7617 const char *name = NULL; |
7545 identifier_c *res; |
7618 identifier_c *res; |
7546 |
7619 |
7547 op_2_str(NOT, "NOT"); |
7620 op_2_str(NOT, "NOT"); |
7548 |
7621 |
7549 op_2_str(AND, "AND"); |
7622 op_2_str(AND, "AND"); |
7550 op_2_str(OR, "OR"); |
7623 op_2_str(OR, "OR"); |
7551 op_2_str(XOR, "XOR"); |
7624 op_2_str(XOR, "XOR"); |
7552 op_2_str(ADD, "ADD"); |
7625 op_2_str(ADD, "ADD"); |
7553 op_2_str(SUB, "SUB"); |
7626 op_2_str(SUB, "SUB"); |
7554 op_2_str(MUL, "MUL"); |
7627 op_2_str(MUL, "MUL"); |
7555 op_2_str(DIV, "DIV"); |
7628 op_2_str(DIV, "DIV"); |
7556 op_2_str(MOD, "MOD"); |
7629 op_2_str(MOD, "MOD"); |
7557 op_2_str(GT, "GT"); |
7630 op_2_str(GT, "GT"); |
7558 op_2_str(GE, "GE"); |
7631 op_2_str(GE, "GE"); |
7559 op_2_str(EQ, "EQ"); |
7632 op_2_str(EQ, "EQ"); |
7560 op_2_str(LT, "LT"); |
7633 op_2_str(LT, "LT"); |
7561 op_2_str(LE, "LE"); |
7634 op_2_str(LE, "LE"); |
7562 op_2_str(NE, "NE"); |
7635 op_2_str(NE, "NE"); |
7563 |
7636 |
7564 op_2_str(LD, "LD"); |
7637 op_2_str(LD, "LD"); |
7565 op_2_str(LDN, "LDN"); |
7638 op_2_str(LDN, "LDN"); |
7566 op_2_str(ST, "ST"); |
7639 op_2_str(ST, "ST"); |
7567 op_2_str(STN, "STN"); |
7640 op_2_str(STN, "STN"); |
7568 |
7641 |
7569 op_2_str(S, "S"); |
7642 op_2_str(S, "S"); |
7570 op_2_str(R, "R"); |
7643 op_2_str(R, "R"); |
7571 op_2_str(S1, "S1"); |
7644 op_2_str(S1, "S1"); |
7572 op_2_str(R1, "R1"); |
7645 op_2_str(R1, "R1"); |
7573 |
7646 |
7574 op_2_str(CLK, "CLK"); |
7647 op_2_str(CLK, "CLK"); |
7575 op_2_str(CU, "CU"); |
7648 op_2_str(CU, "CU"); |
7576 op_2_str(CD, "CD"); |
7649 op_2_str(CD, "CD"); |
7577 op_2_str(PV, "PV"); |
7650 op_2_str(PV, "PV"); |
7578 op_2_str(IN, "IN"); |
7651 op_2_str(IN, "IN"); |
7579 op_2_str(PT, "PT"); |
7652 op_2_str(PT, "PT"); |
7580 |
7653 |
7581 op_2_str(ANDN, "ANDN"); |
7654 op_2_str(ANDN, "ANDN"); |
7582 op_2_str(ORN, "ORN"); |
7655 op_2_str(ORN, "ORN"); |
7583 op_2_str(XORN, "XORN"); |
7656 op_2_str(XORN, "XORN"); |
7584 |
7657 |
7585 op_2_str(ADD, "ADD"); |
7658 op_2_str(ADD, "ADD"); |
7586 op_2_str(SUB, "SUB"); |
7659 op_2_str(SUB, "SUB"); |
7587 op_2_str(MUL, "MUL"); |
7660 op_2_str(MUL, "MUL"); |
7588 op_2_str(DIV, "DIV"); |
7661 op_2_str(DIV, "DIV"); |
7589 |
7662 |
7590 op_2_str(GT, "GT"); |
7663 op_2_str(GT, "GT"); |
7591 op_2_str(GE, "GE"); |
7664 op_2_str(GE, "GE"); |
7592 op_2_str(EQ, "EQ"); |
7665 op_2_str(EQ, "EQ"); |
7593 op_2_str(LT, "LT"); |
7666 op_2_str(LT, "LT"); |
7594 op_2_str(LE, "LE"); |
7667 op_2_str(LE, "LE"); |
7595 op_2_str(NE, "NE"); |
7668 op_2_str(NE, "NE"); |
7596 |
7669 |
7597 op_2_str(CAL, "CAL"); |
7670 op_2_str(CAL, "CAL"); |
7598 op_2_str(CALC, "CALC"); |
7671 op_2_str(CALC, "CALC"); |
7599 op_2_str(CALCN, "CALCN"); |
7672 op_2_str(CALCN, "CALCN"); |
7600 op_2_str(RET, "RET"); |
7673 op_2_str(RET, "RET"); |
7601 op_2_str(RETC, "RETC"); |
7674 op_2_str(RETC, "RETC"); |
7602 op_2_str(RETCN, "RETCN"); |
7675 op_2_str(RETCN, "RETCN"); |
7603 op_2_str(JMP, "JMP"); |
7676 op_2_str(JMP, "JMP"); |
7604 op_2_str(JMPC, "JMPC"); |
7677 op_2_str(JMPC, "JMPC"); |
7605 op_2_str(JMPCN, "JMPCN"); |
7678 op_2_str(JMPCN, "JMPCN"); |
7606 |
7679 |
7607 if (name == NULL) |
7680 if (name == NULL) |
7608 ERROR; |
7681 ERROR; |
7609 |
7682 |