- Timestamp:
- May 23, 2020, 9:38:03 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 089ee6b
- Parents:
- f4530d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rf4530d7 rcbbd8fd7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Apr 27 12:25:42202013 // Update Count : 44 8312 // Last Modified On : Sat May 23 09:22:36 2020 13 // Update Count : 4499 14 14 // 15 15 … … 329 329 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 330 330 %type<en> comma_expression comma_expression_opt 331 %type<en> argument_expression_list argument_expression default_initialize_opt331 %type<en> argument_expression_list_opt argument_expression default_initialize_opt 332 332 %type<ifctl> if_control_expression 333 333 %type<fctl> for_control_expression for_control_expression_list … … 624 624 // equivalent to the old x[i,j]. 625 625 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $3 ) ); } 626 | postfix_expression '{' argument_expression_list '}' // CFA, constructor call626 | postfix_expression '{' argument_expression_list_opt '}' // CFA, constructor call 627 627 { 628 628 Token fn; … … 630 630 $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) ); 631 631 } 632 | postfix_expression '(' argument_expression_list ')'632 | postfix_expression '(' argument_expression_list_opt ')' 633 633 { $$ = new ExpressionNode( build_func( $1, $3 ) ); } 634 634 | postfix_expression '`' identifier // CFA, postfix call … … 662 662 | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal 663 663 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); } 664 | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call664 | '^' primary_expression '{' argument_expression_list_opt '}' // CFA, destructor call 665 665 { 666 666 Token fn; … … 670 670 ; 671 671 672 argument_expression_list :672 argument_expression_list_opt: 673 673 // empty 674 674 { $$ = nullptr; } 675 675 | argument_expression 676 | argument_expression_list ',' argument_expression676 | argument_expression_list_opt ',' argument_expression 677 677 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 678 678 ; … … 1196 1196 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1197 1197 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1198 | '=' comma_expression 1198 | '=' comma_expression // CFA 1199 1199 { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1200 1200 OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 1203 1203 | comma_expression inclexcl comma_expression '~' comma_expression // CFA 1204 1204 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } 1205 | comma_expression ';' // CFA 1206 { $$ = forCtrl( new ExpressionNode( build_constantInteger( *new string( "0u" ) ) ), $1, nullptr, OperKinds::LThan, nullptr, nullptr ); } 1205 1207 | comma_expression ';' comma_expression // CFA 1206 1208 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1207 1209 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1208 | comma_expression ';' '=' comma_expression 1210 | comma_expression ';' '=' comma_expression // CFA 1209 1211 { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1210 1212 OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 1304 1306 // If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so change syntax to "with mutex". 1305 1307 mutex_statement: 1306 MUTEX '(' argument_expression_list ')' statement1308 MUTEX '(' argument_expression_list_opt ')' statement 1307 1309 { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; } 1308 1310 ; … … 1321 1323 WAITFOR '(' cast_expression ')' 1322 1324 { $$ = $3; } 1323 // | WAITFOR '(' cast_expression ',' argument_expression_list ')'1325 // | WAITFOR '(' cast_expression ',' argument_expression_list_opt ')' 1324 1326 // { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1325 | WAITFOR '(' cast_expression_list ':' argument_expression_list ')'1327 | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')' 1326 1328 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1327 1329 ; … … 2095 2097 2096 2098 aggregate_control: // CFA 2097 GENERATOR 2099 MONITOR 2100 { yyy = true; $$ = AggregateDecl::Monitor; } 2101 | MUTEX STRUCT 2102 { yyy = true; $$ = AggregateDecl::Monitor; } 2103 | GENERATOR 2098 2104 { yyy = true; $$ = AggregateDecl::Generator; } 2099 | M ONITORGENERATOR2105 | MUTEX GENERATOR 2100 2106 { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2101 2107 | COROUTINE 2102 2108 { yyy = true; $$ = AggregateDecl::Coroutine; } 2103 | MONITOR 2104 { yyy = true; $$ = AggregateDecl::Monitor; } 2105 | MONITOR COROUTINE 2109 | MUTEX COROUTINE 2106 2110 { SemanticError( yylloc, "monitor coroutine is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2107 2111 | THREAD 2108 2112 { yyy = true; $$ = AggregateDecl::Thread; } 2109 | M ONITORTHREAD2113 | MUTEX THREAD 2110 2114 { SemanticError( yylloc, "monitor thread is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2111 2115 ; … … 2774 2778 | attr_name 2775 2779 { $$ = DeclarationNode::newAttribute( $1 ); } 2776 | attr_name '(' argument_expression_list ')'2780 | attr_name '(' argument_expression_list_opt ')' 2777 2781 { $$ = DeclarationNode::newAttribute( $1, $3 ); } 2778 2782 ;
Note: See TracChangeset
for help on using the changeset viewer.