Ignore:
Timestamp:
Nov 28, 2017, 3:52:06 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
383e159, 8d5b9cf
Parents:
cf966b5 (diff), 8a0a64d9 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rcf966b5 r6c2ba38  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 20 09:45:36 2017
    13 // Update Count     : 2945
     12// Last Modified On : Mon Nov 27 17:23:35 2017
     13// Update Count     : 2992
    1414//
    1515
     
    345345%type<en> type_list
    346346
    347 %type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list
     347%type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list
    348348%type<decl> type_specifier type_specifier_nobody
    349349
     
    379379//   `---'                                              matches start of TYPEGENname '('
    380380// Must be:
    381 // Foo( int ) ( *fp )( int );
     381//   Foo( int ) ( *fp )( int );
    382382
    383383// Order of these lines matters (low-to-high precedence).
     
    10581058with_statement:
    10591059        WITH '(' tuple_expression_list ')' statement
    1060                 { $$ = nullptr; }                                                               // FIX ME
     1060                { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; } // FIX ME
    10611061        ;
    10621062
     
    10641064mutex_statement:
    10651065        MUTEX '(' argument_expression_list ')' statement
    1066                 { $$ = nullptr; }                                                               // FIX ME
     1066                { throw SemanticError("Mutex statement is currently unimplemented."); $$ = nullptr; } // FIX ME
    10671067        ;
    10681068
     
    12801280        c_declaration pop ';'
    12811281        | cfa_declaration pop ';'                                                       // CFA
     1282        | STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11
     1283                { throw SemanticError("Static assert is currently unimplemented."); $$ = nullptr; }     // FIX ME
    12821284        ;
    12831285
     
    13621364                        $$ = $3->addQualifiers( $1 )->addQualifiers( $2 );
    13631365                }
    1364         | cfa_function_declaration pop ',' push identifier_or_type_name
    1365                 {
    1366                         typedefTable.addToEnclosingScope( *$5, TypedefTable::ID );
    1367                         $$ = $1->appendList( $1->cloneType( $5 ) );
     1366        | cfa_function_declaration pop ',' push identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1367                {
     1368                        // Append the return type at the start (left-hand-side) to each identifier in the list.
     1369                        DeclarationNode * ret = new DeclarationNode;
     1370                        ret->type = maybeClone( $1->type->base );
     1371                        $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr, true ) );
    13681372                }
    13691373        ;
     
    15871591        | ATOMIC
    15881592                { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }
    1589         | FORALL '('
     1593        | forall
     1594        ;
     1595
     1596forall:
     1597        FORALL '('
    15901598                {
    15911599                        typedefTable.enterScope();
     
    23742382                        $$ = $2;
    23752383                }
     2384        | forall '{' external_definition_list '}'                       // CFA, namespace
    23762385        ;
    23772386
     
    23992408with_clause_opt:
    24002409        // empty
    2401                 { $$ = nullptr; }                                                               // FIX ME
     2410                { $$ = nullptr; }
    24022411        | WITH '(' tuple_expression_list ')'
    2403                 { $$ = nullptr; }                                                               // FIX ME
     2412                { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; } // FIX ME
    24042413        ;
    24052414
     
    24092418                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24102419                        typedefTable.leaveScope();
    2411                         $$ = $1->addFunctionBody( $3 );
     2420                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
     2421                        //   [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; }
     2422                        $1->get_last()->addFunctionBody( $3 );
     2423                        $$ = $1;
    24122424                }
    24132425        | declaration_specifier function_declarator with_clause_opt compound_statement
     
    24182430                        $$ = $2->addFunctionBody( $4 )->addType( $1 );
    24192431                }
     2432                // handles default int return type, OBSOLESCENT (see 1)
    24202433        | type_qualifier_list function_declarator with_clause_opt compound_statement
    24212434                {
     
    24242437                        $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
    24252438                }
     2439                // handles default int return type, OBSOLESCENT (see 1)
    24262440        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    24272441                {
     
    24302444                        $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
    24312445                }
     2446                // handles default int return type, OBSOLESCENT (see 1)
    24322447        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    24332448                {
     
    24452460                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addType( $1 );
    24462461                }
     2462                // handles default int return type, OBSOLESCENT (see 1)
    24472463        | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24482464                {
     
    24512467                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 );
    24522468                }
    2453 
    2454                 // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4)
     2469                // handles default int return type, OBSOLESCENT (see 1)
    24552470        | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24562471                {
     
    24592474                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 );
    24602475                }
     2476                // handles default int return type, OBSOLESCENT (see 1)
    24612477        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24622478                {
Note: See TracChangeset for help on using the changeset viewer.