Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7fdb94e1 r1dbc8590  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 21 21:44:01 2018
    13 // Update Count     : 3350
     12// Last Modified On : Fri May 11 17:51:38 2018
     13// Update Count     : 3261
    1414//
    1515
     
    119119// Does the forall bind to the struct or the routine, and how would it be possible to explicitly specify the binding.
    120120//   forall( otype T ) struct S { int T; } forall( otype W ) bar( W ) {}
    121 // Currently, the forall is associated with the routine, and the generic type has to be separately defined:
    122 //   forall( otype T ) struct S { int T; };
    123 //   forall( otype W ) bar( W ) {}
    124121
    125122void rebindForall( DeclarationNode * declSpec, DeclarationNode * funcDecl ) {
    126         if ( declSpec->type->kind == TypeData::Aggregate ) { // ignore aggregate definition
     123        if ( declSpec->type->kind == TypeData::Aggregate ) { // return is aggregate definition
    127124                funcDecl->type->forall = declSpec->type->aggregate.params; // move forall from aggregate to function type
    128125                declSpec->type->aggregate.params = nullptr;
     
    304301%type<decl> exception_declaration external_definition external_definition_list external_definition_list_opt
    305302
    306 %type<decl> field_declaration field_declaration_list_opt field_declarator_opt field_declaring_list
     303%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    307304%type<en> field field_list field_name fraction_constants_opt
    308305
     
    364361
    365362// initializers
    366 %type<in>  initializer initializer_list_opt initializer_opt
     363%type<in>  initializer initializer_list initializer_opt
    367364
    368365// designators
     
    415412// actions during the parser update this data structure when the class of identifiers change.
    416413//
    417 // Because the Cforall language is block-scoped, an identifier can change its class in a local scope; it must revert to
    418 // its original class at the end of the block.  Since type names can be local to a particular declaration, each
    419 // declaration is itself a scope.  This requires distinguishing between type names that are local to the current
    420 // declaration scope and those that persist past the end of the declaration (i.e., names defined in "typedef" or "otype"
    421 // declarations).
    422 //
    423 // The non-terminals "push" and "pop" denote the opening and closing of scopes.  Every push must have a matching pop,
    424 // although it is regrettable the matching pairs do not always occur within the same rule.  These non-terminals may
    425 // appear in more contexts than strictly necessary from a semantic point of view.
     414// Because the Cforall language is block-scoped, there is the possibility that an identifier can change its class in a
     415// local scope; it must revert to its original class at the end of the block.  Since type names can be local to a
     416// particular declaration, each declaration is itself a scope.  This requires distinguishing between type names that are
     417// local to the current declaration scope and those that persist past the end of the declaration (i.e., names defined in
     418// "typedef" or "otype" declarations).
     419//
     420// The non-terminals "push" and "pop" derive the empty string; their only use is to denote the opening and closing of
     421// scopes.  Every push must have a matching pop, although it is regrettable the matching pairs do not always occur
     422// within the same rule.  These non-terminals may appear in more contexts than strictly necessary from a semantic point
     423// of view.  Unfortunately, these extra rules are necessary to prevent parsing conflicts -- the parser may not have
     424// enough context and look-ahead information to decide whether a new scope is necessary, so the effect of these extra
     425// rules is to open a new scope unconditionally.  As the grammar evolves, it may be neccesary to add or move around
     426// "push" and "pop" nonterminals to resolve conflicts of this sort.
    426427
    427428push:
     
    497498                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    498499        | type_name '.' no_attr_identifier                                      // CFA, nested type
    499                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    500         | type_name '.' '[' field_list ']'                                      // CFA, nested type / tuple field selector
    501                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     500                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     501//              { $$ = nullptr; }
     502        | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
     503                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     504//              { $$ = nullptr; }
    502505        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    503506                { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; }
     
    516519postfix_expression:
    517520        primary_expression
    518         | postfix_expression '[' assignment_expression ']'
     521        | postfix_expression '[' push assignment_expression pop ']'
    519522                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
    520523                // matrix with x[i,j] instead of x[i][j]. While this change is not backwards compatible, there seems to be
    521524                // little advantage to this feature and many disadvantages. It is possible to write x[(i,j)] in CFA, which is
    522525                // equivalent to the old x[i,j].
    523                 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $3 ) ); }
     526                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $4 ) ); }
    524527        | postfix_expression '{' argument_expression_list '}' // CFA, constructor call
    525528                {
     
    536539        | postfix_expression FLOATING_FRACTIONconstant          // CFA, tuple index
    537540                { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); }
    538         | postfix_expression '.' '[' field_list ']'                     // CFA, tuple field selector
    539                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
     541        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
     542                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    540543        | postfix_expression ARROW no_attr_identifier
    541544                {
     
    544547        | postfix_expression ARROW INTEGERconstant                      // CFA, tuple index
    545548                { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
    546         | postfix_expression ARROW '[' field_list ']'           // CFA, tuple field selector
    547                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $4 ) ) ); }
     549        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
     550                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    548551        | postfix_expression ICR
    549552                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
    550553        | postfix_expression DECR
    551554                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, $1 ) ); }
    552         | '(' type_no_function ')' '{' initializer_list_opt comma_opt '}' // C99, compound-literal
     555        | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal
    553556                { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); }
    554         | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
     557        | '(' type_no_function ')' '@' '{' initializer_list comma_opt '}' // CFA, explicit C compound-literal
    555558                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    556559        | '^' primary_expression '{' argument_expression_list '}' // CFA
     
    585588        | FLOATING_DECIMALconstant field
    586589                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); }
    587         | FLOATING_DECIMALconstant '[' field_list ']'
    588                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), build_tuple( $3 ) ) ); }
     590        | FLOATING_DECIMALconstant '[' push field_list pop ']'
     591                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), build_tuple( $4 ) ) ); }
    589592        | field_name '.' field
    590593                { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
    591         | field_name '.' '[' field_list ']'
    592                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
     594        | field_name '.' '[' push field_list pop ']'
     595                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    593596        | field_name ARROW field
    594597                { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
    595         | field_name ARROW '[' field_list ']'
    596                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $4 ) ) ); }
     598        | field_name ARROW '[' push field_list pop ']'
     599                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    597600        ;
    598601
     
    804807        | unary_expression assignment_operator assignment_expression
    805808                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
    806         | unary_expression '=' '{' initializer_list_opt comma_opt '}'
     809        | unary_expression '=' '{' initializer_list comma_opt '}'
    807810                { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; }
    808811        ;
     
    837840//      '[' push assignment_expression pop ']'
    838841//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    839         '[' ',' tuple_expression_list ']'
    840                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
    841         | '[' assignment_expression ',' tuple_expression_list ']'
    842                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$2->set_last( $4 ) ) ); }
     842        '[' push ',' tuple_expression_list pop ']'
     843                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $4 ) ) ); }
     844        | '[' push assignment_expression ',' tuple_expression_list pop ']'
     845                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $5 ) ) ); }
    843846        ;
    844847
     
    10711074        | RETURN comma_expression_opt ';'
    10721075                { $$ = new StatementNode( build_return( $2 ) ); }
    1073         | RETURN '{' initializer_list_opt comma_opt '}'
     1076        | RETURN '{' initializer_list comma_opt '}'
    10741077                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
    10751078        | THROW assignment_expression_opt ';'                           // handles rethrow
     
    11651168
    11661169handler_predicate_opt:
    1167         // empty
     1170        //empty
    11681171                { $$ = nullptr; }
    11691172        | ';' conditional_expression                            { $$ = $2; }
     
    11841187        | type_specifier_nobody declarator
    11851188                {
     1189                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    11861190                        $$ = $2->addType( $1 );
    11871191                }
     
    11901194        | cfa_abstract_declarator_tuple no_attr_identifier      // CFA
    11911195                {
     1196                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    11921197                        $$ = $1->addName( $2 );
    11931198                }
     
    13391344cfa_variable_declaration:                                                               // CFA
    13401345        cfa_variable_specifier initializer_opt
    1341                 { $$ = $1->addInitializer( $2 ); }
     1346                {
     1347                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1348                        $$ = $1->addInitializer( $2 );
     1349                }
    13421350        | declaration_qualifier_list cfa_variable_specifier initializer_opt
    13431351                // declaration_qualifier_list also includes type_qualifier_list, so a semantic check is necessary to preclude
    13441352                // them as a type_qualifier cannot appear in that context.
    1345                 { $$ = $2->addQualifiers( $1 )->addInitializer( $3 ); }
     1353                {
     1354                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1355                        $$ = $2->addQualifiers( $1 )->addInitializer( $3 );;
     1356                }
    13461357        | cfa_variable_declaration pop ',' push identifier_or_type_name initializer_opt
    1347                 { $$ = $1->appendList( $1->cloneType( $5 )->addInitializer( $6 ) ); }
     1358                {
     1359                        typedefTable.addToEnclosingScope( *$5, TypedefTable::ID );
     1360                        $$ = $1->appendList( $1->cloneType( $5 )->addInitializer( $6 ) );
     1361                }
    13481362        ;
    13491363
     
    13521366                // storage-class
    13531367        cfa_abstract_declarator_no_tuple identifier_or_type_name asm_name_opt
    1354                 { $$ = $1->addName( $2 )->addAsmName( $3 ); }
     1368                {
     1369                        typedefTable.setNextIdentifier( *$2 );
     1370                        $$ = $1->addName( $2 )->addAsmName( $3 );
     1371                }
    13551372        | cfa_abstract_tuple identifier_or_type_name asm_name_opt
    1356                 { $$ = $1->addName( $2 )->addAsmName( $3 ); }
     1373                {
     1374                        typedefTable.setNextIdentifier( *$2 );
     1375                        $$ = $1->addName( $2 )->addAsmName( $3 );
     1376                }
    13571377        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name asm_name_opt
    1358                 { $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 ); }
     1378                {
     1379                        typedefTable.setNextIdentifier( *$3 );
     1380                        $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 );
     1381                }
    13591382        ;
    13601383
    13611384cfa_function_declaration:                                                               // CFA
    13621385        cfa_function_specifier
    1363                 { $$ = $1; }
     1386                {
     1387                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1388                        $$ = $1;
     1389                }
    13641390        | type_qualifier_list cfa_function_specifier
    1365                 { $$ = $2->addQualifiers( $1 ); }
     1391                {
     1392                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1393                        $$ = $2->addQualifiers( $1 );
     1394                }
    13661395        | declaration_qualifier_list cfa_function_specifier
    1367                 { $$ = $2->addQualifiers( $1 ); }
     1396                {
     1397                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1398                        $$ = $2->addQualifiers( $1 );
     1399                }
    13681400        | declaration_qualifier_list type_qualifier_list cfa_function_specifier
    1369                 { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); }
    1370         | cfa_function_declaration ',' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1401                {
     1402                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1403                        $$ = $3->addQualifiers( $1 )->addQualifiers( $2 );
     1404                }
     1405        | cfa_function_declaration pop ',' push identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
    13711406                {
    13721407                        // Append the return type at the start (left-hand-side) to each identifier in the list.
    13731408                        DeclarationNode * ret = new DeclarationNode;
    13741409                        ret->type = maybeClone( $1->type->base );
    1375                         $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $5, nullptr ) );
     1410                        $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr ) );
    13761411                }
    13771412        ;
     
    14001435                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    14011436                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1402         cfa_abstract_tuple identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1437        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
    14031438                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1404                 { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
    1405         | cfa_function_return identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
    1406                 { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
     1439                {
     1440                        $$ = DeclarationNode::newFunction( $2, $1, $5, 0 );
     1441                }
     1442        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1443                {
     1444                        $$ = DeclarationNode::newFunction( $2, $1, $5, 0 );
     1445                }
    14071446        ;
    14081447
    14091448cfa_function_return:                                                                    // CFA
    1410         '[' cfa_parameter_list ']'
    1411                 { $$ = DeclarationNode::newTuple( $2 ); }
    1412         | '[' cfa_parameter_list ',' cfa_abstract_parameter_list ']'
     1449        '[' push cfa_parameter_list pop ']'
     1450                { $$ = DeclarationNode::newTuple( $3 ); }
     1451        | '[' push cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ']'
    14131452                // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the
    14141453                // ']'.
    1415                 { $$ = DeclarationNode::newTuple( $2->appendList( $4 ) ); }
     1454                { $$ = DeclarationNode::newTuple( $3->appendList( $7 ) ); }
    14161455        ;
    14171456
     
    14191458        TYPEDEF cfa_variable_specifier
    14201459                {
    1421                         typedefTable.addToEnclosingScope( *$2->name, TypedefTable::TD );
     1460                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14221461                        $$ = $2->addTypedef();
    14231462                }
    14241463        | TYPEDEF cfa_function_specifier
    14251464                {
    1426                         typedefTable.addToEnclosingScope( *$2->name, TypedefTable::TD );
     1465                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14271466                        $$ = $2->addTypedef();
    14281467                }
     
    14401479        TYPEDEF type_specifier declarator
    14411480                {
    1442                         typedefTable.addToEnclosingScope( *$3->name, TypedefTable::TD );
     1481                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14431482                        $$ = $3->addType( $2 )->addTypedef();
    14441483                }
    14451484        | typedef_declaration pop ',' push declarator
    14461485                {
    1447                         typedefTable.addToEnclosingScope( *$5->name, TypedefTable::TD );
     1486                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14481487                        $$ = $1->appendList( $1->cloneBaseType( $5 )->addTypedef() );
    14491488                }
    14501489        | type_qualifier_list TYPEDEF type_specifier declarator // remaining OBSOLESCENT (see 2 )
    14511490                {
    1452                         typedefTable.addToEnclosingScope( *$4->name, TypedefTable::TD );
     1491                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14531492                        $$ = $4->addType( $3 )->addQualifiers( $1 )->addTypedef();
    14541493                }
    14551494        | type_specifier TYPEDEF declarator
    14561495                {
    1457                         typedefTable.addToEnclosingScope( *$3->name, TypedefTable::TD );
     1496                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14581497                        $$ = $3->addType( $1 )->addTypedef();
    14591498                }
    14601499        | type_specifier TYPEDEF type_qualifier_list declarator
    14611500                {
    1462                         typedefTable.addToEnclosingScope( *$4->name, TypedefTable::TD );
     1501                        typedefTable.addToEnclosingScope( TypedefTable::TD );
    14631502                        $$ = $4->addQualifiers( $1 )->addTypedef()->addType( $1 );
    14641503                }
     
    14691508        TYPEDEF no_attr_identifier '=' assignment_expression
    14701509                {
    1471                         // $$ = DeclarationNode::newName( 0 );                  // unimplemented
    1472                         SemanticError( yylloc, "Typedef expression is currently unimplemented." ); $$ = nullptr;
     1510                        typedefTable.addToEnclosingScope( *$2, TypedefTable::TD );
     1511                        $$ = DeclarationNode::newName( 0 );                     // unimplemented
    14731512                }
    14741513        | typedef_expression pop ',' push no_attr_identifier '=' assignment_expression
    14751514                {
    1476                         // $$ = DeclarationNode::newName( 0 );                  // unimplemented
    1477                         SemanticError( yylloc, "Typedef expression is currently unimplemented." ); $$ = nullptr;
     1515                        typedefTable.addToEnclosingScope( *$5, TypedefTable::TD );
     1516                        $$ = DeclarationNode::newName( 0 );                     // unimplemented
    14781517                }
    14791518        ;
     
    15031542c_declaration:
    15041543        declaration_specifier declaring_list
    1505                 { $$ = distAttr( $1, $2 ); }
     1544                {
     1545                        $$ = distAttr( $1, $2 );
     1546                }
    15061547        | typedef_declaration
    15071548        | typedef_expression                                                            // GCC, naming expression type
     
    15131554                // storage-class
    15141555        declarator asm_name_opt initializer_opt
    1515                 { $$ = $1->addAsmName( $2 )->addInitializer( $3 ); }
     1556                {
     1557                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1558                        $$ = $1->addAsmName( $2 )->addInitializer( $3 );
     1559                }
    15161560        | declaring_list ',' attribute_list_opt declarator asm_name_opt initializer_opt
    1517                 { $$ = $1->appendList( $4->addQualifiers( $3 )->addAsmName( $5 )->addInitializer( $6 ) ); }
     1561                {
     1562                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     1563                        $$ = $1->appendList( $4->addQualifiers( $3 )->addAsmName( $5 )->addInitializer( $6 ) );
     1564                }
    15181565        ;
    15191566
     
    18071854
    18081855aggregate_type:                                                                                 // struct, union
    1809         aggregate_key attribute_list_opt '{' field_declaration_list_opt '}'
     1856        aggregate_key attribute_list_opt '{' field_declaration_list '}'
    18101857                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    18111858        | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
     
    18151862                        forall = false;                                                         // reset
    18161863                }
    1817           '{' field_declaration_list_opt '}'
     1864          '{' field_declaration_list '}'
    18181865                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
    1819         | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list_opt '}' // CFA
     1866        | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list '}' // CFA
    18201867                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); }
    18211868        | aggregate_type_nobody
     
    18621909        ;
    18631910
    1864 field_declaration_list_opt:
     1911field_declaration_list:
    18651912        // empty
    18661913                { $$ = nullptr; }
    1867         | field_declaration_list_opt field_declaration
     1914        | field_declaration_list field_declaration
    18681915                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    18691916        ;
     
    18981945
    18991946field_declaring_list:
    1900         field_declarator_opt
    1901         | field_declaring_list ',' attribute_list_opt field_declarator_opt
     1947        field_declarator
     1948        | field_declaring_list ',' attribute_list_opt field_declarator
    19021949                { $$ = $1->appendList( $4->addQualifiers( $3 ) ); }
    19031950        ;
    19041951
    1905 field_declarator_opt:
     1952field_declarator:
    19061953        // empty
    19071954                { $$ = DeclarationNode::newName( 0 ); /* XXX */ } // CFA, no field name
     
    19702017        | cfa_abstract_parameter_list
    19712018        | cfa_parameter_list
    1972         | cfa_parameter_list ',' cfa_abstract_parameter_list
    1973                 { $$ = $1->appendList( $3 ); }
    1974         | cfa_abstract_parameter_list ',' ELLIPSIS
     2019        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list
     2020                { $$ = $1->appendList( $5 ); }
     2021        | cfa_abstract_parameter_list pop ',' push ELLIPSIS
    19752022                { $$ = $1->addVarArgs(); }
    1976         | cfa_parameter_list ',' ELLIPSIS
     2023        | cfa_parameter_list pop ',' push ELLIPSIS
    19772024                { $$ = $1->addVarArgs(); }
    19782025        ;
     
    19822029                // factored out from cfa_parameter_list, flattening the rules to get lookahead to the ']'.
    19832030        cfa_parameter_declaration
    1984         | cfa_abstract_parameter_list ',' cfa_parameter_declaration
    1985                 { $$ = $1->appendList( $3 ); }
    1986         | cfa_parameter_list ',' cfa_parameter_declaration
    1987                 { $$ = $1->appendList( $3 ); }
    1988         | cfa_parameter_list ',' cfa_abstract_parameter_list ',' cfa_parameter_declaration
    1989                 { $$ = $1->appendList( $3 )->appendList( $5 ); }
     2031        | cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
     2032                { $$ = $1->appendList( $5 ); }
     2033        | cfa_parameter_list pop ',' push cfa_parameter_declaration
     2034                { $$ = $1->appendList( $5 ); }
     2035        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
     2036                { $$ = $1->appendList( $5 )->appendList( $9 ); }
    19902037        ;
    19912038
    19922039cfa_abstract_parameter_list:                                                    // CFA, new & old style abstract
    19932040        cfa_abstract_parameter_declaration
    1994         | cfa_abstract_parameter_list ',' cfa_abstract_parameter_declaration
    1995                 { $$ = $1->appendList( $3 ); }
     2041        | cfa_abstract_parameter_list pop ',' push cfa_abstract_parameter_declaration
     2042                { $$ = $1->appendList( $5 ); }
    19962043        ;
    19972044
     
    20432090                // No SUE declaration in parameter list.
    20442091        declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
    2045                 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
     2092                {
     2093                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     2094                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
     2095                }
    20462096        | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
    2047                 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
     2097                {
     2098                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     2099                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
     2100                }
    20482101        ;
    20492102
     
    21032156initializer:
    21042157        assignment_expression                                           { $$ = new InitializerNode( $1 ); }
    2105         | '{' initializer_list_opt comma_opt '}'        { $$ = new InitializerNode( $2, true ); }
    2106         ;
    2107 
    2108 initializer_list_opt:
     2158        | '{' initializer_list comma_opt '}'            { $$ = new InitializerNode( $2, true ); }
     2159        ;
     2160
     2161initializer_list:
    21092162        // empty
    21102163                { $$ = nullptr; }
    21112164        | initializer
    21122165        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    2113         | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
    2114         | initializer_list_opt ',' designation initializer
     2166        | initializer_list ',' initializer                      { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
     2167        | initializer_list ',' designation initializer
    21152168                { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) ) ); }
    21162169        ;
     
    21422195        '.' no_attr_identifier                                                          // C99, field name
    21432196                { $$ = new ExpressionNode( build_varref( $2 ) ); }
    2144         | '[' assignment_expression ']'                                         // C99, single array element
     2197        | '[' push assignment_expression pop ']'                        // C99, single array element
    21452198                // assignment_expression used instead of constant_expression because of shift/reduce conflicts with tuple.
    2146                 { $$ = $2; }
    2147         | '[' subrange ']'                                                                      // CFA, multiple array elements
    2148                 { $$ = $2; }
    2149         | '[' constant_expression ELLIPSIS constant_expression ']' // GCC, multiple array elements
    2150                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $2 ), maybeMoveBuild< Expression >( $4 ) ) ); }
    2151         | '.' '[' field_list ']'                                                        // CFA, tuple field selector
    21522199                { $$ = $3; }
     2200        | '[' push subrange pop ']'                                                     // CFA, multiple array elements
     2201                { $$ = $3; }
     2202        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
     2203                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
     2204        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
     2205                { $$ = $4; }
    21532206        ;
    21542207
     
    22202273assertion:                                                                                              // CFA
    22212274        '|' no_attr_identifier_or_type_name '(' type_list ')'
    2222                 { $$ = DeclarationNode::newTraitUse( $2, $4 ); }
     2275                {
     2276                        typedefTable.openTrait( *$2 );
     2277                        $$ = DeclarationNode::newTraitUse( $2, $4 );
     2278                }
    22232279        | '|' '{' push trait_declaration_list '}'
    22242280                { $$ = $4; }
    22252281        | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_list ')'
    2226                 { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; }
     2282                { $$ = nullptr; }
    22272283        ;
    22282284
     
    22682324trait_specifier:                                                                                // CFA
    22692325        TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    2270                 { $$ = DeclarationNode::newTrait( $2, $5, 0 ); }
     2326                {
     2327                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
     2328                        $$ = DeclarationNode::newTrait( $2, $5, 0 );
     2329                }
    22712330        | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
    2272                 { typedefTable.enterScope(); }
     2331                {
     2332                        typedefTable.enterTrait( *$2 );
     2333                        typedefTable.enterScope();
     2334                }
    22732335          trait_declaration_list '}'
    2274                 { $$ = DeclarationNode::newTrait( $2, $5, $10 ); }
     2336                {
     2337                        typedefTable.leaveTrait();
     2338                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
     2339                        $$ = DeclarationNode::newTrait( $2, $5, $10 );
     2340                }
    22752341        ;
    22762342
     
    22882354cfa_trait_declaring_list:                                                               // CFA
    22892355        cfa_variable_specifier
    2290                 { $$ = $1; }
     2356                {
     2357                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     2358                        $$ = $1;
     2359                }
    22912360        | cfa_function_specifier
    2292                 { $$ = $1; }
     2361                {
     2362                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     2363                        $$ = $1;
     2364                }
    22932365        | cfa_trait_declaring_list pop ',' push identifier_or_type_name
    2294                 { $$ = $1->appendList( $1->cloneType( $5 ) ); }
     2366                {
     2367                        typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID );
     2368                        $$ = $1->appendList( $1->cloneType( $5 ) );
     2369                }
    22952370        ;
    22962371
    22972372trait_declaring_list:                                                                   // CFA
    22982373        type_specifier declarator
    2299                 { $$ = $2->addType( $1 ); }
     2374                {
     2375                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     2376                        $$ = $2->addType( $1 );
     2377                }
    23002378        | trait_declaring_list pop ',' push declarator
    2301                 { $$ = $1->appendList( $1->cloneBaseType( $5 ) ); }
     2379                {
     2380                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     2381                        $$ = $1->appendList( $1->cloneBaseType( $5 ) );
     2382                }
    23022383        ;
    23032384
     
    24072488        | function_declarator compound_statement
    24082489                {
     2490                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24092491                        typedefTable.leaveScope();
    24102492                        $$ = $1->addFunctionBody( $2 );
     
    24122494        | KR_function_declarator KR_declaration_list_opt compound_statement
    24132495                {
     2496                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24142497                        typedefTable.leaveScope();
    24152498                        $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 );
     
    24272510        cfa_function_declaration with_clause_opt compound_statement     // CFA
    24282511                {
     2512                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24292513                        typedefTable.leaveScope();
    24302514                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
     
    24362520                {
    24372521                        rebindForall( $1, $2 );
     2522                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24382523                        typedefTable.leaveScope();
    24392524                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24402525                }
    2441         | declaration_specifier variable_type_redeclarator with_clause_opt compound_statement
    2442                 {
    2443                         rebindForall( $1, $2 );
    2444                         typedefTable.leaveScope();
    2445                         $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    2446                 }
    24472526                // handles default int return type, OBSOLESCENT (see 1)
    24482527        | type_qualifier_list function_declarator with_clause_opt compound_statement
    24492528                {
     2529                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24502530                        typedefTable.leaveScope();
    24512531                        $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
     
    24542534        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    24552535                {
     2536                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24562537                        typedefTable.leaveScope();
    24572538                        $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
     
    24602541        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    24612542                {
     2543                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24622544                        typedefTable.leaveScope();
    24632545                        $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 );
     
    24682550                {
    24692551                        rebindForall( $1, $2 );
     2552                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24702553                        typedefTable.leaveScope();
    24712554                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addType( $1 );
     
    24742557        | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24752558                {
     2559                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24762560                        typedefTable.leaveScope();
    24772561                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
     
    24802564        | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24812565                {
     2566                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24822567                        typedefTable.leaveScope();
    24832568                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
     
    24862571        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    24872572                {
     2573                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24882574                        typedefTable.leaveScope();
    24892575                        $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 );
     
    25982684paren_identifier:
    25992685        identifier
    2600                 { $$ = DeclarationNode::newName( $1 ); }
     2686                {
     2687                        typedefTable.setNextIdentifier( *$1 );
     2688                        $$ = DeclarationNode::newName( $1 );
     2689                }
    26012690        | '(' paren_identifier ')'                                                      // redundant parenthesis
    26022691                { $$ = $2; }
     
    26852774        paren_identifier '(' identifier_list ')'                        // function_declarator handles empty parameter
    26862775                { $$ = $1->addIdList( $3 ); }
    2687         | '(' KR_function_ptr ')' '(' parameter_type_list_opt ')'
    2688                 { $$ = $2->addParamList( $5 ); }
     2776        | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')'
     2777                { $$ = $2->addParamList( $6 ); }
    26892778        | '(' KR_function_no_ptr ')'                                            // redundant parenthesis
    26902779                { $$ = $2; }
     
    27312820paren_type:
    27322821        typedef
    2733                 { // hide type name by variable name
    2734                         typedefTable.addToEnclosingScope( *$1->name, TypedefTable::ID );
    2735                 }
    27362822        | '(' paren_type ')'
    27372823                { $$ = $2; }
     
    28052891
    28062892identifier_parameter_function:
    2807         paren_identifier '(' parameter_type_list_opt ')'        // empty parameter list OBSOLESCENT (see 3)
    2808                 { $$ = $1->addParamList( $3 ); }
    2809         | '(' identifier_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2810                 { $$ = $2->addParamList( $5 ); }
     2893        paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2894                { $$ = $1->addParamList( $4 ); }
     2895        | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2896                { $$ = $2->addParamList( $6 ); }
    28112897        | '(' identifier_parameter_function ')'                         // redundant parenthesis
    28122898                { $$ = $2; }
     
    28362922typedef:
    28372923        TYPEDEFname
    2838                 { $$ = DeclarationNode::newName( $1 ); }
     2924                {
     2925                        typedefTable.setNextIdentifier( *$1 );
     2926                        $$ = DeclarationNode::newName( $1 );
     2927                }
    28392928        | TYPEGENname
    2840                 { $$ = DeclarationNode::newName( $1 ); }
     2929                {
     2930                        typedefTable.setNextIdentifier( *$1 );
     2931                        $$ = DeclarationNode::newName( $1 );
     2932                }
    28412933        ;
    28422934
     
    28582950
    28592951type_parameter_function:
    2860         typedef '(' parameter_type_list_opt ')'                         // empty parameter list OBSOLESCENT (see 3)
    2861                 { $$ = $1->addParamList( $3 ); }
    2862         | '(' type_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2863                 { $$ = $2->addParamList( $5 ); }
     2952        typedef '(' push parameter_type_list_opt pop ')'        // empty parameter list OBSOLESCENT (see 3)
     2953                { $$ = $1->addParamList( $4 ); }
     2954        | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2955                { $$ = $2->addParamList( $6 ); }
    28642956        ;
    28652957
     
    29083000
    29093001abstract_function:
    2910         '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
    2911                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    2912         | '(' abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2913                 { $$ = $2->addParamList( $5 ); }
     3002        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     3003                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     3004        | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3005                { $$ = $2->addParamList( $6 ); }
    29143006        | '(' abstract_function ')'                                                     // redundant parenthesis
    29153007                { $$ = $2; }
     
    29263018
    29273019multi_array_dimension:
    2928         '[' assignment_expression ']'
    2929                 { $$ = DeclarationNode::newArray( $2, 0, false ); }
    2930         | '[' '*' ']'                                                                           // C99
     3020        '[' push assignment_expression pop ']'
     3021                { $$ = DeclarationNode::newArray( $3, 0, false ); }
     3022        | '[' push '*' pop ']'                                                          // C99
    29313023                { $$ = DeclarationNode::newVarArray( 0 ); }
    2932         | multi_array_dimension '[' assignment_expression ']'
    2933                 { $$ = $1->addArray( DeclarationNode::newArray( $3, 0, false ) ); }
    2934         | multi_array_dimension '[' '*' ']'                                     // C99
     3024        | multi_array_dimension '[' push assignment_expression pop ']'
     3025                { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }
     3026        | multi_array_dimension '[' push '*' pop ']'            // C99
    29353027                { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); }
    29363028        ;
     
    29993091
    30003092abstract_parameter_function:
    3001         '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
    3002                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    3003         | '(' abstract_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3004                 { $$ = $2->addParamList( $5 ); }
     3093        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     3094                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     3095        | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3096                { $$ = $2->addParamList( $6 ); }
    30053097        | '(' abstract_parameter_function ')'                           // redundant parenthesis
    30063098                { $$ = $2; }
     
    30243116                { $$ = DeclarationNode::newArray( 0, 0, false ); }
    30253117        // multi_array_dimension handles the '[' '*' ']' case
    3026         | '[' type_qualifier_list '*' ']'                                       // remaining C99
    3027                 { $$ = DeclarationNode::newVarArray( $2 ); }
    3028         | '[' type_qualifier_list ']'
    3029                 { $$ = DeclarationNode::newArray( 0, $2, false ); }
     3118        | '[' push type_qualifier_list '*' pop ']'                      // remaining C99
     3119                { $$ = DeclarationNode::newVarArray( $3 ); }
     3120        | '[' push type_qualifier_list pop ']'
     3121                { $$ = DeclarationNode::newArray( 0, $3, false ); }
    30303122        // multi_array_dimension handles the '[' assignment_expression ']' case
    3031         | '[' type_qualifier_list assignment_expression ']'
    3032                 { $$ = DeclarationNode::newArray( $3, $2, false ); }
    3033         | '[' STATIC type_qualifier_list_opt assignment_expression ']'
    3034                 { $$ = DeclarationNode::newArray( $4, $3, true ); }
    3035         | '[' type_qualifier_list STATIC assignment_expression ']'
    3036                 { $$ = DeclarationNode::newArray( $4, $2, true ); }
     3123        | '[' push type_qualifier_list assignment_expression pop ']'
     3124                { $$ = DeclarationNode::newArray( $4, $3, false ); }
     3125        | '[' push STATIC type_qualifier_list_opt assignment_expression pop ']'
     3126                { $$ = DeclarationNode::newArray( $5, $4, true ); }
     3127        | '[' push type_qualifier_list STATIC assignment_expression pop ']'
     3128                { $$ = DeclarationNode::newArray( $5, $3, true ); }
    30373129        ;
    30383130
     
    30783170
    30793171variable_abstract_function:
    3080         '(' variable_abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3081                 { $$ = $2->addParamList( $5 ); }
     3172        '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3173                { $$ = $2->addParamList( $6 ); }
    30823174        | '(' variable_abstract_function ')'                            // redundant parenthesis
    30833175                { $$ = $2; }
     
    31423234
    31433235cfa_array_parameter_1st_dimension:
    3144         '[' type_qualifier_list '*' ']'                                         // remaining C99
    3145                 { $$ = DeclarationNode::newVarArray( $2 ); }
    3146         | '[' type_qualifier_list assignment_expression ']'
    3147                 { $$ = DeclarationNode::newArray( $3, $2, false ); }
    3148         | '[' declaration_qualifier_list assignment_expression ']'
     3236        '[' push type_qualifier_list '*' pop ']'                        // remaining C99
     3237                { $$ = DeclarationNode::newVarArray( $3 ); }
     3238        | '[' push type_qualifier_list assignment_expression pop ']'
     3239                { $$ = DeclarationNode::newArray( $4, $3, false ); }
     3240        | '[' push declaration_qualifier_list assignment_expression pop ']'
    31493241                // declaration_qualifier_list must be used because of shift/reduce conflict with
    31503242                // assignment_expression, so a semantic check is necessary to preclude them as a type_qualifier cannot
    31513243                // appear in this context.
    3152                 { $$ = DeclarationNode::newArray( $3, $2, true ); }
    3153         | '[' declaration_qualifier_list type_qualifier_list assignment_expression ']'
    3154                 { $$ = DeclarationNode::newArray( $4, $3->addQualifiers( $3 ), true ); }
     3244                { $$ = DeclarationNode::newArray( $4, $3, true ); }
     3245        | '[' push declaration_qualifier_list type_qualifier_list assignment_expression pop ']'
     3246                { $$ = DeclarationNode::newArray( $5, $4->addQualifiers( $3 ), true ); }
    31553247        ;
    31563248
     
    32213313
    32223314cfa_abstract_tuple:                                                                             // CFA
    3223         '[' cfa_abstract_parameter_list ']'
    3224                 { $$ = DeclarationNode::newTuple( $2 ); }
     3315        '[' push cfa_abstract_parameter_list pop ']'
     3316                { $$ = DeclarationNode::newTuple( $3 ); }
    32253317        ;
    32263318
     
    32283320//      '[' ']' '(' cfa_parameter_type_list_opt ')'
    32293321//              { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    3230         cfa_abstract_tuple '(' cfa_parameter_type_list_opt ')'
    3231                 { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
    3232         | cfa_function_return '(' cfa_parameter_type_list_opt ')'
    3233                 { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
     3322        cfa_abstract_tuple '(' push cfa_parameter_type_list_opt pop ')'
     3323                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
     3324        | cfa_function_return '(' push cfa_parameter_type_list_opt pop ')'
     3325                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    32343326        ;
    32353327
Note: See TracChangeset for help on using the changeset viewer.