Ignore:
Timestamp:
Mar 2, 2020, 4:59:27 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dfa4360
Parents:
37cdd97
Message:

First draft implementation of generators, still missing error checking, testing and clean-up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r37cdd97 r427854b  
    12611261                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
    12621262        | SUSPEND ';'
    1263                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1263                { $$ = new StatementNode( build_suspend( nullptr ) ); }
    12641264        | SUSPEND compound_statement ';'
    1265                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1265                { $$ = new StatementNode( build_suspend( $2 ) ); }
    12661266        | SUSPEND COROUTINE ';'
    1267                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1267                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Coroutine ) ); }
    12681268        | SUSPEND COROUTINE compound_statement
    1269                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1269                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Coroutine ) ); }
    12701270        | SUSPEND GENERATOR ';'
    1271                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1271                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Generator ) ); }
    12721272        | SUSPEND GENERATOR compound_statement
    1273                 { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1273                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Generator ) ); }
    12741274        | THROW assignment_expression_opt ';'                           // handles rethrow
    12751275                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    20862086aggregate_control:                                                                              // CFA
    20872087        GENERATOR
    2088                 { SemanticError( yylloc, "generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
     2088                { yyy = true; $$ = AggregateDecl::Generator; }
    20892089        | MONITOR GENERATOR
    20902090                { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
Note: See TracChangeset for help on using the changeset viewer.