Changeset e16eb460 for src/Parser
- Timestamp:
- Oct 3, 2021, 5:19:12 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 8dcb832
- Parents:
- 96f01d7f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r96f01d7f re16eb460 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Sep 11 08:20:44202113 // Update Count : 50 4012 // Last Modified On : Sat Oct 2 08:27:21 2021 13 // Update Count : 5080 14 14 // 15 15 … … 31 31 // from ANSI90 to ANSI11 C are marked with the comment "C99/C11". 32 32 33 // This grammar also has two levels of extensions. The first extensions cover most of the GCC C extensions All of the33 // This grammar also has two levels of extensions. The first extensions cover most of the GCC C extensions. All of the 34 34 // syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall (CFA), which 35 35 // fixes several of C's outstanding problems and extends C with many modern language concepts. All of the syntactic … … 310 310 %token ATassign // @= 311 311 312 %type<tok> identifier 313 %type<tok> identifier_or_type_name attr_name 312 %type<tok> identifier identifier_at identifier_or_type_name attr_name 314 313 %type<tok> quasi_keyword 315 314 %type<constant> string_literal … … 327 326 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 328 327 %type<en> comma_expression comma_expression_opt 329 %type<en> argument_expression_list_opt argument_expression default_initializer_opt328 %type<en> argument_expression_list_opt argument_expression_list argument_expression default_initializer_opt 330 329 %type<ifctl> if_control_expression 331 330 %type<fctl> for_control_expression for_control_expression_list … … 559 558 IDENTIFIER 560 559 | quasi_keyword 560 ; 561 562 identifier_at: 563 identifier 561 564 | '@' // CFA 562 565 { Token tok = { new string( DeclarationNode::anonymous.newName() ), yylval.tok.loc }; $$ = tok; } … … 693 696 // empty 694 697 { $$ = nullptr; } 695 | argument_expression 698 | argument_expression_list 699 ; 700 701 argument_expression_list: 702 argument_expression 696 703 | argument_expression_list_opt ',' argument_expression 697 704 { $$ = (ExpressionNode *)($1->set_last( $3 )); } … … 731 738 | FLOATINGconstant fraction_constants_opt 732 739 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); } 733 | identifier fraction_constants_opt740 | identifier_at fraction_constants_opt // CFA, allow anonymous fields 734 741 { 735 742 $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); … … 1084 1091 comma_expression_opt ';' 1085 1092 { $$ = new StatementNode( build_expr( $1 ) ); } 1093 | MUTEX '@' comma_expression ';' 1094 // { $$ = new StatementNode( build_mutex( nullptr, new StatementNode( build_expr( $3 ) ) ) ); } 1095 { SemanticError( yylloc, "Mutex expression is currently unimplemented." ); $$ = nullptr; } 1086 1096 ; 1087 1097 … … 1339 1349 with_statement: 1340 1350 WITH '(' tuple_expression_list ')' statement 1341 { 1342 $$ = new StatementNode( build_with( $3, $5 ) ); 1343 } 1351 { $$ = new StatementNode( build_with( $3, $5 ) ); } 1344 1352 ; 1345 1353 1346 1354 // If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so change syntax to "with mutex". 1347 1355 mutex_statement: 1348 MUTEX '(' argument_expression_list _opt')' statement1356 MUTEX '(' argument_expression_list ')' statement 1349 1357 { $$ = new StatementNode( build_mutex( $3, $5 ) ); } 1350 1358 ; … … 2475 2483 designation: 2476 2484 designator_list ':' // C99, CFA uses ":" instead of "=" 2477 | identifier ':' // GCC, field name2485 | identifier_at ':' // GCC, field name 2478 2486 { $$ = new ExpressionNode( build_varref( $1 ) ); } 2479 2487 ; … … 2487 2495 2488 2496 designator: 2489 '.' identifier 2497 '.' identifier_at // C99, field name 2490 2498 { $$ = new ExpressionNode( build_varref( $2 ) ); } 2491 2499 | '[' push assignment_expression pop ']' // C99, single array element … … 2919 2927 2920 2928 paren_identifier: 2921 identifier 2929 identifier_at 2922 2930 { $$ = DeclarationNode::newName( $1 ); } 2923 2931 | '(' paren_identifier ')' // redundant parenthesis
Note: See TracChangeset
for help on using the changeset viewer.