Changeset 6a490b2 for src/Parser
- Timestamp:
- May 11, 2020, 1:53:29 PM (6 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, stuck-waitfor-destruct
- Children:
- 504a7dc
- Parents:
- b7d6a36 (diff), a7b486b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/Parser
- Files:
-
- 5 edited
-
ParseNode.h (modified) (1 diff)
-
StatementNode.cc (modified) (1 diff)
-
TypeData.cc (modified) (1 diff)
-
lex.ll (modified) (2 diffs)
-
parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
rb7d6a36 r6a490b2 428 428 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr ); 429 429 Statement * build_directive( std::string * directive ); 430 SuspendStmt * build_suspend( StatementNode *, SuspendStmt::Type = SuspendStmt::None); 430 431 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when ); 431 432 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing ); -
src/Parser/StatementNode.cc
rb7d6a36 r6a490b2 249 249 } // build_finally 250 250 251 SuspendStmt * build_suspend( StatementNode * then, SuspendStmt::Type type ) { 252 auto node = new SuspendStmt(); 253 254 node->type = type; 255 256 std::list< Statement * > stmts; 257 buildMoveList< Statement, StatementNode >( then, stmts ); 258 if(!stmts.empty()) { 259 assert( stmts.size() == 1 ); 260 node->then = dynamic_cast< CompoundStmt * >( stmts.front() ); 261 } 262 263 return node; 264 } 265 251 266 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) { 252 267 auto node = new WaitForStmt(); -
src/Parser/TypeData.cc
rb7d6a36 r6a490b2 769 769 case AggregateDecl::Struct: 770 770 case AggregateDecl::Coroutine: 771 case AggregateDecl::Generator: 771 772 case AggregateDecl::Monitor: 772 773 case AggregateDecl::Thread: -
src/Parser/lex.ll
rb7d6a36 r6a490b2 65 65 #define FLOATXX(v) KEYWORD_RETURN(v); 66 66 #else 67 #define FLOATXX(v) IDENTIFIER_RETURN(); 67 #define FLOATXX(v) IDENTIFIER_RETURN(); 68 68 #endif // HAVE_KEYWORDS_FLOATXX 69 69 … … 301 301 _Static_assert { KEYWORD_RETURN(STATICASSERT); } // C11 302 302 struct { KEYWORD_RETURN(STRUCT); } 303 /* suspend { KEYWORD_RETURN(SUSPEND); } // CFA */ 303 suspend { KEYWORD_RETURN(SUSPEND); } // CFA 304 304 switch { KEYWORD_RETURN(SWITCH); } 305 305 thread { KEYWORD_RETURN(THREAD); } // C11 -
src/Parser/parser.yy
rb7d6a36 r6a490b2 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 16 08:22:14202013 // Update Count : 44 6112 // Last Modified On : Mon Apr 27 12:25:42 2020 13 // Update Count : 4483 14 14 // 15 15 … … 278 278 %token OTYPE FTYPE DTYPE TTYPE TRAIT // CFA 279 279 %token SIZEOF OFFSETOF 280 // %token SUSPEND RESUME // CFA 280 // %token RESUME // CFA 281 %token SUSPEND // CFA 281 282 %token ATTRIBUTE EXTENSION // GCC 282 283 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN … … 918 919 conditional_expression 919 920 | unary_expression assignment_operator assignment_expression 920 { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); } 921 { 922 if ( $2 == OperKinds::AtAssn ) { 923 SemanticError( yylloc, "C @= assignment is currently unimplemented." ); $$ = nullptr; 924 } else { 925 $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); 926 } // if 927 } 921 928 | unary_expression '=' '{' initializer_list_opt comma_opt '}' 922 929 { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; } … … 959 966 960 967 tuple_expression_list: 961 assignment_expression_opt 962 | tuple_expression_list ',' assignment_expression_opt 968 assignment_expression 969 | '@' // CFA 970 { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; } 971 | tuple_expression_list ',' assignment_expression 963 972 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 973 | tuple_expression_list ',' '@' 974 { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; } 964 975 ; 965 976 … … 1259 1270 | RETURN '{' initializer_list_opt comma_opt '}' ';' 1260 1271 { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; } 1261 // | SUSPEND ';' 1262 // { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; } 1263 // | SUSPEND compound_statement ';' 1264 // { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; } 1272 | SUSPEND ';' 1273 { $$ = new StatementNode( build_suspend( nullptr ) ); } 1274 | SUSPEND compound_statement 1275 { $$ = new StatementNode( build_suspend( $2 ) ); } 1276 | SUSPEND COROUTINE ';' 1277 { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Coroutine ) ); } 1278 | SUSPEND COROUTINE compound_statement 1279 { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Coroutine ) ); } 1280 | SUSPEND GENERATOR ';' 1281 { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Generator ) ); } 1282 | SUSPEND GENERATOR compound_statement 1283 { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Generator ) ); } 1265 1284 | THROW assignment_expression_opt ';' // handles rethrow 1266 1285 { $$ = new StatementNode( build_throw( $2 ) ); } … … 1589 1608 // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be 1590 1609 // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name. 1591 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1610 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt 1592 1611 // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator). 1593 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ) ; }1594 | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1595 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ) ; }1612 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); } 1613 | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt 1614 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); } 1596 1615 ; 1597 1616 … … 2077 2096 aggregate_control: // CFA 2078 2097 GENERATOR 2079 { yyy = true; $$ = AggregateDecl::Coroutine; } 2098 { yyy = true; $$ = AggregateDecl::Generator; } 2099 | MONITOR GENERATOR 2100 { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2080 2101 | COROUTINE 2081 2102 { yyy = true; $$ = AggregateDecl::Coroutine; } 2082 2103 | MONITOR 2083 2104 { yyy = true; $$ = AggregateDecl::Monitor; } 2105 | MONITOR COROUTINE 2106 { SemanticError( yylloc, "monitor coroutine is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2084 2107 | THREAD 2085 2108 { yyy = true; $$ = AggregateDecl::Thread; } 2109 | MONITOR THREAD 2110 { SemanticError( yylloc, "monitor thread is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; } 2086 2111 ; 2087 2112
Note:
See TracChangeset
for help on using the changeset viewer.