Changeset 03606ce for src


Ignore:
Timestamp:
Mar 8, 2024, 12:25:49 AM (4 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
266732e
Parents:
06601401 (diff), 169496e1 (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:
7 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r06601401 r03606ce  
    177177}
    178178
     179DeclarationNode * DeclarationNode::newFromTypeData( TypeData * type ) {
     180        DeclarationNode * newnode = new DeclarationNode;
     181        newnode->type = type;
     182        return newnode;
     183} // DeclarationNode::newFromTypeData
     184
    179185DeclarationNode * DeclarationNode::newStorageClass( ast::Storage::Classes sc ) {
    180186        DeclarationNode * newnode = new DeclarationNode;
     
    188194        return newnode;
    189195} // DeclarationNode::newFuncSpecifier
    190 
    191 DeclarationNode * DeclarationNode::newTypeQualifier( ast::CV::Qualifiers tq ) {
    192         DeclarationNode * newnode = new DeclarationNode;
    193         newnode->type = new TypeData();
    194         newnode->type->qualifiers = tq;
    195         return newnode;
    196 } // DeclarationNode::newQualifier
    197 
    198 DeclarationNode * DeclarationNode::newBasicType( BasicType bt ) {
    199         DeclarationNode * newnode = new DeclarationNode;
    200         newnode->type = new TypeData( TypeData::Basic );
    201         newnode->type->basictype = bt;
    202         return newnode;
    203 } // DeclarationNode::newBasicType
    204 
    205 DeclarationNode * DeclarationNode::newComplexType( ComplexType ct ) {
    206         DeclarationNode * newnode = new DeclarationNode;
    207         newnode->type = new TypeData( TypeData::Basic );
    208         newnode->type->complextype = ct;
    209         return newnode;
    210 } // DeclarationNode::newComplexType
    211 
    212 DeclarationNode * DeclarationNode::newSignedNess( Signedness sn ) {
    213         DeclarationNode * newnode = new DeclarationNode;
    214         newnode->type = new TypeData( TypeData::Basic );
    215         newnode->type->signedness = sn;
    216         return newnode;
    217 } // DeclarationNode::newSignedNess
    218 
    219 DeclarationNode * DeclarationNode::newLength( Length lnth ) {
    220         DeclarationNode * newnode = new DeclarationNode;
    221         newnode->type = new TypeData( TypeData::Basic );
    222         newnode->type->length = lnth;
    223         return newnode;
    224 } // DeclarationNode::newLength
    225 
    226 DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) {
    227         DeclarationNode * newnode = new DeclarationNode;
    228         newnode->type = new TypeData( TypeData::Unknown );
    229         newnode->type->forall = forall;
    230         return newnode;
    231 } // DeclarationNode::newForall
    232 
    233 DeclarationNode * DeclarationNode::newFromGlobalScope() {
    234         DeclarationNode * newnode = new DeclarationNode;
    235         newnode->type = new TypeData( TypeData::GlobalScope );
    236         return newnode;
    237 }
    238 
    239 DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) {
    240         DeclarationNode * newnode = new DeclarationNode;
    241         newnode->type = new TypeData( TypeData::Qualified );
    242         newnode->type->qualified.parent = parent->type;
    243         newnode->type->qualified.child = child->type;
    244         parent->type = nullptr;
    245         child->type = nullptr;
    246         delete parent;
    247         delete child;
    248         return newnode;
    249 }
    250196
    251197DeclarationNode * DeclarationNode::newAggregate( ast::AggregateDecl::Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     
    312258}
    313259
    314 DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
    315         DeclarationNode * newnode = new DeclarationNode;
    316         newnode->type = new TypeData( TypeData::SymbolicInst );
    317         newnode->type->symbolic.name = name;
    318         newnode->type->symbolic.isTypedef = true;
    319         newnode->type->symbolic.params = nullptr;
    320         return newnode;
    321 } // DeclarationNode::newFromTypedef
    322 
    323 DeclarationNode * DeclarationNode::newFromTypeGen( const string * name, ExpressionNode * params ) {
    324         DeclarationNode * newnode = new DeclarationNode;
    325         newnode->type = new TypeData( TypeData::SymbolicInst );
    326         newnode->type->symbolic.name = name;
    327         newnode->type->symbolic.isTypedef = false;
    328         newnode->type->symbolic.actuals = params;
    329         return newnode;
    330 } // DeclarationNode::newFromTypeGen
    331 
    332260DeclarationNode * DeclarationNode::newTypeParam( ast::TypeDecl::Kind tc, const string * name ) {
    333261        DeclarationNode * newnode = newName( name );
     
    423351        return newnode;
    424352}
    425 
    426 DeclarationNode * DeclarationNode::newVtableType( DeclarationNode * decl ) {
    427         DeclarationNode * newnode = new DeclarationNode;
    428         newnode->type = new TypeData( TypeData::Vtable );
    429         newnode->setBase( decl->type );
    430         return newnode;
    431 }
    432 
    433 DeclarationNode * DeclarationNode::newBuiltinType( BuiltinType bt ) {
    434         DeclarationNode * newnode = new DeclarationNode;
    435         newnode->type = new TypeData( TypeData::Builtin );
    436         newnode->type->builtintype = bt;
    437         return newnode;
    438 } // DeclarationNode::newBuiltinType
    439353
    440354DeclarationNode * DeclarationNode::newFunction( const string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
  • src/Parser/DeclarationNode.h

    r06601401 r03606ce  
    4040        static const char * builtinTypeNames[];
    4141
     42        static DeclarationNode * newFromTypeData( TypeData * );
    4243        static DeclarationNode * newStorageClass( ast::Storage::Classes );
    4344        static DeclarationNode * newFuncSpecifier( ast::Function::Specs );
    44         static DeclarationNode * newTypeQualifier( ast::CV::Qualifiers );
    45         static DeclarationNode * newBasicType( BasicType );
    46         static DeclarationNode * newComplexType( ComplexType );
    47         static DeclarationNode * newSignedNess( Signedness );
    48         static DeclarationNode * newLength( Length );
    49         static DeclarationNode * newBuiltinType( BuiltinType );
    50         static DeclarationNode * newForall( DeclarationNode * );
    51         static DeclarationNode * newFromTypedef( const std::string * );
    52         static DeclarationNode * newFromGlobalScope();
    53         static DeclarationNode * newQualifiedType( DeclarationNode *, DeclarationNode * );
    5445        static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    5546        static DeclarationNode * newAggregate( ast::AggregateDecl::Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     
    5950        static DeclarationNode * newEnumInLine( const std::string name );
    6051        static DeclarationNode * newName( const std::string * );
    61         static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
    6252        static DeclarationNode * newTypeParam( ast::TypeDecl::Kind, const std::string * );
    6353        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
     
    7060        static DeclarationNode * newTuple( DeclarationNode * members );
    7161        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
    72         static DeclarationNode * newVtableType( DeclarationNode * expr );
    7362        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    7463        static DeclarationNode * newDirectiveStmt( StatementNode * stmt ); // gcc external directive statement
     
    163152}; // DeclarationNode
    164153
    165 ast::Type * buildType( TypeData * type );
    166 
    167154static inline ast::Type * maybeMoveBuildType( const DeclarationNode * orig ) {
    168155        ast::Type * ret = orig ? orig->buildType() : nullptr;
  • src/Parser/ExpressionNode.cc

    r06601401 r03606ce  
    2929#include "DeclarationNode.h"       // for DeclarationNode
    3030#include "InitializerNode.h"       // for InitializerNode
     31#include "TypeData.h"              // for addType, build_basic_type, build_c...
    3132#include "parserutility.h"         // for notZeroExpr
    3233
     
    316317                                v2 );
    317318                        ret = build_compoundLiteral( location,
    318                                 DeclarationNode::newBasicType(
    319                                         DeclarationNode::Int128
    320                                 )->addType(
    321                                         DeclarationNode::newSignedNess( DeclarationNode::Unsigned ) ),
     319                                DeclarationNode::newFromTypeData(
     320                                        addType(
     321                                                build_basic_type( DeclarationNode::Int128 ),
     322                                                build_signedness( DeclarationNode::Unsigned ) ) ),
    322323                                new InitializerNode(
    323                                         (InitializerNode *)(new InitializerNode( new ExpressionNode( v2 == 0 ? ret2 : ret ) ))->set_last( new InitializerNode( new ExpressionNode( v2 == 0 ? ret : ret2 ) ) ), true )
     324                                        (new InitializerNode( new ExpressionNode( v2 == 0 ? ret2 : ret ) ))->set_last( new InitializerNode( new ExpressionNode( v2 == 0 ? ret : ret2 ) ) ), true )
    324325                        );
    325326                } else {                                                                                // explicit length, (length_type)constant
  • src/Parser/TypeData.cc

    r06601401 r03606ce  
    478478}
    479479
    480 
    481480TypeData * TypeData::getLastBase() {
    482481        TypeData * cur = this;
     
    487486void TypeData::setLastBase( TypeData * newBase ) {
    488487        getLastBase()->base = newBase;
     488}
     489
     490
     491TypeData * build_type_qualifier( ast::CV::Qualifiers tq ) {
     492        TypeData * type = new TypeData;
     493        type->qualifiers = tq;
     494        return type;
     495}
     496
     497TypeData * build_basic_type( DeclarationNode::BasicType basic ) {
     498        TypeData * type = new TypeData( TypeData::Basic );
     499        type->basictype = basic;
     500        return type;
     501}
     502
     503TypeData * build_complex_type( DeclarationNode::ComplexType complex ) {
     504        TypeData * type = new TypeData( TypeData::Basic );
     505        type->complextype = complex;
     506        return type;
     507}
     508
     509TypeData * build_signedness( DeclarationNode::Signedness signedness ) {
     510        TypeData * type = new TypeData( TypeData::Basic );
     511        type->signedness = signedness;
     512        return type;
     513}
     514
     515TypeData * build_builtin_type( DeclarationNode::BuiltinType bit ) {
     516        TypeData * type = new TypeData( TypeData::Builtin );
     517        type->builtintype = bit;
     518        return type;
     519}
     520
     521TypeData * build_length( DeclarationNode::Length length ) {
     522        TypeData * type = new TypeData( TypeData::Basic );
     523        type->length = length;
     524        return type;
     525}
     526
     527TypeData * build_forall( DeclarationNode * forall ) {
     528        TypeData * type = new TypeData( TypeData::Unknown );
     529        type->forall = forall;
     530        return type;
     531}
     532
     533TypeData * build_global_scope() {
     534        return new TypeData( TypeData::GlobalScope );
     535}
     536
     537TypeData * build_qualified_type( TypeData * parent, TypeData * child ) {
     538        TypeData * type = new TypeData( TypeData::Qualified );
     539        type->qualified.parent = parent;
     540        type->qualified.child = child;
     541        return type;
     542}
     543
     544TypeData * build_typedef( const std::string * name ) {
     545        TypeData * type = new TypeData( TypeData::SymbolicInst );
     546        type->symbolic.name = name;
     547        type->symbolic.isTypedef = true;
     548        type->symbolic.actuals = nullptr;
     549        return type;
     550}
     551
     552TypeData * build_type_gen( const std::string * name, ExpressionNode * params ) {
     553        TypeData * type = new TypeData( TypeData::SymbolicInst );
     554        type->symbolic.name = name;
     555        type->symbolic.isTypedef = false;
     556        type->symbolic.actuals = params;
     557        return type;
     558}
     559
     560TypeData * build_vtable_type( TypeData * base ) {
     561        TypeData * type = new TypeData( TypeData::Vtable );
     562        type->base = base;
     563        return type;
    489564}
    490565
     
    627702                return rtype;
    628703        } // if
     704}
     705
     706TypeData * addType( TypeData * ltype, TypeData * rtype ) {
     707        std::vector<ast::ptr<ast::Attribute>> attributes;
     708        return addType( ltype, rtype, attributes );
    629709}
    630710
  • src/Parser/TypeData.h

    r06601401 r03606ce  
    116116};
    117117
     118
     119TypeData * build_type_qualifier( ast::CV::Qualifiers );
     120TypeData * build_basic_type( DeclarationNode::BasicType );
     121TypeData * build_complex_type( DeclarationNode::ComplexType );
     122TypeData * build_signedness( DeclarationNode::Signedness );
     123TypeData * build_builtin_type( DeclarationNode::BuiltinType );
     124TypeData * build_length( DeclarationNode::Length );
     125TypeData * build_forall( DeclarationNode * );
     126TypeData * build_global_scope();
     127TypeData * build_qualified_type( TypeData *, TypeData * );
     128TypeData * build_typedef( const std::string * name );
     129TypeData * build_type_gen( const std::string * name, ExpressionNode * params );
     130TypeData * build_vtable_type( TypeData * );
     131
    118132TypeData * addQualifiers( TypeData * ltype, TypeData * rtype );
    119133TypeData * addType( TypeData * ltype, TypeData * rtype, std::vector<ast::ptr<ast::Attribute>> & );
     134TypeData * addType( TypeData * ltype, TypeData * rtype );
    120135TypeData * cloneBaseType( TypeData * type, TypeData * other );
    121136TypeData * makeNewBase( TypeData * type );
     137
    122138
    123139ast::Type * typebuild( const TypeData * );
     
    144160void buildKRFunction( const TypeData::Function_t & function );
    145161
     162static inline ast::Type * maybeMoveBuildType( TypeData * type ) {
     163        ast::Type * ret = type ? typebuild( type ) : nullptr;
     164        delete type;
     165        return ret;
     166}
     167
    146168// Local Variables: //
    147169// tab-width: 4 //
  • src/Parser/TypedefTable.cc

    r06601401 r03606ce  
    2020#include <string>                                                                               // for string
    2121#include <iostream>                                                                             // for iostream
     22
     23struct TypeData;
    2224
    2325#include "ExpressionNode.h"                                                             // for LabelNode
  • src/Parser/parser.yy

    r06601401 r03606ce  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  4 08:44:25 2024
    13 // Update Count     : 6562
     12// Last Modified On : Wed Mar  6 10:51:55 2024
     13// Update Count     : 6588
    1414//
    1515
     
    317317
    318318%union {
     319        // A raw token can be used.
    319320        Token tok;
     321
     322        // The general node types hold some generic node or list of nodes.
     323        DeclarationNode * decl;
     324        InitializerNode * init;
    320325        ExpressionNode * expr;
    321         DeclarationNode * decl;
    322         ast::AggregateDecl::Aggregate aggKey;
    323         ast::TypeDecl::Kind tclass;
    324326        StatementNode * stmt;
    325327        ClauseNode * clause;
    326         ast::WaitForStmt * wfs;
    327     ast::WaitUntilStmt::ClauseNode * wucn;
     328        TypeData * type;
     329
     330        // Special "nodes" containing compound information.
    328331        CondCtl * ifctl;
    329332        ForCtrl * forctl;
    330333        LabelNode * labels;
    331         InitializerNode * init;
     334
     335        // Various flags and single values that become fields later.
     336        ast::AggregateDecl::Aggregate aggKey;
     337        ast::TypeDecl::Kind tclass;
    332338        OperKinds oper;
    333         std::string * str;
    334339        bool is_volatile;
    335340        EnumHiding enum_hiding;
    336341        ast::ExceptionKind except_kind;
     342        // String passes ownership with it.
     343        std::string * str;
     344
     345        // Narrower node types are used to avoid constant unwrapping.
     346        ast::WaitForStmt * wfs;
     347        ast::WaitUntilStmt::ClauseNode * wucn;
    337348        ast::GenericExpr * genexpr;
    338349}
     
    464475
    465476%type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type indirect_type
    466 %type<decl> vtable vtable_opt default_opt
     477%type<type> basic_type_name_type
     478%type<type> vtable vtable_opt default_opt
    467479
    468480%type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier
     
    519531%type<decl> type_declarator type_declarator_name type_declaring_list
    520532
    521 %type<decl> type_declaration_specifier type_type_specifier type_name typegen_name
     533%type<decl> type_declaration_specifier type_type_specifier
     534%type<type> type_name typegen_name
    522535%type<decl> typedef_name typedef_declaration typedef_expression
    523536
     
    532545%type<expr> type_parameters_opt type_list array_type_list // array_dimension_list
    533546
    534 %type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list
     547%type<decl> type_qualifier forall type_qualifier_list_opt type_qualifier_list
     548%type<type> type_qualifier_name
    535549%type<decl> type_specifier type_specifier_nobody
    536550
     
    687701                { $$ = new ExpressionNode( build_varref( yylloc, $1 ) ); }
    688702        | TYPEDIMname                                                                           // CFA, generic length argument
    689                 // { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( DeclarationNode::newFromTypedef( $1 ) ) ) ); }
    690                 // { $$ = new ExpressionNode( build_varref( $1 ) ); }
    691703                { $$ = new ExpressionNode( build_dimensionref( yylloc, $1 ) ); }
    692704        | tuple
     
    696708                { $$ = new ExpressionNode( new ast::StmtExpr( yylloc, dynamic_cast<ast::CompoundStmt *>( maybeMoveBuild( $2 ) ) ) ); }
    697709        | type_name '.' identifier                                                      // CFA, nested type
    698                 { $$ = new ExpressionNode( build_qualified_expr( yylloc, $1, build_varref( yylloc, $3 ) ) ); }
     710                { $$ = new ExpressionNode( build_qualified_expr( yylloc, DeclarationNode::newFromTypeData( $1 ), build_varref( yylloc, $3 ) ) ); }
    699711        | type_name '.' '[' field_name_list ']'                         // CFA, nested type / tuple field selector
    700712                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     
    751763                // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
    752764                // Current: Commas in subscripts make tuples.
    753                 { $$ = new ExpressionNode( build_binary_val( yylloc, OperKinds::Index, $1, new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); }
     765                { $$ = new ExpressionNode( build_binary_val( yylloc, OperKinds::Index, $1, new ExpressionNode( build_tuple( yylloc, $3->set_last( $5 ) ) ) ) ); }
    754766        | postfix_expression '[' assignment_expression ']'
    755767                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
     
    766778                        Token fn;
    767779                        fn.str = new std::string( "?{}" );                      // location undefined - use location of '{'?
    768                         $$ = new ExpressionNode( new ast::ConstructorExpr( yylloc, build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
     780                        $$ = new ExpressionNode( new ast::ConstructorExpr( yylloc, build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), $1->set_last( $3 ) ) ) );
    769781                }
    770782        | postfix_expression '(' argument_expression_list_opt ')'
     
    772784        | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')'
    773785                // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; }
    774                 { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, new string( "__builtin_va_arg") ) ),
    775                                                                                            (ExpressionNode *)($3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) )) ) ); }
     786                { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, new string( "__builtin_va_arg" ) ) ),
     787                                                                                           $3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) ) ) ); }
    776788        | postfix_expression '`' identifier                                     // CFA, postfix call
    777789                { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, build_postfix_name( $3 ) ) ), $1 ) ); }
     
    831843                        Token fn;
    832844                        fn.str = new string( "^?{}" );                          // location undefined
    833                         $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), (ExpressionNode *)( $2 )->set_last( $4 ) ) );
     845                        $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), $2->set_last( $4 ) ) );
    834846                }
    835847        ;
     
    844856        argument_expression
    845857        | argument_expression_list_opt ',' argument_expression
    846                 { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     858                { $$ = $1->set_last( $3 ); }
    847859        ;
    848860
     
    856868field_name_list:                                                                                // CFA, tuple field selector
    857869        field
    858         | field_name_list ',' field                                     { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     870        | field_name_list ',' field                                     { $$ = $1->set_last( $3 ); }
    859871        ;
    860872
     
    938950        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    939951                { $$ = new ExpressionNode( new ast::AlignofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
     952
     953                // Cannot use rule "type", which includes cfa_abstract_function, for sizeof/alignof, because of S/R problems on
     954                // look ahead, so the cfa_abstract_function is factored out.
     955        | SIZEOF '(' cfa_abstract_function ')'
     956                { $$ = new ExpressionNode( new ast::SizeofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
     957        | ALIGNOF '(' cfa_abstract_function ')'                         // GCC, type alignment
     958                { $$ = new ExpressionNode( new ast::AlignofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
     959
    940960        | OFFSETOF '(' type_no_function ',' identifier ')'
    941961                { $$ = new ExpressionNode( build_offsetOf( yylloc, $3, build_varref( yylloc, $5 ) ) ); }
    942         | TYPEID '(' type_no_function ')'
     962        | TYPEID '(' type ')'
    943963                {
    944964                        SemanticError( yylloc, "typeid name is currently unimplemented." ); $$ = nullptr;
     
    970990                { $$ = new ExpressionNode( build_keyword_cast( yylloc, $2, $5 ) ); }
    971991        | '(' VIRTUAL ')' cast_expression                                       // CFA
    972                 { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $4 ), maybeMoveBuildType( nullptr ) ) ); }
     992                { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $4 ), nullptr ) ); }
    973993        | '(' VIRTUAL type_no_function ')' cast_expression      // CFA
    974994                { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $5 ), maybeMoveBuildType( $3 ) ) ); }
     
    11421162//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    11431163        '[' ',' tuple_expression_list ']'
    1144                 { $$ = new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
     1164                { $$ = new ExpressionNode( build_tuple( yylloc, (new ExpressionNode( nullptr ))->set_last( $3 ) ) ); }
    11451165        | '[' push assignment_expression pop ',' tuple_expression_list ']'
    1146                 { $$ = new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)($3->set_last( $6 ) ) )); }
     1166                { $$ = new ExpressionNode( build_tuple( yylloc, $3->set_last( $6 ) ) ); }
    11471167        ;
    11481168
     
    11521172                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
    11531173        | tuple_expression_list ',' assignment_expression
    1154                 { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     1174                { $$ = $1->set_last( $3 ); }
    11551175        | tuple_expression_list ',' '@'
    11561176                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
     
    12381258                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    12391259        | statement_list_nodecl error                                           // invalid syntax rule
    1240                 { SemanticError( yylloc, "syntax error, declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }
     1260                { SemanticError( yylloc, "syntax error, declarations only allowed at the start of the switch body,"
     1261                                                 " i.e., after the '{'." ); $$ = nullptr; }
    12411262        ;
    12421263
     
    12461267        ;
    12471268
    1248 // if, switch, and choose require parenthesis around the conditional because it can be followed by a statement.
    1249 // For example, without parenthesis:
    1250 //
    1251 //    if x + y + z; => "if ( x + y ) + z" or "if ( x ) + y + z"
    1252 //    switch ( S ) { ... } => switch ( S ) { compound literal... } ... or
     1269// "if", "switch", and "choose" require parenthesis around the conditional. See the following ambiguities without
     1270// parenthesis:
     1271//
     1272//   if x + y + z; => "if ( x + y ) + z" or "if ( x ) + y + z"
     1273//
     1274//   switch O { }
     1275//
     1276//     O{} => object-constructor for conditional, switch body ???
     1277//     O{} => O for conditional followed by switch body
     1278//
     1279//     C++ has this problem, as it has the same constructor syntax.
     1280//
     1281//   switch sizeof ( T ) { }
     1282//
     1283//     sizeof ( T ) => sizeof of T for conditional followed by switch body
     1284//     sizeof ( T ) => sizeof of compound literal (T){ }, closing parenthesis ???
     1285//
     1286//     Note the two grammar rules for sizeof (alignof)
     1287//
     1288//       | SIZEOF unary_expression
     1289//       | SIZEOF '(' type_no_function ')'
     1290//
     1291//     where the first DOES NOT require parenthesis! And C++ inherits this problem from C.
    12531292
    12541293selection_statement:
     
    12681307                        // therefore, are removed from the grammar even though C allows it. The change also applies to choose
    12691308                        // statement.
    1270                         $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
     1309                        $$ = $7 ? new StatementNode( build_compound( yylloc, (new StatementNode( $7 ))->set_last( sw ) ) ) : sw;
    12711310                }
    12721311        | SWITCH '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule error
     
    12771316                {
    12781317                        StatementNode *sw = new StatementNode( build_switch( yylloc, false, $3, $8 ) );
    1279                         $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
     1318                        $$ = $7 ? new StatementNode( build_compound( yylloc, (new StatementNode( $7 ))->set_last( sw ) ) ) : sw;
    12801319                }
    12811320        | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule
     
    16791718        cast_expression
    16801719        | cast_expression_list ',' cast_expression
    1681                 // { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    16821720                { SemanticError( yylloc, "List of mutex member is currently unimplemented." ); $$ = nullptr; }
    16831721        ;
     
    16951733                { $$ = $3; }
    16961734        | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')'
    1697                 { $$ = (ExpressionNode *)($3->set_last( $5 )); }
     1735                { $$ = $3->set_last( $5 ); }
    16981736        ;
    16991737
     
    18511889        asm_operand
    18521890        | asm_operands_list ',' asm_operand
    1853                 { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     1891                { $$ = $1->set_last( $3 ); }
    18541892        ;
    18551893
     
    18701908                { $$ = $1; }
    18711909        | asm_clobbers_list_opt ',' string_literal
    1872                 { $$ = (ExpressionNode *)( $1->set_last( $3 ) ); }
     1910                { $$ = $1->set_last( $3 ); }
    18731911        ;
    18741912
     
    21882226type_qualifier:
    21892227        type_qualifier_name
     2228                { $$ = DeclarationNode::newFromTypeData( $1 ); }
    21902229        | attribute                                                                                     // trick handles most attribute locations
    21912230        ;
     
    21932232type_qualifier_name:
    21942233        CONST
    2195                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Const ); }
     2234                { $$ = build_type_qualifier( ast::CV::Const ); }
    21962235        | RESTRICT
    2197                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Restrict ); }
     2236                { $$ = build_type_qualifier( ast::CV::Restrict ); }
    21982237        | VOLATILE
    2199                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Volatile ); }
     2238                { $$ = build_type_qualifier( ast::CV::Volatile ); }
    22002239        | ATOMIC
    2201                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Atomic ); }
     2240                { $$ = build_type_qualifier( ast::CV::Atomic ); }
     2241
     2242                // forall must be a CV qualifier because it can appear in places where SC qualifiers are disallowed.
     2243                //
     2244                //   void foo( forall( T ) T (*)( T ) ); // forward declaration
     2245                //   void bar( static int ); // static disallowed (gcc/CFA)
    22022246        | forall
    2203                 { $$ = DeclarationNode::newForall( $1 ); }
     2247                { $$ = build_forall( $1 ); }
    22042248        ;
    22052249
     
    22512295
    22522296basic_type_name:
     2297        basic_type_name_type
     2298                { $$ = DeclarationNode::newFromTypeData( $1 ); }
     2299        ;
     2300
     2301// Just an intermediate value for conversion.
     2302basic_type_name_type:
    22532303        VOID
    2254                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     2304                { $$ = build_basic_type( DeclarationNode::Void ); }
    22552305        | BOOL                                                                                          // C99
    2256                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     2306                { $$ = build_basic_type( DeclarationNode::Bool ); }
    22572307        | CHAR
    2258                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     2308                { $$ = build_basic_type( DeclarationNode::Char ); }
    22592309        | INT
    2260                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     2310                { $$ = build_basic_type( DeclarationNode::Int ); }
    22612311        | INT128
    2262                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 ); }
     2312                { $$ = build_basic_type( DeclarationNode::Int128 ); }
    22632313        | UINT128
    2264                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 )->addType( DeclarationNode::newSignedNess( DeclarationNode::Unsigned ) ); }
     2314                { $$ = addType( build_basic_type( DeclarationNode::Int128 ), build_signedness( DeclarationNode::Unsigned ) ); }
    22652315        | FLOAT
    2266                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     2316                { $$ = build_basic_type( DeclarationNode::Float ); }
    22672317        | DOUBLE
    2268                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
     2318                { $$ = build_basic_type( DeclarationNode::Double ); }
    22692319        | uuFLOAT80
    2270                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat80 ); }
     2320                { $$ = build_basic_type( DeclarationNode::uuFloat80 ); }
    22712321        | uuFLOAT128
    2272                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat128 ); }
     2322                { $$ = build_basic_type( DeclarationNode::uuFloat128 ); }
    22732323        | uFLOAT16
    2274                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat16 ); }
     2324                { $$ = build_basic_type( DeclarationNode::uFloat16 ); }
    22752325        | uFLOAT32
    2276                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32 ); }
     2326                { $$ = build_basic_type( DeclarationNode::uFloat32 ); }
    22772327        | uFLOAT32X
    2278                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32x ); }
     2328                { $$ = build_basic_type( DeclarationNode::uFloat32x ); }
    22792329        | uFLOAT64
    2280                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64 ); }
     2330                { $$ = build_basic_type( DeclarationNode::uFloat64 ); }
    22812331        | uFLOAT64X
    2282                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64x ); }
     2332                { $$ = build_basic_type( DeclarationNode::uFloat64x ); }
    22832333        | uFLOAT128
    2284                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat128 ); }
     2334                { $$ = build_basic_type( DeclarationNode::uFloat128 ); }
    22852335        | DECIMAL32
    22862336                { SemanticError( yylloc, "_Decimal32 is currently unimplemented." ); $$ = nullptr; }
     
    22902340                { SemanticError( yylloc, "_Decimal128 is currently unimplemented." ); $$ = nullptr; }
    22912341        | COMPLEX                                                                                       // C99
    2292                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     2342                { $$ = build_complex_type( DeclarationNode::Complex ); }
    22932343        | IMAGINARY                                                                                     // C99
    2294                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     2344                { $$ = build_complex_type( DeclarationNode::Imaginary ); }
    22952345        | SIGNED
    2296                 { $$ = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
     2346                { $$ = build_signedness( DeclarationNode::Signed ); }
    22972347        | UNSIGNED
    2298                 { $$ = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
     2348                { $$ = build_signedness( DeclarationNode::Unsigned ); }
    22992349        | SHORT
    2300                 { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     2350                { $$ = build_length( DeclarationNode::Short ); }
    23012351        | LONG
    2302                 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
     2352                { $$ = build_length( DeclarationNode::Long ); }
    23032353        | VA_LIST                                                                                       // GCC, __builtin_va_list
    2304                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     2354                { $$ = build_builtin_type( DeclarationNode::Valist ); }
    23052355        | AUTO_TYPE
    2306                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::AutoType ); }
     2356                { $$ = build_builtin_type( DeclarationNode::AutoType ); }
    23072357        | vtable
    23082358        ;
     
    23162366vtable:
    23172367        VTABLE '(' type_name ')' default_opt
    2318                 { $$ = DeclarationNode::newVtableType( $3 ); }
    2319                 // { SemanticError( yylloc, "vtable is currently unimplemented." ); $$ = nullptr; }
     2368                { $$ = build_vtable_type( $3 ); }
    23202369        ;
    23212370
     
    23672416                { $$ = DeclarationNode::newTypeof( $3, true ); }
    23682417        | ZERO_T                                                                                        // CFA
    2369                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
     2418                { $$ = DeclarationNode::newFromTypeData( build_builtin_type( DeclarationNode::Zero ) ); }
    23702419        | ONE_T                                                                                         // CFA
    2371                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
     2420                { $$ = DeclarationNode::newFromTypeData( build_builtin_type( DeclarationNode::One ) ); }
    23722421        ;
    23732422
     
    24252474type_type_specifier:                                                                    // typedef types
    24262475        type_name
     2476                { $$ = DeclarationNode::newFromTypeData( $1 ); }
    24272477        | type_qualifier_list type_name
    2428                 { $$ = $2->addQualifiers( $1 ); }
     2478                { $$ = DeclarationNode::newFromTypeData( $2 )->addQualifiers( $1 ); }
    24292479        | type_type_specifier type_qualifier
    24302480                { $$ = $1->addQualifiers( $2 ); }
     
    24332483type_name:
    24342484        TYPEDEFname
    2435                 { $$ = DeclarationNode::newFromTypedef( $1 ); }
     2485                { $$ = build_typedef( $1 ); }
    24362486        | '.' TYPEDEFname
    2437                 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), DeclarationNode::newFromTypedef( $2 ) ); }
     2487                { $$ = build_qualified_type( build_global_scope(), build_typedef( $2 ) ); }
    24382488        | type_name '.' TYPEDEFname
    2439                 { $$ = DeclarationNode::newQualifiedType( $1, DeclarationNode::newFromTypedef( $3 ) ); }
     2489                { $$ = build_qualified_type( $1, build_typedef( $3 ) ); }
    24402490        | typegen_name
    24412491        | '.' typegen_name
    2442                 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), $2 ); }
     2492                { $$ = build_qualified_type( build_global_scope(), $2 ); }
    24432493        | type_name '.' typegen_name
    2444                 { $$ = DeclarationNode::newQualifiedType( $1, $3 ); }
     2494                { $$ = build_qualified_type( $1, $3 ); }
    24452495        ;
    24462496
    24472497typegen_name:                                                                                   // CFA
    24482498        TYPEGENname
    2449                 { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); }
     2499                { $$ = build_type_gen( $1, nullptr ); }
    24502500        | TYPEGENname '(' ')'
    2451                 { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); }
     2501                { $$ = build_type_gen( $1, nullptr ); }
    24522502        | TYPEGENname '(' type_list ')'
    2453                 { $$ = DeclarationNode::newFromTypeGen( $1, $3 ); }
     2503                { $$ = build_type_gen( $1, $3 ); }
    24542504        ;
    24552505
     
    24632513        | enum_type_nobody
    24642514        ;
     2515
     2516// ************************** AGGREGATE *******************************
    24652517
    24662518aggregate_type:                                                                                 // struct, union
     
    24852537          '{' field_declaration_list_opt '}' type_parameters_opt
    24862538                {
    2487                         DeclarationNode::newFromTypedef( $3 );
     2539                        DeclarationNode::newFromTypeData( build_typedef( $3 ) );
    24882540                        $$ = DeclarationNode::newAggregate( $1, $3, $8, $6, true )->addQualifiers( $2 );
    24892541                }
     
    24952547          '{' field_declaration_list_opt '}' type_parameters_opt
    24962548                {
    2497                         DeclarationNode::newFromTypeGen( $3, nullptr );
     2549                        DeclarationNode::newFromTypeData( build_type_gen( $3, nullptr ) );
    24982550                        $$ = DeclarationNode::newAggregate( $1, $3, $8, $6, true )->addQualifiers( $2 );
    24992551                }
     
    25202572                        // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is
    25212573                        // switched to a TYPEGENname. Link any generic arguments from typegen_name to new generic declaration and
    2522                         // delete newFromTypeGen.
    2523                         if ( $3->type->kind == TypeData::SymbolicInst && ! $3->type->symbolic.isTypedef ) {
    2524                                 $$ = $3->addQualifiers( $2 );
     2574                        if ( $3->kind == TypeData::SymbolicInst && ! $3->symbolic.isTypedef ) {
     2575                                $$ = DeclarationNode::newFromTypeData( $3 )->addQualifiers( $2 );
    25252576                        } else {
    2526                                 $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $3->type->symbolic.actuals, nullptr, false )->addQualifiers( $2 );
    2527                                 $3->type->symbolic.name = nullptr;                      // copied to $$
    2528                                 $3->type->symbolic.actuals = nullptr;
     2577                                $$ = DeclarationNode::newAggregate( $1, $3->symbolic.name, $3->symbolic.actuals, nullptr, false )->addQualifiers( $2 );
     2578                                $3->symbolic.name = nullptr;                    // copied to $$
     2579                                $3->symbolic.actuals = nullptr;
    25292580                                delete $3;
    25302581                        }
     
    25442595        | EXCEPTION                                                                                     // CFA
    25452596                { $$ = ast::AggregateDecl::Exception; }
    2546           //            { SemanticError( yylloc, "exception aggregate is currently unimplemented." ); $$ = ast::AggregateDecl::NoAggregate; }
    25472597        ;
    25482598
     
    26832733        ;
    26842734
    2685 // ***********
    2686 // Enumeration
    2687 // ***********
     2735// ************************** ENUMERATION *******************************
    26882736
    26892737enum_type:
     
    27542802        | ENUM attribute_list_opt type_name
    27552803                {
    2756                         typedefTable.makeTypedef( *$3->type->symbolic.name, "enum_type_nobody 2" );
    2757                         $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 );
     2804                        typedefTable.makeTypedef( *$3->symbolic.name, "enum_type_nobody 2" );
     2805                        $$ = DeclarationNode::newEnum( $3->symbolic.name, nullptr, false, false )->addQualifiers( $2 );
    27582806                }
    27592807        ;
     
    27632811                { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); }
    27642812        | INLINE type_name
    2765                 { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); }
     2813                { $$ = DeclarationNode::newEnumInLine( *$2->symbolic.name ); }
    27662814        | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt
    27672815                { $$ = $1->set_last( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); }
     
    27852833        ;
    27862834
    2787 // *******************
    2788 // Function parameters
    2789 // *******************
     2835// ************************** FUNCTION PARAMETERS *******************************
    27902836
    27912837parameter_list_ellipsis_opt:
     
    28102856cfa_parameter_list_ellipsis_opt:                                                // CFA, abstract + real
    28112857        // empty
    2812                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     2858                { $$ = DeclarationNode::newFromTypeData( build_basic_type( DeclarationNode::Void ) ); }
    28132859        | ELLIPSIS
    28142860                { $$ = nullptr; }
     
    28682914        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    28692915                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    2870         | cfa_function_specifier
     2916        | cfa_function_specifier                                                        // int f( "int fp()" );
    28712917        ;
    28722918
     
    28782924        | type_qualifier_list cfa_abstract_tuple
    28792925                { $$ = $2->addQualifiers( $1 ); }
    2880         | cfa_abstract_function
     2926        | cfa_abstract_function                                                         // int f( "int ()" );
    28812927        ;
    28822928
     
    29282974        | initializer
    29292975        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    2930         | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
    2931         | initializer_list_opt ',' designation initializer { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); }
     2976        | initializer_list_opt ',' initializer          { $$ = $1->set_last( $3 ); }
     2977        | initializer_list_opt ',' designation initializer { $$ = $1->set_last( $4->set_designators( $3 ) ); }
    29322978        ;
    29332979
     
    29512997        designator
    29522998        | designator_list designator
    2953                 { $$ = (ExpressionNode *)($1->set_last( $2 )); }
     2999                { $$ = $1->set_last( $2 ); }
    29543000        //| designator_list designator                                          { $$ = new ExpressionNode( $1, $2 ); }
    29553001        ;
     
    30363082                { $$ = ast::TypeDecl::Dtype; }
    30373083        | '*'
    3038                 { $$ = ast::TypeDecl::DStype; }                                         // dtype + sized
    3039         // | '(' '*' ')'
    3040         //      { $$ = ast::TypeDecl::Ftype; }
     3084                { $$ = ast::TypeDecl::DStype; }                                 // Dtype + sized
     3085        // | '(' '*' ')'                                                                        // Gregor made me do it
     3086        //      { $$ = ast::TypeDecl::Ftype; }
    30413087        | ELLIPSIS
    30423088                { $$ = ast::TypeDecl::Ttype; }
     
    30803126        | assignment_expression
    30813127        | type_list ',' type
    3082                 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
     3128                { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
    30833129        | type_list ',' assignment_expression
    3084                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     3130                { $$ = $1->set_last( $3 ); }
    30853131        ;
    30863132
     
    32443290                        $$ = $6;
    32453291                }
    3246         // global distribution
     3292                // global distribution
    32473293        | type_qualifier_list
    32483294                {
     
    33693415        ;
    33703416
     3417// **************************** ASM *****************************
     3418
    33713419asm_name_opt:                                                                                   // GCC
    33723420        // empty
     
    33793427                }
    33803428        ;
     3429
     3430// **************************** ATTRIBUTE *****************************
    33813431
    33823432attribute_list_opt:                                                                             // GCC
     
    37423792                { $$ = $1->addQualifiers( $2 ); }
    37433793        | '&' MUTEX paren_identifier attribute_list_opt
    3744                 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ),
     3794                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newFromTypeData( build_type_qualifier( ast::CV::Mutex ) ),
    37453795                                                                                                                        OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    37463796        | identifier_parameter_ptr
     
    37933843                { $$ = $1->addQualifiers( $2 ); }
    37943844        | '&' MUTEX typedef_name attribute_list_opt
    3795                 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ),
     3845                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newFromTypeData( build_type_qualifier( ast::CV::Mutex ) ),
    37963846                                                                                                                        OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    37973847        | type_parameter_ptr
     
    38263876
    38273877type_parameter_function:
    3828         typedef_name '(' parameter_list_ellipsis_opt ')' // empty parameter list OBSOLESCENT (see 3)
     3878        typedef_name '(' parameter_list_ellipsis_opt ')'        // empty parameter list OBSOLESCENT (see 3)
    38293879                { $$ = $1->addParamList( $3 ); }
    38303880        | '(' type_parameter_ptr ')' '(' parameter_list_ellipsis_opt ')' // empty parameter list OBSOLESCENT (see 3)
     
    38763926
    38773927abstract_function:
    3878         '(' parameter_list_ellipsis_opt ')'                     // empty parameter list OBSOLESCENT (see 3)
     3928        '(' parameter_list_ellipsis_opt ')'                                     // empty parameter list OBSOLESCENT (see 3)
    38793929                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    38803930        | '(' abstract_ptr ')' '(' parameter_list_ellipsis_opt ')' // empty parameter list OBSOLESCENT (see 3)
     
    39153965        | assignment_expression upupeq assignment_expression
    39163966        | array_type_list ',' basic_type_name
    3917                 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
     3967                { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
    39183968        | array_type_list ',' type_name
    3919                 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
     3969                { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
    39203970        | array_type_list ',' assignment_expression upupeq assignment_expression
    39213971        ;
     
    39774027        abstract_parameter_ptr
    39784028        | '&' MUTEX attribute_list_opt
    3979                 { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); }
     4029                { $$ = DeclarationNode::newPointer( DeclarationNode::newFromTypeData( build_type_qualifier( ast::CV::Mutex ) ), OperKinds::AddressOf )->addQualifiers( $3 ); }
    39804030        | abstract_parameter_array attribute_list_opt
    39814031                { $$ = $1->addQualifiers( $2 ); }
     
    40084058
    40094059abstract_parameter_function:
    4010         '(' parameter_list_ellipsis_opt ')'                     // empty parameter list OBSOLESCENT (see 3)
     4060        '(' parameter_list_ellipsis_opt ')'                                     // empty parameter list OBSOLESCENT (see 3)
    40114061                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    40124062        | '(' abstract_parameter_ptr ')' '(' parameter_list_ellipsis_opt ')' // empty parameter list OBSOLESCENT (see 3)
     
    42804330// mode: c++ //
    42814331// tab-width: 4 //
    4282 // compile-command: "make install" //
     4332// compile-command: "bison -Wcounterexamples parser.yy" //
    42834333// End: //
Note: See TracChangeset for help on using the changeset viewer.