Changeset ff489bf for src/Parser


Ignore:
Timestamp:
Mar 10, 2020, 10:49:25 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dfda49f
Parents:
9867cdb (diff), 6565321 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Parser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r9867cdb rff489bf  
    428428Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    429429Statement * build_directive( std::string * directive );
     430SuspendStmt * build_suspend( StatementNode *, SuspendStmt::Type = SuspendStmt::None);
    430431WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when );
    431432WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing );
  • src/Parser/StatementNode.cc

    r9867cdb rff489bf  
    249249} // build_finally
    250250
     251SuspendStmt * 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
    251266WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) {
    252267        auto node = new WaitForStmt();
  • src/Parser/TypeData.cc

    r9867cdb rff489bf  
    769769          case AggregateDecl::Struct:
    770770          case AggregateDecl::Coroutine:
     771          case AggregateDecl::Generator:
    771772          case AggregateDecl::Monitor:
    772773          case AggregateDecl::Thread:
  • src/Parser/lex.ll

    r9867cdb rff489bf  
    6565#define FLOATXX(v) KEYWORD_RETURN(v);
    6666#else
    67 #define FLOATXX(v) IDENTIFIER_RETURN(); 
     67#define FLOATXX(v) IDENTIFIER_RETURN();
    6868#endif // HAVE_KEYWORDS_FLOATXX
    6969
     
    301301_Static_assert  { KEYWORD_RETURN(STATICASSERT); }               // C11
    302302struct                  { KEYWORD_RETURN(STRUCT); }
    303         /* suspend                      { KEYWORD_RETURN(SUSPEND); }                    // CFA */
     303suspend                 { KEYWORD_RETURN(SUSPEND); }                    // CFA
    304304switch                  { KEYWORD_RETURN(SWITCH); }
    305305thread                  { KEYWORD_RETURN(THREAD); }                             // C11
  • src/Parser/parser.yy

    r9867cdb rff489bf  
    278278%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
    279279%token SIZEOF OFFSETOF
    280 // %token SUSPEND RESUME                                                                        // CFA
     280// %token RESUME                                                                        // CFA
     281%token SUSPEND                                                                  // CFA
    281282%token ATTRIBUTE EXTENSION                                                              // GCC
    282283%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
     
    12651266        | RETURN '{' initializer_list_opt comma_opt '}' ';'
    12661267                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
    1267         // | SUSPEND ';'
    1268         //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
    1269         // | SUSPEND compound_statement ';'
    1270         //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1268        | SUSPEND ';'
     1269                { $$ = new StatementNode( build_suspend( nullptr ) ); }
     1270        | SUSPEND compound_statement
     1271                { $$ = new StatementNode( build_suspend( $2 ) ); }
     1272        | SUSPEND COROUTINE ';'
     1273                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Coroutine ) ); }
     1274        | SUSPEND COROUTINE compound_statement
     1275                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Coroutine ) ); }
     1276        | SUSPEND GENERATOR ';'
     1277                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Generator ) ); }
     1278        | SUSPEND GENERATOR compound_statement
     1279                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Generator ) ); }
    12711280        | THROW assignment_expression_opt ';'                           // handles rethrow
    12721281                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    20832092aggregate_control:                                                                              // CFA
    20842093        GENERATOR
    2085                 { SemanticError( yylloc, "generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
     2094                { yyy = true; $$ = AggregateDecl::Generator; }
    20862095        | MONITOR GENERATOR
    20872096                { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
Note: See TracChangeset for help on using the changeset viewer.