Changes in / [b726084:84118d8]


Ignore:
Location:
src
Files:
5 added
12 deleted
62 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rb726084 r84118d8  
    307307                                                } else {
    308308                                                        // no address-of operator, so must be a pointer - add dereference
    309                                                         // NOTE: if the assertion starts to trigger, check that the application expr isn't being shared.
    310                                                         // Since its arguments are modified here, this assertion most commonly triggers when the application
    311                                                         // is visited multiple times.
    312309                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    313310                                                        newExpr->get_args().push_back( *arg );
    314                                                         Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
    315                                                         assertf( type, "First argument to a derefence must be a pointer. Ensure that expressions are not being shared." );
    316                                                         newExpr->set_result( type->clone() );
     311                                                        assert( (*arg)->get_results().size() == 1 );
     312                                                        Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() );
     313                                                        assert( type );
     314                                                        newExpr->get_results().push_back( type->clone() );
    317315                                                        *arg = newExpr;
    318316                                                } // if
     
    529527                extension( castExpr );
    530528                output << "(";
    531                 if ( castExpr->get_result()->isVoid() ) {
     529                if ( castExpr->get_results().empty() ) {
    532530                        output << "(void)" ;
    533                 } else if ( ! castExpr->get_result()->get_isLvalue() ) {
     531                } else if ( ! castExpr->get_results().front()->get_isLvalue() ) {
    534532                        // at least one result type of cast, but not an lvalue
    535533                        output << "(";
    536                         output << genType( castExpr->get_result(), "" );
     534                        output << genType( castExpr->get_results().front(), "" );
    537535                        output << ")";
    538536                } else {
     
    642640        }
    643641
    644         void CodeGenerator::visit( TupleExpr * tupleExpr ) { assert( false ); }
     642        void CodeGenerator::visit( TupleExpr * tupleExpr ) {}
    645643
    646644        void CodeGenerator::visit( TypeExpr * typeExpr ) {}
     
    656654                asmExpr->get_operand()->accept( *this );
    657655                output << " )";
    658         }
    659 
    660         void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) {
    661                 assert( compLitExpr->get_type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) );
    662                 output << "(" << genType( compLitExpr->get_type(), "" ) << ")";
    663                 compLitExpr->get_initializer()->accept( *this );
    664         }
    665 
    666         void CodeGenerator::visit( StmtExpr * stmtExpr ) {
    667                 std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
    668                 output << "({" << std::endl;
    669                 cur_indent += CodeGenerator::tabsize;
    670                 unsigned int numStmts = stmts.size();
    671                 unsigned int i = 0;
    672                 for ( Statement * stmt : stmts ) {
    673                         output << indent << printLabels( stmt->get_labels() );
    674                         if ( i+1 == numStmts ) {
    675                                 // last statement in a statement expression needs to be handled specially -
    676                                 // cannot cast to void, otherwise the expression statement has no value
    677                                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) {
    678                                         exprStmt->get_expr()->accept( *this );
    679                                         output << ";" << endl;
    680                                         ++i;
    681                                         break;
    682                                 }
    683                         }
    684                         stmt->accept( *this );
    685                         output << endl;
    686                         if ( wantSpacing( stmt ) ) {
    687                                 output << endl;
    688                         } // if
    689                         ++i;
    690                 }
    691                 cur_indent -= CodeGenerator::tabsize;
    692                 output << indent << "})";
    693656        }
    694657
  • src/CodeGen/CodeGenerator.h

    rb726084 r84118d8  
    7070                virtual void visit( ConditionalExpr *conditionalExpr );
    7171                virtual void visit( CommaExpr *commaExpr );
    72                 virtual void visit( CompoundLiteralExpr *compLitExpr );
    7372                virtual void visit( TupleExpr *tupleExpr );
    7473                virtual void visit( TypeExpr *typeExpr );
    7574                virtual void visit( AsmExpr * );
    76                 virtual void visit( StmtExpr * );
    7775
    7876                //*** Statements
  • src/CodeGen/GenType.cc

    rb726084 r84118d8  
    227227                        typeString = "_Atomic " + typeString;
    228228                } // if
     229                if ( type->get_isAttribute() ) {
     230                        typeString = "__attribute(( )) " + typeString;
     231                } // if
    229232        }
    230233} // namespace CodeGen
  • src/Common/utility.h

    rb726084 r84118d8  
    148148}
    149149
    150 // replace element of list with all elements of another list
    151150template< typename T >
    152151void replace( std::list< T > &org, typename std::list< T >::iterator pos, std::list< T > &with ) {
     
    159158
    160159        return;
    161 }
    162 
    163 // replace range of a list with a single element
    164 template< typename T >
    165 void replace( std::list< T > &org, typename std::list< T >::iterator begin, typename std::list< T >::iterator end, const T & with ) {
    166         org.insert( begin, with );
    167         org.erase( begin, end );
    168160}
    169161
  • src/ControlStruct/Mutate.cc

    rb726084 r84118d8  
    2323#include "MLEMutator.h"
    2424#include "ForExprMutator.h"
     25#include "LabelTypeChecker.h"
    2526//#include "ExceptMutator.h"
    2627
     
    4041
    4142                //ExceptMutator exc;
     43                // LabelTypeChecker lbl;
    4244
    4345                mutateAll( translationUnit, formut );
    4446                acceptAll( translationUnit, lfix );
    4547                //mutateAll( translationUnit, exc );
     48                //acceptAll( translationUnit, lbl );
    4649        }
    4750} // namespace CodeGen
  • src/ControlStruct/module.mk

    rb726084 r84118d8  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    1919        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc
     21        ControlStruct/ForExprMutator.cc \
     22        ControlStruct/LabelTypeChecker.cc
    2223
  • src/GenPoly/Box.cc

    rb726084 r84118d8  
    113113                        void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars );
    114114                        /// Stores assignment operators from assertion list in local map of assignment operations
    115                         void findTypeOps( const Type::ForallList &forall );
     115                        void findTypeOps( const std::list< TypeDecl *> &forall );
    116116                        void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars );
    117117                        FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars );
     
    619619                }
    620620
    621                 void Pass1::findTypeOps( const Type::ForallList &forall ) {
     621                void Pass1::findTypeOps( const std::list< TypeDecl *> &forall ) {
    622622                        // what if a nested function uses an assignment operator?
    623623                        // assignOps.clear();
    624                         for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     624                        for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    625625                                for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
    626626                                        std::string typeName;
     
    687687                                std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    688688                                std::list< FunctionType *> functions;
    689                                 for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     689                                for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    690690                                        for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    691691                                                findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter );
     
    789789
    790790                        // add size/align for generic types to parameter list
    791                         if ( ! appExpr->get_function()->has_result() ) return;
    792                         FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() );
     791                        if ( appExpr->get_function()->get_results().empty() ) return;
     792                        FunctionType *funcType = getFunctionType( appExpr->get_function()->get_results().front() );
    793793                        assert( funcType );
    794794
     
    806806                        for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
    807807                                VariableExpr *fnArgBase = getBaseVar( *fnArg );
    808                                 if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results
    809                                 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result(), arg, exprTyVars, seenTypes );
     808                                if ( ! fnArgBase || fnArgBase->get_results().empty() ) continue;
     809                                passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_results().front(), arg, exprTyVars, seenTypes );
    810810                        }
    811811                }
     
    897897                        Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
    898898                        appExpr->get_args().push_front( new CastExpr( appExpr->get_function(), adapteeType ) );
    899                         appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr
     899                        appExpr->set_function( new NameExpr( adapterName ) );
    900900
    901901                        return ret;
     
    903903
    904904                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    905                         assert( arg->has_result() );
     905                        assert( ! arg->get_results().empty() );
    906906                        if ( isPolyType( param, exprTyVars ) ) {
    907                                 if ( isPolyType( arg->get_result() ) ) {
     907                                if ( isPolyType( arg->get_results().front() ) ) {
    908908                                        // if the argument's type is polymorphic, we don't need to box again!
    909909                                        return;
    910                                 } else if ( arg->get_result()->get_isLvalue() ) {
     910                                } else if ( arg->get_results().front()->get_isLvalue() ) {
    911911                                        // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
    912912                                        // xxx - need to test that this code is still reachable
     
    953953                void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    954954                        std::list< Expression *>::iterator cur = arg;
    955                         for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     955                        for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    956956                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    957957                                        InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
     
    994994                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    995995                                        deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    996                                         deref->set_result( arg->get_type()->clone() );
     996                                        deref->get_results().push_back( arg->get_type()->clone() );
    997997                                        return deref;
    998998                                } // if
     
    10201020                        Statement *bodyStmt;
    10211021
    1022                         Type::ForallList::iterator tyArg = realType->get_forall().begin();
    1023                         Type::ForallList::iterator tyParam = adapterType->get_forall().begin();
    1024                         Type::ForallList::iterator realTyParam = adaptee->get_forall().begin();
     1022                        std::list< TypeDecl *>::iterator tyArg = realType->get_forall().begin();
     1023                        std::list< TypeDecl *>::iterator tyParam = adapterType->get_forall().begin();
     1024                        std::list< TypeDecl *>::iterator realTyParam = adaptee->get_forall().begin();
    10251025                        for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
    10261026                                assert( tyArg != realType->get_forall().end() );
     
    10711071                        std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    10721072                        std::list< FunctionType *> functions;
    1073                         for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     1073                        for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    10741074                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    10751075                                        findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
     
    11311131                        } // if
    11321132                        addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) );
    1133                         addAssign->set_result( appExpr->get_result()->clone() );
     1133                        addAssign->get_results().front() = appExpr->get_results().front()->clone();
    11341134                        if ( appExpr->get_env() ) {
    11351135                                addAssign->set_env( appExpr->get_env() );
     
    11451145                                if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
    11461146                                        if ( varExpr->get_var()->get_name() == "?[?]" ) {
    1147                                                 assert( appExpr->has_result() );
     1147                                                assert( ! appExpr->get_results().empty() );
    11481148                                                assert( appExpr->get_args().size() == 2 );
    1149                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
    1150                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
     1149                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     1150                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
    11511151                                                assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers
    11521152                                                UntypedExpr *ret = 0;
     
    11681168                                                } // if
    11691169                                                if ( baseType1 || baseType2 ) {
    1170                                                         ret->set_result( appExpr->get_result()->clone() );
     1170                                                        ret->get_results().push_front( appExpr->get_results().front()->clone() );
    11711171                                                        if ( appExpr->get_env() ) {
    11721172                                                                ret->set_env( appExpr->get_env() );
     
    11781178                                                } // if
    11791179                                        } else if ( varExpr->get_var()->get_name() == "*?" ) {
    1180                                                 assert( appExpr->has_result() );
     1180                                                assert( ! appExpr->get_results().empty() );
    11811181                                                assert( ! appExpr->get_args().empty() );
    1182                                                 if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
     1182                                                if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) {
    11831183                                                        Expression *ret = appExpr->get_args().front();
    1184                                                         delete ret->get_result();
    1185                                                         ret->set_result( appExpr->get_result()->clone() );
     1184                                                        delete ret->get_results().front();
     1185                                                        ret->get_results().front() = appExpr->get_results().front()->clone();
    11861186                                                        if ( appExpr->get_env() ) {
    11871187                                                                ret->set_env( appExpr->get_env() );
     
    11931193                                                } // if
    11941194                                        } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
    1195                                                 assert( appExpr->has_result() );
     1195                                                assert( ! appExpr->get_results().empty() );
    11961196                                                assert( appExpr->get_args().size() == 1 );
    1197                                                 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
    1198                                                         Type *tempType = appExpr->get_result()->clone();
     1197                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
     1198                                                        Type *tempType = appExpr->get_results().front()->clone();
    11991199                                                        if ( env ) {
    12001200                                                                env->apply( tempType );
     
    12131213                                                } // if
    12141214                                        } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
    1215                                                 assert( appExpr->has_result() );
     1215                                                assert( ! appExpr->get_results().empty() );
    12161216                                                assert( appExpr->get_args().size() == 1 );
    1217                                                 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
     1217                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
    12181218                                                        return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" );
    12191219                                                } // if
    12201220                                        } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
    1221                                                 assert( appExpr->has_result() );
     1221                                                assert( ! appExpr->get_results().empty() );
    12221222                                                assert( appExpr->get_args().size() == 2 );
    1223                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
    1224                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
     1223                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     1224                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
    12251225                                                if ( baseType1 && baseType2 ) {
    12261226                                                        UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
    12271227                                                        divide->get_args().push_back( appExpr );
    12281228                                                        divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    1229                                                         divide->set_result( appExpr->get_result()->clone() );
     1229                                                        divide->get_results().push_front( appExpr->get_results().front()->clone() );
    12301230                                                        if ( appExpr->get_env() ) {
    12311231                                                                divide->set_env( appExpr->get_env() );
     
    12451245                                                } // if
    12461246                                        } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
    1247                                                 assert( appExpr->has_result() );
     1247                                                assert( ! appExpr->get_results().empty() );
    12481248                                                assert( appExpr->get_args().size() == 2 );
    1249                                                 Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env );
     1249                                                Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env );
    12501250                                                if ( baseType ) {
    12511251                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
     
    12731273                        useRetval = oldUseRetval;
    12741274
    1275                         assert( appExpr->get_function()->has_result() );
    1276                         PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
    1277                         FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
     1275                        assert( ! appExpr->get_function()->get_results().empty() );
     1276                        PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
     1277                        assert( pointer );
     1278                        FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
     1279                        assert( function );
    12781280
    12791281                        if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
     
    13131315
    13141316                Expression *Pass1::mutate( UntypedExpr *expr ) {
    1315                         if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
     1317                        if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
    13161318                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13171319                                        if ( name->get_name() == "*?" ) {
     
    13271329
    13281330                Expression *Pass1::mutate( AddressExpr *addrExpr ) {
    1329                         assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );
     1331                        assert( ! addrExpr->get_arg()->get_results().empty() );
    13301332
    13311333                        bool needs = false;
    13321334                        if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
    1333                                 if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
     1335                                if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
    13341336                                        if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13351337                                                if ( name->get_name() == "*?" ) {
    13361338                                                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
    1337                                                                 assert( appExpr->get_function()->has_result() );
    1338                                                                 PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
    1339                                                                 FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
     1339                                                                assert( ! appExpr->get_function()->get_results().empty() );
     1340                                                                PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
     1341                                                                assert( pointer );
     1342                                                                FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
     1343                                                                assert( function );
    13401344                                                                needs = needsAdapter( function, scopeTyVars );
    13411345                                                        } // if
     
    13461350                        // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
    13471351                        // out of the if condition.
    1348                         bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
     1352                        bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env );
    13491353                        addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
    13501354                        if ( polytype || needs ) {
    13511355                                Expression *ret = addrExpr->get_arg();
    1352                                 delete ret->get_result();
    1353                                 ret->set_result( addrExpr->get_result()->clone() );
     1356                                delete ret->get_results().front();
     1357                                ret->get_results().front() = addrExpr->get_results().front()->clone();
    13541358                                addrExpr->set_arg( 0 );
    13551359                                delete addrExpr;
     
    13891393                Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
    13901394                        if ( retval && returnStmt->get_expr() ) {
    1391                                 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
     1395                                assert( ! returnStmt->get_expr()->get_results().empty() );
    13921396                                // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous.
    13931397                                // if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) {
     
    14231427                                        // find each of its needed secondary assignment operators
    14241428                                        std::list< Expression* > &tyParams = refType->get_parameters();
    1425                                         Type::ForallList &forallParams = functionDecl->get_type()->get_forall();
     1429                                        std::list< TypeDecl* > &forallParams = functionDecl->get_type()->get_forall();
    14261430                                        std::list< Expression* >::const_iterator tyIt = tyParams.begin();
    1427                                         Type::ForallList::const_iterator forallIt = forallParams.begin();
     1431                                        std::list< TypeDecl* >::const_iterator forallIt = forallParams.begin();
    14281432                                        for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) {
    14291433                                                // Add appropriate mapping to assignment expression environment
     
    14691473                                // replace return statement with appropriate assignment to out parameter
    14701474                                Expression *retParm = new NameExpr( retval->get_name() );
    1471                                 retParm->set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
     1475                                retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
    14721476                                assignExpr->get_args().push_back( retParm );
    14731477                                assignExpr->get_args().push_back( returnStmt->get_expr() );
     
    15991603                        ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0,
    16001604                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    1601                         for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
     1605                        for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    16021606                                ObjectDecl *sizeParm, *alignParm;
    16031607                                // add all size and alignment parameters to parameter list
  • src/GenPoly/CopyParams.cc

    rb726084 r84118d8  
    5454                                std::map< std::string, DeclarationWithType* > assignOps;
    5555                                // assume the assignment operator is the first assert param after any "type" parameter
    56                                 for ( Type::ForallList::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
     56                                for ( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
    5757                                        if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
    5858                                                assert( !(*tyVar)->get_assertions().empty() );
  • src/GenPoly/FindFunction.cc

    rb726084 r84118d8  
    2929                virtual Type *mutate( PointerType *pointerType );
    3030          private:
    31                 void handleForall( const Type::ForallList &forall );
     31                void handleForall( const std::list< TypeDecl* > &forall );
    3232
    3333                std::list< FunctionType* > &functions;
     
    5151        }
    5252
    53         void FindFunction::handleForall( const Type::ForallList &forall ) {
    54                 for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     53        void FindFunction::handleForall( const std::list< TypeDecl* > &forall ) {
     54                for ( std::list< TypeDecl* >::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    5555                        TyVarMap::iterator var = tyVars.find( (*i)->get_name() );
    5656                        if ( var != tyVars.end() ) {
  • src/GenPoly/GenPoly.cc

    rb726084 r84118d8  
    110110        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) {
    111111                if ( function->get_returnVals().empty() ) return 0;
    112 
     112               
    113113                return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
    114114        }
     
    127127//              } // if
    128128                if ( isDynRet( adaptee, tyVars ) ) return true;
    129 
     129               
    130130                for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    131131//                      if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
     
    228228
    229229        void makeTyVarMap( Type *type, TyVarMap &tyVarMap ) {
    230                 for ( Type::ForallList::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
     230                for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
    231231                        assert( *tyVar );
    232232                        tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
  • src/GenPoly/Lvalue.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Lvalue.cc --
     7// Lvalue.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    4141                  public:
    4242                        Pass1();
    43 
     43 
    4444                        virtual Expression *mutate( ApplicationExpr *appExpr );
    4545                        virtual Statement *mutate( ReturnStmt *appExpr );
     
    5555                  private:
    5656                };
    57 
    58                 /// GCC-like Generalized Lvalues (which have since been removed from GCC)
    59                 /// https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html#Lvalues
    60                 /// Replaces &(a,b) with (a, &b), &(a ? b : c) with (a ? &b : &c)
    61                 class GeneralizedLvalue : public Mutator {
    62                         typedef Mutator Parent;
    63 
    64                         virtual Expression * mutate( AddressExpr * addressExpr );
    65                 };
    6657        } // namespace
    6758
     
    6960                Pass1 p1;
    7061                Pass2 p2;
    71                 GeneralizedLvalue genLval;
    7262                mutateAll( translationUnit, p1 );
    7363                acceptAll( translationUnit, p2 );
    74                 mutateAll( translationUnit, genLval );
    7564        }
    7665
     
    11099                        appExpr->get_function()->acceptMutator( *this );
    111100                        mutateAll( appExpr->get_args(), *this );
     101 
     102                        assert( ! appExpr->get_function()->get_results().empty() );
    112103
    113                         PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    114                         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     104                        PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     105                        assert( pointer );
     106                        FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     107                        assert( function );
    115108
    116109                        Type *funType = isLvalueRet( function );
    117110                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
    118111                                Expression *expr = appExpr;
    119                                 Type *appType = appExpr->get_result();
     112                                Type *appType = appExpr->get_results().front();
    120113                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    121114                                        // make sure cast for polymorphic type is inside dereference
     
    123116                                }
    124117                                UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    125                                 deref->set_result( appType->clone() );
    126                                 appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) );
     118                                deref->get_results().push_back( appType->clone() );
     119                                appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType );
    127120                                deref->get_args().push_back( expr );
    128121                                return deref;
     
    134127                Statement * Pass1::mutate(ReturnStmt *retStmt) {
    135128                        if ( retval && retStmt->get_expr() ) {
    136                                 if ( retStmt->get_expr()->get_result()->get_isLvalue() ) {
     129                                assert( ! retStmt->get_expr()->get_results().empty() );
     130                                if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
    137131                                        // ***** Code Removal ***** because casts may be stripped already
    138132
     
    161155                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    162156                        } // if
    163 
     157 
    164158                        Visitor::visit( funType );
    165                 }
    166 
    167                 Expression * GeneralizedLvalue::mutate( AddressExpr * addrExpr ) {
    168                         addrExpr = safe_dynamic_cast< AddressExpr * >( Parent::mutate( addrExpr ) );
    169                         if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( addrExpr->get_arg() ) ) {
    170                                 Expression * arg1 = commaExpr->get_arg1()->clone();
    171                                 Expression * arg2 = commaExpr->get_arg2()->clone();
    172                                 delete addrExpr;
    173                                 return new CommaExpr( arg1, new AddressExpr( arg2 ) );
    174                         } else if ( ConditionalExpr * condExpr = dynamic_cast< ConditionalExpr * >( addrExpr->get_arg() ) ) {
    175                                 Expression * arg1 = condExpr->get_arg1()->clone();
    176                                 Expression * arg2 = condExpr->get_arg2()->clone();
    177                                 Expression * arg3 = condExpr->get_arg3()->clone();
    178                                 delete addrExpr;
    179                                 return new ConditionalExpr( arg1, new AddressExpr( arg2 ), new AddressExpr( arg3 ) );
    180                         }
    181                         return addrExpr;
    182159                }
    183160        } // namespace
  • src/GenPoly/Specialize.cc

    rb726084 r84118d8  
    148148
    149149        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
    150                 assertf( actual->has_result(), "attempting to specialize an untyped expression" );
    151                 if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
     150                assert( ! actual->get_results().empty() ); // using front, should have this assert
     151                if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
    152152                        FunctionType *funType;
    153153                        if ( ( funType = getFunctionType( formalType ) ) ) {
     
    172172        void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
    173173                // create thunks for the explicit parameters
    174                 assert( appExpr->get_function()->has_result() );
    175                 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
     174                assert( ! appExpr->get_function()->get_results().empty() );
     175                FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() );
    176176                assert( function );
    177177                std::list< DeclarationWithType* >::iterator formal;
     
    201201        Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    202202                addrExpr->get_arg()->acceptMutator( *this );
    203                 assert( addrExpr->has_result() );
    204                 addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
     203                assert( ! addrExpr->get_results().empty() );
     204                addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
    205205                return addrExpr;
    206206        }
     
    208208        Expression * Specialize::mutate( CastExpr *castExpr ) {
    209209                castExpr->get_arg()->acceptMutator( *this );
    210                 if ( castExpr->get_result()->isVoid() ) {
     210                if ( castExpr->get_results().empty() ) {
    211211                        // can't specialize if we don't have a return value
    212212                        return castExpr;
    213213                }
    214                 Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
     214                Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
    215215                if ( specialized != castExpr->get_arg() ) {
    216216                        // assume here that the specialization incorporates the cast
  • src/InitTweak/FixInit.cc

    rb726084 r84118d8  
    1818#include <iterator>
    1919#include <algorithm>
    20 #include <unordered_map>
    21 #include <unordered_set>
    2220#include "InitTweak.h"
    2321#include "FixInit.h"
     
    3735#include "GenPoly/DeclMutator.h"
    3836#include "SynTree/AddStmtVisitor.h"
    39 #include "CodeGen/GenType.h"  // for warning/error messages
    40 
    41 bool ctordtorp = false; // print all debug
    42 bool ctorp = false; // print ctor debug
    43 bool cpctorp = false; // print copy ctor debug
    44 bool dtorp = false; // print dtor debug
     37#include "CodeGen/GenType.h"  // for warnings
     38
     39bool ctordtorp = false;
     40bool ctorp = false;
     41bool cpctorp = false;
     42bool dtorp = false;
    4543#define PRINT( text ) if ( ctordtorp ) { text }
    4644#define CP_CTOR_PRINT( text ) if ( ctordtorp || cpctorp ) { text }
     
    4947namespace InitTweak {
    5048        namespace {
     49                const std::list<Label> noLabels;
     50                const std::list<Expression*> noDesignators;
     51
    5152                class InsertImplicitCalls final : public GenPoly::PolyMutator {
    5253                public:
     
    6667                        static void resolveImplicitCalls( std::list< Declaration * > & translationUnit );
    6768
    68                         typedef SymTab::Indexer Parent;
    69                         using Parent::visit;
    70 
     69                        using SymTab::Indexer::visit;
    7170                        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) override;
    72                         virtual void visit( UniqueExpr * unqExpr );
    7371
    7472                        /// create and resolve ctor/dtor expression: fname(var, [cpArg])
    75                         Expression * makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg = NULL );
    76                         Expression * makeCtorDtor( const std::string & fname, Expression * thisArg, Expression * cpArg = NULL );
     73                        ApplicationExpr * makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg = NULL );
    7774                        /// true if type does not need to be copy constructed to ensure correctness
    78                         bool skipCopyConstruct( Type * type );
    79                         void copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr );
    80                         void destructRet( Expression * ret, ImplicitCopyCtorExpr * impCpCtorExpr );
     75                        bool skipCopyConstruct( Type * );
    8176                private:
    8277                        TypeSubstitution * env;
     
    188183                        using GenPoly::PolyMutator::mutate;
    189184                        virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) override;
    190                         virtual Expression * mutate( UniqueExpr * unqExpr ) override;
    191185                };
    192186
     
    374368                }
    375369
    376                 Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
     370                ApplicationExpr * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
    377371                        assert( var );
    378                         return makeCtorDtor( fname, new AddressExpr( new VariableExpr( var ) ), cpArg );
    379                 }
    380 
    381                 Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, Expression * thisArg, Expression * cpArg ) {
    382                         assert( thisArg );
    383372                        UntypedExpr * untyped = new UntypedExpr( new NameExpr( fname ) );
    384                         untyped->get_args().push_back( thisArg );
     373                        untyped->get_args().push_back( new AddressExpr( new VariableExpr( var ) ) );
    385374                        if (cpArg) untyped->get_args().push_back( cpArg->clone() );
    386375
     
    389378                        // (VariableExpr and already resolved expression)
    390379                        CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << untyped << std::endl; )
    391                         Expression * resolved = ResolvExpr::findVoidExpression( untyped, *this );
    392                         assert( resolved );
     380                        ApplicationExpr * resolved = dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untyped, *this ) );
    393381                        if ( resolved->get_env() ) {
    394382                                env->add( *resolved->get_env() );
    395383                        } // if
    396384
     385                        assert( resolved );
    397386                        delete untyped;
    398387                        return resolved;
    399388                }
    400389
    401                 void ResolveCopyCtors::copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr ) {
     390                void ResolveCopyCtors::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
    402391                        static UniqueName tempNamer("_tmp_cp");
    403                         CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
    404                         assert( arg->has_result() );
    405                         Type * result = arg->get_result();
    406                         if ( skipCopyConstruct( result ) ) return; // skip certain non-copyable types
    407 
    408                         // type may involve type variables, so apply type substitution to get temporary variable's actual type
    409                         result = result->clone();
    410                         impCpCtorExpr->get_env()->apply( result );
    411                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
    412                         tmp->get_type()->set_isConst( false );
    413 
    414                         // create and resolve copy constructor
    415                         CP_CTOR_PRINT( std::cerr << "makeCtorDtor for an argument" << std::endl; )
    416                         Expression * cpCtor = makeCtorDtor( "?{}", tmp, arg );
    417 
    418                         if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( cpCtor ) ) {
     392                        static UniqueName retNamer("_tmp_cp_ret");
     393
     394                        CP_CTOR_PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; )
     395                        Visitor::visit( impCpCtorExpr );
     396                        env = impCpCtorExpr->get_env(); // xxx - maybe we really should just have a PolyIndexer...
     397
     398                        ApplicationExpr * appExpr = impCpCtorExpr->get_callExpr();
     399
     400                        // take each argument and attempt to copy construct it.
     401                        for ( Expression * & arg : appExpr->get_args() ) {
     402                                CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
     403                                // xxx - need to handle tuple arguments
     404                                assert( ! arg->get_results().empty() );
     405                                Type * result = arg->get_results().front();
     406                                if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types
     407                                // type may involve type variables, so apply type substitution to get temporary variable's actual type
     408                                result = result->clone();
     409                                impCpCtorExpr->get_env()->apply( result );
     410                                ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
     411                                tmp->get_type()->set_isConst( false );
     412
     413                                // create and resolve copy constructor
     414                                CP_CTOR_PRINT( std::cerr << "makeCtorDtor for an argument" << std::endl; )
     415                                ApplicationExpr * cpCtor = makeCtorDtor( "?{}", tmp, arg );
     416
    419417                                // if the chosen constructor is intrinsic, the copy is unnecessary, so
    420418                                // don't create the temporary and don't call the copy constructor
    421                                 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() );
     419                                VariableExpr * function = dynamic_cast< VariableExpr * >( cpCtor->get_function() );
    422420                                assert( function );
    423                                 if ( function->get_var()->get_linkage() == LinkageSpec::Intrinsic ) return;
    424                         }
    425 
    426                         // replace argument to function call with temporary
    427                         arg = new CommaExpr( cpCtor, new VariableExpr( tmp ) );
    428                         impCpCtorExpr->get_tempDecls().push_back( tmp );
    429                         impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", tmp ) );
    430                 }
    431 
    432                 void ResolveCopyCtors::destructRet( Expression * ret, ImplicitCopyCtorExpr * impCpCtorExpr ) {
    433                         impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", new AddressExpr( ret ) ) );
    434                 }
    435 
    436                 void ResolveCopyCtors::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
    437                         CP_CTOR_PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; )
    438                         Parent::visit( impCpCtorExpr );
    439                         env = impCpCtorExpr->get_env(); // xxx - maybe we really should just have a PolyIndexer...
    440 
    441                         ApplicationExpr * appExpr = impCpCtorExpr->get_callExpr();
    442 
    443                         // take each argument and attempt to copy construct it.
    444                         for ( Expression * & arg : appExpr->get_args() ) {
    445                                 copyConstructArg( arg, impCpCtorExpr );
     421                                if ( function->get_var()->get_linkage() != LinkageSpec::Intrinsic ) {
     422                                        // replace argument to function call with temporary
     423                                        arg = new CommaExpr( cpCtor, new VariableExpr( tmp ) );
     424                                        impCpCtorExpr->get_tempDecls().push_back( tmp );
     425                                        impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", tmp ) );
     426                                } // if
    446427                        } // for
    447428
     
    453434                        // level. Trying to pass that environment along.
    454435                        callExpr->set_env( impCpCtorExpr->get_env()->clone() );
    455                         Type * result = appExpr->get_result();
    456                         if ( ! result->isVoid() ) {
    457                                 static UniqueName retNamer("_tmp_cp_ret");
     436                        for ( Type * result : appExpr->get_results() ) {
    458437                                result = result->clone();
    459438                                impCpCtorExpr->get_env()->apply( result );
     
    462441                                impCpCtorExpr->get_returnDecls().push_back( ret );
    463442                                CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; )
    464                                 if ( ! result->get_isLvalue() ) {
    465                                         // destructing lvalue returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary
    466                                         destructRet( new VariableExpr( ret ), impCpCtorExpr );
    467                                 }
     443                                impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", ret ) );
    468444                        } // for
    469445                        CP_CTOR_PRINT( std::cerr << "after Resolving: " << impCpCtorExpr << std::endl; )
    470                 }
    471 
    472                 void ResolveCopyCtors::visit( UniqueExpr * unqExpr ) {
    473                         static std::unordered_set< int > vars;
    474                         if ( vars.count( unqExpr->get_id() ) ) {
    475                                 // xxx - hack to prevent double-handling of unique exprs, otherwise too many temporary variables and destructors are generated
    476                                 return;
    477                         }
    478 
    479                         Parent::visit( unqExpr );
    480                         // it should never be necessary to wrap a void-returning expression in a UniqueExpr - if this assumption changes, this needs to be rethought
    481                         assert( unqExpr->get_result() );
    482                         if ( ImplicitCopyCtorExpr * impCpCtorExpr = dynamic_cast<ImplicitCopyCtorExpr*>( unqExpr->get_expr() ) ) {
    483                                 // note the variable used as the result from the call
    484                                 assert( impCpCtorExpr->get_result() && impCpCtorExpr->get_returnDecls().size() == 1 );
    485                                 unqExpr->set_var( new VariableExpr( impCpCtorExpr->get_returnDecls().front() ) );
    486                         } else {
    487                                 // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    488                                 unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
    489                                 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    490                         }
    491                         vars.insert( unqExpr->get_id() );
    492446                }
    493447
     
    536490                                // know the result type of the assignment is the type of the LHS (minus the pointer), so
    537491                                // add that onto the assignment expression so that later steps have the necessary information
    538                                 assign->set_result( returnDecl->get_type()->clone() );
     492                                assign->add_result( returnDecl->get_type()->clone() );
    539493
    540494                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    541                                 if ( callExpr->get_result()->get_isLvalue() ) {
     495                                if ( callExpr->get_results().front()->get_isLvalue() ) {
    542496                                        // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    543497                                        // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
     
    546500                                        // an AddressExpr.  Effectively, this turns
    547501                                        //   lvalue T f();
    548                                         //   &*f();
     502                                        //   &*f()
    549503                                        // into
    550                                         //   T * f();
    551504                                        //   T * tmp_cp_retN;
    552                                         //   &*(tmp_cp_retN = &*f(), tmp_cp_retN);              // the first * and second & are generated here
     505                                        //   tmp_cp_ret_N = &*(tmp_cp_ret_N = &*f(), tmp_cp_ret);
    553506                                        // which work out in terms of types, but is pretty messy. It would be nice to find a better way.
    554507                                        assign->get_args().back() = new AddressExpr( assign->get_args().back() );
    555508
     509                                        Type * resultType = returnDecl->get_type()->clone();
    556510                                        returnDecl->set_type( new PointerType( Type::Qualifiers(), returnDecl->get_type() ) );
    557                                         retExpr->set_result( new PointerType( Type::Qualifiers(), retExpr->get_result() ) );
    558                                         retExpr = UntypedExpr::createDeref( retExpr );
     511                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
     512                                        deref->get_args().push_back( retExpr );
     513                                        deref->add_result( resultType );
     514                                        retExpr = deref;
    559515                                } // if
    560516                                retExpr->set_env( env->clone() );
     
    563519                                return callExpr;
    564520                        } // if
    565                 }
    566 
    567                 Expression * FixCopyCtors::mutate( UniqueExpr * unqExpr ) {
    568                         static std::unordered_map< int, UniqueExpr * > unqMap;
    569                         static std::unordered_set< int > addDeref;
    570                         // has to be done to clean up ImplicitCopyCtorExpr nodes, even when this node was skipped in previous passes
    571                         unqExpr = safe_dynamic_cast< UniqueExpr * >( Parent::mutate( unqExpr ) );
    572                         if ( unqMap.count( unqExpr->get_id() ) ) {
    573                                 // take data from other UniqueExpr to ensure consistency
    574                                 delete unqExpr->get_expr();
    575                                 unqExpr->set_expr( unqMap[unqExpr->get_id()]->get_expr()->clone() );
    576                                 delete unqExpr->get_result();
    577                                 unqExpr->set_result( maybeClone( unqExpr->get_expr()->get_result() ) );
    578                                 if ( addDeref.count( unqExpr->get_id() ) ) {
    579                                         // other UniqueExpr was dereferenced because it was an lvalue return, so this one should be too
    580                                         return UntypedExpr::createDeref( unqExpr );
    581                                 }
    582                                 return unqExpr;
    583                         }
    584                         unqMap[unqExpr->get_id()] = unqExpr;
    585                         if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) {
    586                                 // unique expression is now a dereference, because the inner expression is an lvalue returning function call.
    587                                 // Normalize the expression by dereferencing the unique expression, rather than the inner expression
    588                                 // (i.e. move the dereference out a level)
    589                                 assert( getFunctionName( deref ) == "*?" );
    590                                 unqExpr->set_expr( getCallArg( deref, 0 ) );
    591                                 getCallArg( deref, 0 ) = unqExpr;
    592                                 addDeref.insert( unqExpr->get_id() );
    593                                 return deref;
    594                         }
    595                         return unqExpr;
    596521                }
    597522
     
    1025950                Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    1026951                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    1027                         // xxx - is the size check necessary?
    1028                         assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
    1029                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
     952                        assert( ctorExpr->get_results().size() == 1 );
     953                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr );
    1030954                        addDeclaration( tmp );
    1031955
     
    1039963                        assign->get_args().push_back( new VariableExpr( tmp ) );
    1040964                        assign->get_args().push_back( firstArg );
    1041                         assign->set_result( ctorExpr->get_result()->clone() );
     965                        cloneAll( ctorExpr->get_results(), assign->get_results() );
    1042966                        firstArg = assign;
    1043967
  • src/InitTweak/GenInit.cc

    rb726084 r84118d8  
    2929#include "GenPoly/DeclMutator.h"
    3030#include "GenPoly/ScopedSet.h"
    31 #include "ResolvExpr/typeops.h"
    3231
    3332namespace InitTweak {
     
    5150
    5251          protected:
    53                 FunctionType * ftype;
     52                std::list<DeclarationWithType*> returnVals;
    5453                UniqueName tempNamer;
    5554                std::string funcName;
     
    8786
    8887                bool isManaged( ObjectDecl * objDecl ) const ; // determine if object is managed
    89                 bool isManaged( Type * type ) const; // determine if type is managed
    9088                void handleDWT( DeclarationWithType * dwt ); // add type to managed if ctor/dtor
    9189                GenPoly::ScopedSet< std::string > managedTypes;
     
    138136
    139137        Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) {
    140                 std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
     138                // update for multiple return values
    141139                assert( returnVals.size() == 0 || returnVals.size() == 1 );
    142140                // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address
     
    160158
    161159        DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) {
    162                 // xxx - need to handle named return values - this pass may need to happen
    163                 // after resolution? the ordering is tricky because return statements must be
    164                 // constructed - the simplest way to do that (while also handling multiple
    165                 // returns) is to structure the returnVals into a tuple, as done here.
    166                 // however, if the tuple return value is structured before resolution,
    167                 // it's difficult to resolve named return values, since the name is lost
    168                 // in conversion to a tuple. this might be easiest to deal with
    169                 // after reference types are added, as it may then be possible to
    170                 // uniformly move named return values to the parameter list directly
    171                 ValueGuard< FunctionType * > oldFtype( ftype );
     160                ValueGuard< std::list<DeclarationWithType*> > oldReturnVals( returnVals );
    172161                ValueGuard< std::string > oldFuncName( funcName );
    173162
    174                 ftype = functionDecl->get_functionType();
    175                 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();
    176                 if ( retVals.size() > 1 ) {
    177                         TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    178                         ObjectDecl * newRet = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
    179                         retVals.clear();
    180                         retVals.push_back( newRet );
    181                 }
     163                FunctionType * type = functionDecl->get_functionType();
     164                returnVals = type->get_returnVals();
    182165                funcName = functionDecl->get_name();
    183166                DeclarationWithType * decl = Mutator::mutate( functionDecl );
     
    239222        }
    240223
    241         bool CtorDtor::isManaged( Type * type ) const {
    242                 if ( TupleType * tupleType = dynamic_cast< TupleType * > ( type ) ) {
    243                         // tuple is also managed if any of its components are managed
    244                         if ( std::any_of( tupleType->get_types().begin(), tupleType->get_types().end(), [&](Type * type) { return isManaged( type ); }) ) {
    245                                 return true;
    246                         }
    247                 }
    248                 return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end();
    249         }
    250 
    251224        bool CtorDtor::isManaged( ObjectDecl * objDecl ) const {
    252225                Type * type = objDecl->get_type();
     
    254227                        type = at->get_base();
    255228                }
    256                 return isManaged( type );
     229                return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end();
    257230        }
    258231
     
    265238                        managedTypes.insert( SymTab::Mangler::mangle( type->get_base() ) );
    266239                }
    267         }
    268 
    269         ConstructorInit * genCtorInit( ObjectDecl * objDecl ) {
    270                 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor
    271                 // for each constructable object
    272                 std::list< Statement * > ctor;
    273                 std::list< Statement * > dtor;
    274 
    275                 InitExpander srcParam( objDecl->get_init() );
    276                 InitExpander nullParam( (Initializer *)NULL );
    277                 SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
    278                 SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
    279 
    280                 // Currently genImplicitCall produces a single Statement - a CompoundStmt
    281                 // which  wraps everything that needs to happen. As such, it's technically
    282                 // possible to use a Statement ** in the above calls, but this is inherently
    283                 // unsafe, so instead we take the slightly less efficient route, but will be
    284                 // immediately informed if somehow the above assumption is broken. In this case,
    285                 // we could always wrap the list of statements at this point with a CompoundStmt,
    286                 // but it seems reasonable at the moment for this to be done by genImplicitCall
    287                 // itself. It is possible that genImplicitCall produces no statements (e.g. if
    288                 // an array type does not have a dimension). In this case, it's fine to ignore
    289                 // the object for the purposes of construction.
    290                 assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
    291                 if ( ctor.size() == 1 ) {
    292                         // need to remember init expression, in case no ctors exist
    293                         // if ctor does exist, want to use ctor expression instead of init
    294                         // push this decision to the resolver
    295                         assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
    296                         return new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() );
    297                 }
    298                 return nullptr;
    299240        }
    300241
     
    309250                        if ( ! checkInitDepth( objDecl ) ) throw SemanticError( "Managed object's initializer is too deep ", objDecl );
    310251
    311                         objDecl->set_init( genCtorInit( objDecl ) );
     252                        // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor
     253                        // for each constructable object
     254                        std::list< Statement * > ctor;
     255                        std::list< Statement * > dtor;
     256
     257                        InitExpander srcParam( objDecl->get_init() );
     258                        InitExpander nullParam( (Initializer *)NULL );
     259                        SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
     260                        SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
     261
     262                        // Currently genImplicitCall produces a single Statement - a CompoundStmt
     263                        // which  wraps everything that needs to happen. As such, it's technically
     264                        // possible to use a Statement ** in the above calls, but this is inherently
     265                        // unsafe, so instead we take the slightly less efficient route, but will be
     266                        // immediately informed if somehow the above assumption is broken. In this case,
     267                        // we could always wrap the list of statements at this point with a CompoundStmt,
     268                        // but it seems reasonable at the moment for this to be done by genImplicitCall
     269                        // itself. It is possible that genImplicitCall produces no statements (e.g. if
     270                        // an array type does not have a dimension). In this case, it's fine to ignore
     271                        // the object for the purposes of construction.
     272                        assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
     273                        if ( ctor.size() == 1 ) {
     274                                // need to remember init expression, in case no ctors exist
     275                                // if ctor does exist, want to use ctor expression instead of init
     276                                // push this decision to the resolver
     277                                assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
     278                                objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) );
     279                        }
    312280                }
    313281                return Parent::mutate( objDecl );
     
    322290                managedTypes.beginScope();
    323291                // go through assertions and recursively add seen ctor/dtors
    324                 for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
     292                for ( TypeDecl * tyDecl : functionDecl->get_functionType()->get_forall() ) {
    325293                        for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
    326294                                assertion = assertion->acceptMutator( *this );
  • src/InitTweak/GenInit.h

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // GenInit.h --
     7// RemoveInit.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2727        /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes
    2828        void genInit( std::list< Declaration * > & translationUnit );
    29 
    30         /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer
    31         ConstructorInit * genCtorInit( ObjectDecl * objDecl );
    3229} // namespace
    3330
  • src/InitTweak/InitTweak.cc

    rb726084 r84118d8  
    340340                return allofCtorDtor( stmt, []( Expression * callExpr ){
    341341                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    342                                 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() );
     342                                assert( ! appExpr->get_function()->get_results().empty() );
     343                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() );
    343344                                assert( funcType );
    344345                                return funcType->get_parameters().size() == 1;
     
    387388                                return memberExpr->get_member()->get_name();
    388389                        } else if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * > ( func ) ) {
    389                                 return funcName( memberExpr->get_member() );
     390                                return memberExpr->get_member();
    390391                        } else {
    391392                                assertf( false, "Unexpected expression type being called as a function in call expression" );
     
    450451                // virtual void visit( LogicalExpr *logicalExpr );
    451452                // virtual void visit( ConditionalExpr *conditionalExpr );
     453                virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
     454                virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }
    452455                virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }
    453456                virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }
    454457                virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }
    455458                virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }
    456                 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
    457                 virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }
    458459
    459460                bool isConstExpr;
  • src/Makefile.in

    rb726084 r84118d8  
    105105        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    106106        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
     107        ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT) \
    107108        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    108109        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    189190        SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    190191        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    191         SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT) \
    192192        Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
    193         Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT) \
    194         Tuples/driver_cfa_cpp-Explode.$(OBJEXT)
     193        Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
    195194am_driver_cfa_cpp_OBJECTS = $(am__objects_1)
    196195driver_cfa_cpp_OBJECTS = $(am_driver_cfa_cpp_OBJECTS)
     
    365364        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    366365        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    367         ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
     366        ControlStruct/ForExprMutator.cc \
     367        ControlStruct/LabelTypeChecker.cc GenPoly/Box.cc \
    368368        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    369369        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    404404        SynTree/Initializer.cc SynTree/Visitor.cc SynTree/Mutator.cc \
    405405        SynTree/AddStmtVisitor.cc SynTree/TypeSubstitution.cc \
    406         SynTree/Attribute.cc SynTree/VarExprReplacer.cc \
    407         Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    408         Tuples/Explode.cc
     406        SynTree/Attribute.cc Tuples/TupleAssignment.cc \
     407        Tuples/NameMatcher.cc
    409408MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    410409        ${cfa_cpplib_PROGRAMS}}
     
    542541        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    543542ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT):  \
     543        ControlStruct/$(am__dirstamp) \
     544        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     545ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT):  \
    544546        ControlStruct/$(am__dirstamp) \
    545547        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     
    767769SynTree/driver_cfa_cpp-Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    768770        SynTree/$(DEPDIR)/$(am__dirstamp)
    769 SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT):  \
    770         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    771771Tuples/$(am__dirstamp):
    772772        @$(MKDIR_P) Tuples
     
    777777Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT):  \
    778778        Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    779 Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT):  \
    780         Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    781 Tuples/driver_cfa_cpp-Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
     779Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT): Tuples/$(am__dirstamp) \
    782780        Tuples/$(DEPDIR)/$(am__dirstamp)
    783781driver/$(am__dirstamp):
     
    802800        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
    803801        -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT)
     802        -rm -f ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT)
    804803        -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT)
    805804        -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT)
     
    885884        -rm -f SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT)
    886885        -rm -f SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT)
    887         -rm -f SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT)
    888886        -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
    889887        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
    890888        -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)
    891         -rm -f Tuples/driver_cfa_cpp-Explode.$(OBJEXT)
     889        -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
    892890        -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
    893         -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
    894891
    895892distclean-compile:
     
    910907@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
    911908@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po@am__quote@
     909@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po@am__quote@
    912910@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po@am__quote@
    913911@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@
     
    993991@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po@am__quote@
    994992@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po@am__quote@
    995 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po@am__quote@
    996993@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    997994@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    998995@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
    999 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po@am__quote@
     996@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@
    1000997@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@
    1001 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@
    1002998
    1003999.cc.o:
     
    12411237@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    12421238
     1239ControlStruct/driver_cfa_cpp-LabelTypeChecker.o: ControlStruct/LabelTypeChecker.cc
     1240@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
     1241@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
     1242@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.o' libtool=no @AMDEPBACKSLASH@
     1243@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1244@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
     1245
     1246ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj: ControlStruct/LabelTypeChecker.cc
     1247@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
     1248@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
     1249@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj' libtool=no @AMDEPBACKSLASH@
     1250@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1251@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
     1252
    12431253GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    12441254@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
     
    24172427@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Attribute.obj `if test -f 'SynTree/Attribute.cc'; then $(CYGPATH_W) 'SynTree/Attribute.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Attribute.cc'; fi`
    24182428
    2419 SynTree/driver_cfa_cpp-VarExprReplacer.o: SynTree/VarExprReplacer.cc
    2420 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
    2421 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
    2422 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.o' libtool=no @AMDEPBACKSLASH@
    2423 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2424 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
    2425 
    2426 SynTree/driver_cfa_cpp-VarExprReplacer.obj: SynTree/VarExprReplacer.cc
    2427 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
    2428 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
    2429 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.obj' libtool=no @AMDEPBACKSLASH@
    2430 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2431 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
    2432 
    24332429Tuples/driver_cfa_cpp-TupleAssignment.o: Tuples/TupleAssignment.cc
    24342430@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleAssignment.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Tpo -c -o Tuples/driver_cfa_cpp-TupleAssignment.o `test -f 'Tuples/TupleAssignment.cc' || echo '$(srcdir)/'`Tuples/TupleAssignment.cc
     
    24452441@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi`
    24462442
    2447 Tuples/driver_cfa_cpp-TupleExpansion.o: Tuples/TupleExpansion.cc
    2448 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2449 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2450 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.o' libtool=no @AMDEPBACKSLASH@
    2451 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2452 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2453 
    2454 Tuples/driver_cfa_cpp-TupleExpansion.obj: Tuples/TupleExpansion.cc
    2455 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    2456 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2457 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.obj' libtool=no @AMDEPBACKSLASH@
    2458 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2459 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    2460 
    2461 Tuples/driver_cfa_cpp-Explode.o: Tuples/Explode.cc
    2462 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-Explode.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo -c -o Tuples/driver_cfa_cpp-Explode.o `test -f 'Tuples/Explode.cc' || echo '$(srcdir)/'`Tuples/Explode.cc
    2463 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po
    2464 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/Explode.cc' object='Tuples/driver_cfa_cpp-Explode.o' libtool=no @AMDEPBACKSLASH@
    2465 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2466 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-Explode.o `test -f 'Tuples/Explode.cc' || echo '$(srcdir)/'`Tuples/Explode.cc
    2467 
    2468 Tuples/driver_cfa_cpp-Explode.obj: Tuples/Explode.cc
    2469 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-Explode.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo -c -o Tuples/driver_cfa_cpp-Explode.obj `if test -f 'Tuples/Explode.cc'; then $(CYGPATH_W) 'Tuples/Explode.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/Explode.cc'; fi`
    2470 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po
    2471 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/Explode.cc' object='Tuples/driver_cfa_cpp-Explode.obj' libtool=no @AMDEPBACKSLASH@
    2472 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2473 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-Explode.obj `if test -f 'Tuples/Explode.cc'; then $(CYGPATH_W) 'Tuples/Explode.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/Explode.cc'; fi`
     2443Tuples/driver_cfa_cpp-NameMatcher.o: Tuples/NameMatcher.cc
     2444@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
     2445@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
     2446@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.o' libtool=no @AMDEPBACKSLASH@
     2447@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2448@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
     2449
     2450Tuples/driver_cfa_cpp-NameMatcher.obj: Tuples/NameMatcher.cc
     2451@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
     2452@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
     2453@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.obj' libtool=no @AMDEPBACKSLASH@
     2454@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2455@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
    24742456
    24752457.ll.cc:
  • src/Parser/ExpressionNode.cc

    rb726084 r84118d8  
    172172} // build_constantStr
    173173
    174 Expression * build_field_name_FLOATINGconstant( const std::string & str ) {
    175         // str is of the form A.B -> separate at the . and return member expression
    176         int a, b;
    177         char dot;
    178         std::stringstream ss( str );
    179         ss >> a >> dot >> b;
    180         UntypedMemberExpr * ret = new UntypedMemberExpr(
    181                 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( b ) ) ),
    182                 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( a ) ) ) );
    183         delete &str;
    184         return ret;
    185 } // build_field_name_FLOATINGconstant
    186 
    187 Expression * make_field_name_fraction_constants( Expression * fieldName, Expression * fracts ) {
    188         if ( fracts ) {
    189                 if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * >( fracts ) ) {
    190                         memberExpr->set_member( make_field_name_fraction_constants( fieldName, memberExpr->get_aggregate() ) );
    191                         return memberExpr;
    192                 } else {
    193                         return new UntypedMemberExpr( fracts, fieldName );
    194                 }
    195         }
    196         return fieldName;
    197 } // make_field_name_fraction_constants
    198 
    199 Expression * build_field_name_fraction_constants( Expression * fieldName, ExpressionNode * fracts ) {
    200         return make_field_name_fraction_constants( fieldName, maybeMoveBuild< Expression >( fracts ) );
    201 } // build_field_name_fraction_constants
    202 
    203 Expression * build_field_name_REALFRACTIONconstant( const std::string & str ) {
    204         assert( str[0] == '.' );
    205         Expression * ret = build_constantInteger( *new std::string( str.substr(1) ) );
    206         delete &str;
    207         return ret;
    208 } // build_field_name_REALFRACTIONconstant
    209 
    210 Expression * build_field_name_REALDECIMALconstant( const std::string & str ) {
    211         assert( str[str.size()-1] == '.' );
    212         Expression * ret = build_constantInteger( *new std::string( str.substr( 0, str.size()-1 ) ) );
    213         delete &str;
    214         return ret;
    215 } // build_field_name_REALDECIMALconstant
    216 
    217174NameExpr * build_varref( const string *name, bool labelp ) {
    218175        NameExpr *expr = new NameExpr( *name, nullptr );
     
    241198}
    242199
    243 Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
    244         UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
    245         return ret;
    246 }
    247 
    248 Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) {
     200Expression *build_fieldSel( ExpressionNode *expr_node, NameExpr *member ) {
     201        UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybeMoveBuild< Expression >(expr_node) );
     202        delete member;
     203        return ret;
     204}
     205
     206Expression *build_pfieldSel( ExpressionNode *expr_node, NameExpr *member ) {
    249207        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    250208        deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
    251         UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref );
     209        UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref );
     210        delete member;
    252211        return ret;
    253212}
  • src/Parser/ParseNode.h

    rb726084 r84118d8  
    155155Expression * build_constantChar( const std::string &str );
    156156ConstantExpr * build_constantStr( const std::string &str );
    157 Expression * build_field_name_FLOATINGconstant( const std::string & str );
    158 Expression * build_field_name_fraction_constants( Expression * fieldName, ExpressionNode * fracts );
    159 Expression * build_field_name_REALFRACTIONconstant( const std::string & str );
    160 Expression * build_field_name_REALDECIMALconstant( const std::string & str );
    161157
    162158NameExpr * build_varref( const std::string * name, bool labelp = false );
     
    164160
    165161Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    166 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    167 Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
     162Expression * build_fieldSel( ExpressionNode * expr_node, NameExpr * member );
     163Expression * build_pfieldSel( ExpressionNode * expr_node, NameExpr * member );
    168164Expression * build_addressOf( ExpressionNode * expr_node );
    169165Expression * build_sizeOfexpr( ExpressionNode * expr_node );
     
    387383//##############################################################################
    388384
    389 template< typename SynTreeType, typename NodeType, template< typename, typename...> class Container, typename... Args >
    390 void buildList( const NodeType * firstNode, Container< SynTreeType *, Args... > &outputList ) {
     385template< typename SynTreeType, typename NodeType >
     386void buildList( const NodeType * firstNode, std::list< SynTreeType * > &outputList ) {
    391387        SemanticError errors;
    392         std::back_insert_iterator< Container< SynTreeType *, Args... > > out( outputList );
     388        std::back_insert_iterator< std::list< SynTreeType * > > out( outputList );
    393389        const NodeType * cur = firstNode;
    394390
  • src/Parser/TypeData.cc

    rb726084 r84118d8  
    385385} // TypeData::print
    386386
    387 template< typename ForallList >
    388 void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) {
     387void buildForall( const DeclarationNode * firstNode, list< TypeDecl* > &outputList ) {
    389388        buildList( firstNode, outputList );
    390         for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
    391                 TypeDecl * td = static_cast<TypeDecl*>(*i);
    392                 if ( td->get_kind() == TypeDecl::Any ) {
     389        for ( list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
     390                if ( (*i)->get_kind() == TypeDecl::Any ) {
    393391                        // add assertion parameters to `type' tyvars in reverse order
    394392                        // add dtor:  void ^?{}(T *)
    395393                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    396                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    397                         td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
     394                        dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     395                        (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
    398396
    399397                        // add copy ctor:  void ?{}(T *, T)
    400398                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    401                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    402                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    403                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
     399                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     400                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     401                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
    404402
    405403                        // add default ctor:  void ?{}(T *)
    406404                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    407                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    408                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
     405                        ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     406                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
    409407
    410408                        // add assignment operator:  T * ?=?(T *, T)
    411409                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    412                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    413                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    414                         assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    415                         td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
     410                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     411                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     412                        assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     413                        (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
    416414                } // if
    417415        } // for
     
    517515                // character types. The implementation shall define char to have the same range, representation, and behavior as
    518516                // either signed char or unsigned char.
    519                 static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char };
     517                static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char }; 
    520518
    521519                if ( td->length != DeclarationNode::NoLength ) {
  • src/Parser/parser.cc

    rb726084 r84118d8  
    10261026static const yytype_uint16 yyrline[] =
    10271027{
    1028        0,   305,   305,   309,   316,   317,   318,   319,   320,   324,
    1029      325,   326,   330,   331,   335,   336,   340,   341,   345,   349,
    1030      350,   361,   363,   365,   366,   368,   373,   374,   380,   382,
    1031      384,   386,   388,   390,   392,   394,   396,   398,   407,   408,
    1032      414,   415,   419,   420,   424,   425,   427,   429,   431,   433,
    1033      435,   440,   442,   444,   450,   451,   459,   462,   464,   466,
    1034      471,   484,   486,   488,   490,   492,   494,   496,   498,   500,
    1035      502,   504,   511,   512,   518,   519,   520,   521,   525,   526,
    1036      533,   534,   536,   538,   543,   544,   546,   551,   552,   554,
    1037      559,   560,   562,   564,   566,   571,   572,   574,   579,   580,
    1038      585,   586,   591,   592,   597,   598,   603,   604,   609,   610,
    1039      613,   620,   625,   626,   634,   635,   639,   640,   641,   642,
    1040      643,   644,   645,   646,   647,   648,   649,   650,   660,   662,
    1041      667,   668,   673,   674,   680,   681,   687,   688,   689,   690,
    1042      691,   692,   693,   694,   695,   705,   712,   714,   724,   725,
    1043      730,   732,   738,   740,   744,   745,   750,   755,   758,   760,
    1044      762,   772,   774,   785,   786,   788,   792,   794,   798,   799,
    1045      804,   805,   809,   814,   815,   819,   821,   827,   828,   832,
    1046      834,   836,   838,   844,   845,   849,   851,   856,   858,   860,
    1047      865,   867,   872,   874,   878,   881,   885,   888,   892,   894,
    1048      896,   898,   903,   905,   907,   912,   914,   916,   918,   920,
    1049      925,   927,   929,   931,   936,   948,   949,   954,   956,   961,
    1050      965,   967,   969,   971,   973,   979,   980,   986,   987,   991,
    1051      992,   997,   999,  1005,  1006,  1008,  1013,  1018,  1028,  1030,
    1052     1034,  1035,  1040,  1042,  1046,  1047,  1051,  1053,  1057,  1058,
    1053     1062,  1063,  1067,  1068,  1083,  1084,  1085,  1086,  1087,  1091,
    1054     1096,  1103,  1113,  1118,  1123,  1131,  1136,  1141,  1146,  1151,
    1055     1181,  1186,  1193,  1195,  1202,  1207,  1212,  1223,  1228,  1233,
    1056     1238,  1243,  1252,  1257,  1265,  1266,  1267,  1268,  1274,  1279,
    1057     1287,  1288,  1289,  1290,  1294,  1295,  1296,  1297,  1302,  1303,
    1058     1312,  1313,  1318,  1319,  1324,  1326,  1328,  1330,  1332,  1335,
    1059     1334,  1346,  1347,  1349,  1359,  1360,  1365,  1367,  1369,  1371,
    1060     1373,  1376,  1378,  1381,  1386,  1388,  1390,  1392,  1394,  1396,
    1061     1398,  1400,  1402,  1404,  1406,  1408,  1410,  1416,  1417,  1419,
    1062     1421,  1423,  1428,  1429,  1435,  1436,  1438,  1440,  1445,  1447,
    1063     1449,  1451,  1456,  1457,  1459,  1461,  1466,  1467,  1469,  1474,
    1064     1475,  1477,  1479,  1484,  1486,  1488,  1493,  1494,  1498,  1500,
    1065     1506,  1505,  1509,  1511,  1516,  1518,  1524,  1525,  1530,  1531,
    1066     1533,  1534,  1543,  1544,  1546,  1548,  1553,  1555,  1561,  1562,
    1067     1564,  1567,  1570,  1575,  1576,  1581,  1586,  1590,  1592,  1598,
    1068     1597,  1604,  1606,  1612,  1613,  1621,  1622,  1626,  1627,  1628,
    1069     1630,  1632,  1639,  1640,  1642,  1644,  1649,  1650,  1656,  1657,
    1070     1661,  1662,  1667,  1668,  1669,  1671,  1679,  1680,  1682,  1685,
    1071     1687,  1691,  1692,  1693,  1695,  1697,  1701,  1706,  1714,  1715,
    1072     1724,  1726,  1731,  1732,  1733,  1737,  1738,  1739,  1743,  1744,
    1073     1745,  1749,  1750,  1751,  1756,  1757,  1758,  1759,  1765,  1766,
    1074     1768,  1773,  1774,  1779,  1780,  1781,  1782,  1783,  1798,  1799,
    1075     1804,  1805,  1811,  1813,  1816,  1818,  1820,  1843,  1844,  1846,
    1076     1848,  1853,  1854,  1856,  1861,  1866,  1867,  1873,  1872,  1876,
    1077     1880,  1882,  1884,  1890,  1891,  1896,  1901,  1903,  1908,  1910,
    1078     1911,  1913,  1918,  1920,  1922,  1927,  1929,  1934,  1939,  1947,
    1079     1953,  1952,  1966,  1967,  1972,  1973,  1977,  1982,  1987,  1995,
    1080     2000,  2011,  2012,  2017,  2018,  2024,  2025,  2029,  2030,  2031,
    1081     2034,  2033,  2044,  2053,  2059,  2065,  2074,  2080,  2086,  2092,
    1082     2098,  2106,  2112,  2120,  2126,  2135,  2136,  2137,  2141,  2145,
    1083     2147,  2152,  2153,  2157,  2158,  2163,  2169,  2170,  2173,  2175,
    1084     2176,  2180,  2181,  2182,  2183,  2217,  2219,  2220,  2222,  2227,
    1085     2232,  2237,  2239,  2241,  2246,  2248,  2250,  2252,  2257,  2259,
    1086     2268,  2270,  2271,  2276,  2278,  2280,  2285,  2287,  2289,  2294,
    1087     2296,  2298,  2307,  2308,  2309,  2313,  2315,  2317,  2322,  2324,
    1088     2326,  2331,  2333,  2335,  2350,  2352,  2353,  2355,  2360,  2361,
    1089     2366,  2368,  2370,  2375,  2377,  2379,  2381,  2386,  2388,  2390,
    1090     2400,  2402,  2403,  2405,  2410,  2412,  2414,  2419,  2421,  2423,
    1091     2425,  2430,  2432,  2434,  2465,  2467,  2468,  2470,  2475,  2480,
    1092     2488,  2490,  2492,  2497,  2499,  2504,  2506,  2520,  2521,  2523,
    1093     2528,  2530,  2532,  2534,  2536,  2541,  2542,  2544,  2546,  2551,
    1094     2553,  2555,  2561,  2563,  2565,  2569,  2571,  2573,  2575,  2589,
    1095     2590,  2592,  2597,  2599,  2601,  2603,  2605,  2610,  2611,  2613,
    1096     2615,  2620,  2622,  2624,  2630,  2631,  2633,  2642,  2645,  2647,
    1097     2650,  2652,  2654,  2667,  2668,  2670,  2675,  2677,  2679,  2681,
    1098     2683,  2688,  2689,  2691,  2693,  2698,  2700,  2708,  2709,  2710,
    1099     2715,  2716,  2720,  2722,  2724,  2726,  2728,  2730,  2737,  2739,
    1100     2741,  2743,  2745,  2748,  2750,  2752,  2754,  2756,  2761,  2763,
    1101     2765,  2770,  2796,  2797,  2799,  2803,  2804,  2808,  2810,  2812,
    1102     2814,  2816,  2818,  2825,  2827,  2829,  2831,  2833,  2835,  2840,
    1103     2847,  2849,  2867,  2869,  2874,  2875
     1028       0,   306,   306,   310,   317,   318,   319,   320,   321,   325,
     1029     326,   327,   331,   332,   336,   337,   341,   342,   346,   350,
     1030     351,   362,   364,   366,   367,   369,   374,   375,   381,   383,
     1031     385,   386,   387,   389,   390,   392,   394,   396,   405,   406,
     1032     412,   413,   417,   418,   422,   424,   426,   428,   430,   432,
     1033     434,   439,   441,   443,   447,   449,   453,   456,   458,   460,
     1034     465,   478,   480,   482,   484,   486,   488,   490,   492,   494,
     1035     496,   498,   505,   506,   512,   513,   514,   515,   519,   520,
     1036     527,   528,   530,   532,   537,   538,   540,   545,   546,   548,
     1037     553,   554,   556,   558,   560,   565,   566,   568,   573,   574,
     1038     579,   580,   585,   586,   591,   592,   597,   598,   603,   604,
     1039     607,   614,   619,   620,   628,   629,   633,   634,   635,   636,
     1040     637,   638,   639,   640,   641,   642,   643,   644,   654,   656,
     1041     661,   662,   667,   668,   674,   675,   681,   682,   683,   684,
     1042     685,   686,   687,   688,   689,   699,   706,   708,   718,   719,
     1043     724,   726,   732,   734,   738,   739,   744,   749,   752,   754,
     1044     756,   766,   768,   779,   780,   782,   786,   788,   792,   793,
     1045     798,   799,   803,   808,   809,   813,   815,   821,   822,   826,
     1046     828,   830,   832,   838,   839,   843,   845,   850,   852,   854,
     1047     859,   861,   866,   868,   872,   875,   879,   882,   886,   888,
     1048     890,   892,   897,   899,   901,   906,   908,   910,   912,   914,
     1049     919,   921,   923,   925,   930,   942,   943,   948,   950,   955,
     1050     959,   961,   963,   965,   967,   973,   974,   980,   981,   985,
     1051     986,   991,   993,   999,  1000,  1002,  1007,  1012,  1022,  1024,
     1052    1028,  1029,  1034,  1036,  1040,  1041,  1045,  1047,  1051,  1052,
     1053    1056,  1057,  1061,  1062,  1077,  1078,  1079,  1080,  1081,  1085,
     1054    1090,  1097,  1107,  1112,  1117,  1125,  1130,  1135,  1140,  1145,
     1055    1175,  1180,  1187,  1189,  1196,  1201,  1206,  1217,  1222,  1227,
     1056    1232,  1237,  1246,  1251,  1259,  1260,  1261,  1262,  1268,  1273,
     1057    1281,  1282,  1283,  1284,  1288,  1289,  1290,  1291,  1296,  1297,
     1058    1306,  1307,  1312,  1313,  1318,  1320,  1322,  1324,  1326,  1329,
     1059    1328,  1340,  1341,  1343,  1353,  1354,  1359,  1361,  1363,  1365,
     1060    1367,  1370,  1372,  1375,  1380,  1382,  1384,  1386,  1388,  1390,
     1061    1392,  1394,  1396,  1398,  1400,  1402,  1404,  1410,  1411,  1413,
     1062    1415,  1417,  1422,  1423,  1429,  1430,  1432,  1434,  1439,  1441,
     1063    1443,  1445,  1450,  1451,  1453,  1455,  1460,  1461,  1463,  1468,
     1064    1469,  1471,  1473,  1478,  1480,  1482,  1487,  1488,  1492,  1494,
     1065    1500,  1499,  1503,  1505,  1510,  1512,  1518,  1519,  1524,  1525,
     1066    1527,  1528,  1537,  1538,  1540,  1542,  1547,  1549,  1555,  1556,
     1067    1558,  1561,  1564,  1569,  1570,  1575,  1580,  1584,  1586,  1592,
     1068    1591,  1598,  1600,  1606,  1607,  1615,  1616,  1620,  1621,  1622,
     1069    1624,  1626,  1633,  1634,  1636,  1638,  1643,  1644,  1650,  1651,
     1070    1655,  1656,  1661,  1662,  1663,  1665,  1673,  1674,  1676,  1679,
     1071    1681,  1685,  1686,  1687,  1689,  1691,  1695,  1700,  1708,  1709,
     1072    1718,  1720,  1725,  1726,  1727,  1731,  1732,  1733,  1737,  1738,
     1073    1739,  1743,  1744,  1745,  1750,  1751,  1752,  1753,  1759,  1760,
     1074    1762,  1767,  1768,  1773,  1774,  1775,  1776,  1777,  1792,  1793,
     1075    1798,  1799,  1805,  1807,  1810,  1812,  1814,  1837,  1838,  1840,
     1076    1842,  1847,  1848,  1850,  1855,  1860,  1861,  1867,  1866,  1870,
     1077    1874,  1876,  1878,  1884,  1885,  1890,  1895,  1897,  1902,  1904,
     1078    1905,  1907,  1912,  1914,  1916,  1921,  1923,  1928,  1933,  1941,
     1079    1947,  1946,  1960,  1961,  1966,  1967,  1971,  1976,  1981,  1989,
     1080    1994,  2005,  2006,  2011,  2012,  2018,  2019,  2023,  2024,  2025,
     1081    2028,  2027,  2038,  2047,  2053,  2059,  2068,  2074,  2080,  2086,
     1082    2092,  2100,  2106,  2114,  2120,  2129,  2130,  2131,  2135,  2139,
     1083    2141,  2146,  2147,  2151,  2152,  2157,  2163,  2164,  2167,  2169,
     1084    2170,  2174,  2175,  2176,  2177,  2211,  2213,  2214,  2216,  2221,
     1085    2226,  2231,  2233,  2235,  2240,  2242,  2244,  2246,  2251,  2253,
     1086    2262,  2264,  2265,  2270,  2272,  2274,  2279,  2281,  2283,  2288,
     1087    2290,  2292,  2301,  2302,  2303,  2307,  2309,  2311,  2316,  2318,
     1088    2320,  2325,  2327,  2329,  2344,  2346,  2347,  2349,  2354,  2355,
     1089    2360,  2362,  2364,  2369,  2371,  2373,  2375,  2380,  2382,  2384,
     1090    2394,  2396,  2397,  2399,  2404,  2406,  2408,  2413,  2415,  2417,
     1091    2419,  2424,  2426,  2428,  2459,  2461,  2462,  2464,  2469,  2474,
     1092    2482,  2484,  2486,  2491,  2493,  2498,  2500,  2514,  2515,  2517,
     1093    2522,  2524,  2526,  2528,  2530,  2535,  2536,  2538,  2540,  2545,
     1094    2547,  2549,  2555,  2557,  2559,  2563,  2565,  2567,  2569,  2583,
     1095    2584,  2586,  2591,  2593,  2595,  2597,  2599,  2604,  2605,  2607,
     1096    2609,  2614,  2616,  2618,  2624,  2625,  2627,  2636,  2639,  2641,
     1097    2644,  2646,  2648,  2661,  2662,  2664,  2669,  2671,  2673,  2675,
     1098    2677,  2682,  2683,  2685,  2687,  2692,  2694,  2702,  2703,  2704,
     1099    2709,  2710,  2714,  2716,  2718,  2720,  2722,  2724,  2731,  2733,
     1100    2735,  2737,  2739,  2742,  2744,  2746,  2748,  2750,  2755,  2757,
     1101    2759,  2764,  2790,  2791,  2793,  2797,  2798,  2802,  2804,  2806,
     1102    2808,  2810,  2812,  2819,  2821,  2823,  2825,  2827,  2829,  2834,
     1103    2841,  2843,  2861,  2863,  2868,  2869
    11041104};
    11051105#endif
     
    48514851
    48524852/* Line 1806 of yacc.c  */
    4853 #line 305 "parser.yy"
     4853#line 306 "parser.yy"
    48544854    { typedefTable.enterScope(); }
    48554855    break;
     
    48584858
    48594859/* Line 1806 of yacc.c  */
    4860 #line 309 "parser.yy"
     4860#line 310 "parser.yy"
    48614861    { typedefTable.leaveScope(); }
    48624862    break;
     
    48654865
    48664866/* Line 1806 of yacc.c  */
    4867 #line 316 "parser.yy"
     4867#line 317 "parser.yy"
    48684868    { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (1)].tok) ) ); }
    48694869    break;
    48704870
    48714871  case 5:
    4872 
    4873 /* Line 1806 of yacc.c  */
    4874 #line 317 "parser.yy"
    4875     { (yyval.en) = new ExpressionNode( build_constantFloat( *(yyvsp[(1) - (1)].tok) ) ); }
    4876     break;
    4877 
    4878   case 6:
    48794872
    48804873/* Line 1806 of yacc.c  */
     
    48834876    break;
    48844877
    4885   case 7:
     4878  case 6:
    48864879
    48874880/* Line 1806 of yacc.c  */
     
    48904883    break;
    48914884
     4885  case 7:
     4886
     4887/* Line 1806 of yacc.c  */
     4888#line 320 "parser.yy"
     4889    { (yyval.en) = new ExpressionNode( build_constantFloat( *(yyvsp[(1) - (1)].tok) ) ); }
     4890    break;
     4891
    48924892  case 8:
    48934893
    48944894/* Line 1806 of yacc.c  */
    4895 #line 320 "parser.yy"
     4895#line 321 "parser.yy"
    48964896    { (yyval.en) = new ExpressionNode( build_constantChar( *(yyvsp[(1) - (1)].tok) ) ); }
    48974897    break;
     
    49004900
    49014901/* Line 1806 of yacc.c  */
    4902 #line 345 "parser.yy"
     4902#line 346 "parser.yy"
    49034903    { (yyval.constant) = build_constantStr( *(yyvsp[(1) - (1)].str) ); }
    49044904    break;
     
    49074907
    49084908/* Line 1806 of yacc.c  */
    4909 #line 349 "parser.yy"
     4909#line 350 "parser.yy"
    49104910    { (yyval.str) = (yyvsp[(1) - (1)].tok); }
    49114911    break;
     
    49144914
    49154915/* Line 1806 of yacc.c  */
    4916 #line 351 "parser.yy"
     4916#line 352 "parser.yy"
    49174917    {
    49184918                        appendStr( (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].tok) );                                            // append 2nd juxtaposed string to 1st
     
    49254925
    49264926/* Line 1806 of yacc.c  */
    4927 #line 362 "parser.yy"
     4927#line 363 "parser.yy"
    49284928    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    49294929    break;
     
    49324932
    49334933/* Line 1806 of yacc.c  */
    4934 #line 364 "parser.yy"
     4934#line 365 "parser.yy"
    49354935    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    49364936    break;
     
    49394939
    49404940/* Line 1806 of yacc.c  */
    4941 #line 367 "parser.yy"
     4941#line 368 "parser.yy"
    49424942    { (yyval.en) = (yyvsp[(2) - (3)].en); }
    49434943    break;
     
    49464946
    49474947/* Line 1806 of yacc.c  */
    4948 #line 369 "parser.yy"
     4948#line 370 "parser.yy"
    49494949    { (yyval.en) = new ExpressionNode( build_valexpr( (yyvsp[(2) - (3)].sn) ) ); }
    49504950    break;
     
    49534953
    49544954/* Line 1806 of yacc.c  */
    4955 #line 379 "parser.yy"
     4955#line 380 "parser.yy"
    49564956    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Index, (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ) ); }
    49574957    break;
     
    49604960
    49614961/* Line 1806 of yacc.c  */
    4962 #line 381 "parser.yy"
     4962#line 382 "parser.yy"
    49634963    { (yyval.en) = new ExpressionNode( build_func( (yyvsp[(1) - (4)].en), (yyvsp[(3) - (4)].en) ) ); }
    49644964    break;
     
    49674967
    49684968/* Line 1806 of yacc.c  */
    4969 #line 383 "parser.yy"
     4969#line 384 "parser.yy"
    49704970    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); }
    49714971    break;
    49724972
    4973   case 30:
    4974 
    4975 /* Line 1806 of yacc.c  */
    4976 #line 385 "parser.yy"
    4977     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    4978     break;
    4979 
    4980   case 31:
    4981 
    4982 /* Line 1806 of yacc.c  */
    4983 #line 387 "parser.yy"
    4984     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (2)].en), build_field_name_REALFRACTIONconstant( *(yyvsp[(2) - (2)].tok) ) ) ); }
    4985     break;
    4986 
    49874973  case 32:
    49884974
    49894975/* Line 1806 of yacc.c  */
    4990 #line 389 "parser.yy"
     4976#line 388 "parser.yy"
    49914977    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); }
    49924978    break;
    49934979
    4994   case 33:
     4980  case 34:
    49954981
    49964982/* Line 1806 of yacc.c  */
    49974983#line 391 "parser.yy"
    4998     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    4999     break;
    5000 
    5001   case 34:
     4984    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
     4985    break;
     4986
     4987  case 35:
    50024988
    50034989/* Line 1806 of yacc.c  */
    50044990#line 393 "parser.yy"
    5005     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
    5006     break;
    5007 
    5008   case 35:
     4991    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
     4992    break;
     4993
     4994  case 36:
    50094995
    50104996/* Line 1806 of yacc.c  */
    50114997#line 395 "parser.yy"
    5012     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
    5013     break;
    5014 
    5015   case 36:
     4998    { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }
     4999    break;
     5000
     5001  case 37:
    50165002
    50175003/* Line 1806 of yacc.c  */
    50185004#line 397 "parser.yy"
    5019     { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }
    5020     break;
    5021 
    5022   case 37:
    5023 
    5024 /* Line 1806 of yacc.c  */
    5025 #line 399 "parser.yy"
    50265005    {
    50275006                        Token fn;
     
    50345013
    50355014/* Line 1806 of yacc.c  */
    5036 #line 409 "parser.yy"
     5015#line 407 "parser.yy"
    50375016    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    50385017    break;
     
    50415020
    50425021/* Line 1806 of yacc.c  */
    5043 #line 414 "parser.yy"
     5022#line 412 "parser.yy"
    50445023    { (yyval.en) = 0; }
    50455024    break;
     
    50485027
    50495028/* Line 1806 of yacc.c  */
    5050 #line 420 "parser.yy"
     5029#line 418 "parser.yy"
    50515030    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    50525031    break;
    50535032
     5033  case 44:
     5034
     5035/* Line 1806 of yacc.c  */
     5036#line 423 "parser.yy"
     5037    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
     5038    break;
     5039
    50545040  case 45:
    50555041
    50565042/* Line 1806 of yacc.c  */
    5057 #line 426 "parser.yy"
    5058     { (yyval.en) = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *(yyvsp[(1) - (2)].tok) ) ), maybeMoveBuild<Expression>( (yyvsp[(2) - (2)].en) ) ) ); }
     5043#line 425 "parser.yy"
     5044    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(2) - (2)].en), build_varref( (yyvsp[(1) - (2)].tok) ) ) ); }
    50595045    break;
    50605046
     
    50625048
    50635049/* Line 1806 of yacc.c  */
    5064 #line 428 "parser.yy"
    5065     { (yyval.en) = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *(yyvsp[(1) - (6)].tok) ) ), build_tuple( (yyvsp[(4) - (6)].en) ) ) ); }
     5050#line 427 "parser.yy"
     5051    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(4) - (6)].en), build_varref( (yyvsp[(1) - (6)].tok) ) ) ); }
    50665052    break;
    50675053
     
    50695055
    50705056/* Line 1806 of yacc.c  */
    5071 #line 430 "parser.yy"
    5072     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (3)].en), maybeMoveBuild<Expression>( (yyvsp[(3) - (3)].en) ) ) ); }
     5057#line 429 "parser.yy"
     5058    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
    50735059    break;
    50745060
     
    50765062
    50775063/* Line 1806 of yacc.c  */
    5078 #line 432 "parser.yy"
    5079     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
     5064#line 431 "parser.yy"
     5065    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
    50805066    break;
    50815067
     
    50835069
    50845070/* Line 1806 of yacc.c  */
    5085 #line 434 "parser.yy"
    5086     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), maybeMoveBuild<Expression>( (yyvsp[(3) - (3)].en) ) ) ); }
     5071#line 433 "parser.yy"
     5072    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
    50875073    break;
    50885074
     
    50905076
    50915077/* Line 1806 of yacc.c  */
    5092 #line 436 "parser.yy"
    5093     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
     5078#line 435 "parser.yy"
     5079    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
    50945080    break;
    50955081
     
    50975083
    50985084/* Line 1806 of yacc.c  */
    5099 #line 441 "parser.yy"
    5100     { (yyval.en) = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *(yyvsp[(1) - (2)].tok) ), (yyvsp[(2) - (2)].en) ) ); }
     5085#line 440 "parser.yy"
     5086    { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
    51015087    break;
    51025088
     
    51045090
    51055091/* Line 1806 of yacc.c  */
    5106 #line 443 "parser.yy"
    5107     { (yyval.en) = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *(yyvsp[(1) - (2)].tok) ), (yyvsp[(2) - (2)].en) ) ); }
     5092#line 442 "parser.yy"
     5093    { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
    51085094    break;
    51095095
     
    51115097
    51125098/* Line 1806 of yacc.c  */
    5113 #line 445 "parser.yy"
    5114     { (yyval.en) = new ExpressionNode( build_field_name_fraction_constants( build_varref( (yyvsp[(1) - (2)].tok) ), (yyvsp[(2) - (2)].en) ) ); }
    5115     break;
    5116 
    5117   case 54:
    5118 
    5119 /* Line 1806 of yacc.c  */
    5120 #line 450 "parser.yy"
    5121     { (yyval.en) = nullptr; }
    5122     break;
    5123 
    5124   case 55:
    5125 
    5126 /* Line 1806 of yacc.c  */
    5127 #line 452 "parser.yy"
    5128     {
    5129                         Expression * constant = build_field_name_REALFRACTIONconstant( *(yyvsp[(2) - (2)].tok) );
    5130                         (yyval.en) = (yyvsp[(1) - (2)].en) != nullptr ? new ExpressionNode( build_fieldSel( (yyvsp[(1) - (2)].en),  constant ) ) : new ExpressionNode( constant );
    5131                 }
     5099#line 444 "parser.yy"
     5100    { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
    51325101    break;
    51335102
     
    51355104
    51365105/* Line 1806 of yacc.c  */
    5137 #line 463 "parser.yy"
     5106#line 457 "parser.yy"
    51385107    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    51395108    break;
     
    51425111
    51435112/* Line 1806 of yacc.c  */
    5144 #line 465 "parser.yy"
     5113#line 459 "parser.yy"
    51455114    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    51465115    break;
     
    51495118
    51505119/* Line 1806 of yacc.c  */
    5151 #line 467 "parser.yy"
     5120#line 461 "parser.yy"
    51525121    { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); }
    51535122    break;
     
    51565125
    51575126/* Line 1806 of yacc.c  */
    5158 #line 472 "parser.yy"
     5127#line 466 "parser.yy"
    51595128    {
    51605129                        switch ( (yyvsp[(1) - (2)].op) ) {
     
    51745143
    51755144/* Line 1806 of yacc.c  */
     5145#line 479 "parser.yy"
     5146    { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }
     5147    break;
     5148
     5149  case 62:
     5150
     5151/* Line 1806 of yacc.c  */
     5152#line 481 "parser.yy"
     5153    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); }
     5154    break;
     5155
     5156  case 63:
     5157
     5158/* Line 1806 of yacc.c  */
     5159#line 483 "parser.yy"
     5160    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); }
     5161    break;
     5162
     5163  case 64:
     5164
     5165/* Line 1806 of yacc.c  */
    51765166#line 485 "parser.yy"
    5177     { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }
    5178     break;
    5179 
    5180   case 62:
     5167    { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); }
     5168    break;
     5169
     5170  case 65:
    51815171
    51825172/* Line 1806 of yacc.c  */
    51835173#line 487 "parser.yy"
    5184     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); }
    5185     break;
    5186 
    5187   case 63:
     5174    { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }
     5175    break;
     5176
     5177  case 66:
    51885178
    51895179/* Line 1806 of yacc.c  */
    51905180#line 489 "parser.yy"
    5191     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); }
    5192     break;
    5193 
    5194   case 64:
     5181    { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); }
     5182    break;
     5183
     5184  case 67:
    51955185
    51965186/* Line 1806 of yacc.c  */
    51975187#line 491 "parser.yy"
    5198     { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    5199     break;
    5200 
    5201   case 65:
     5188    { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); }
     5189    break;
     5190
     5191  case 68:
    52025192
    52035193/* Line 1806 of yacc.c  */
    52045194#line 493 "parser.yy"
    5205     { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }
    5206     break;
    5207 
    5208   case 66:
     5195    { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); }
     5196    break;
     5197
     5198  case 69:
    52095199
    52105200/* Line 1806 of yacc.c  */
    52115201#line 495 "parser.yy"
    5212     { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    5213     break;
    5214 
    5215   case 67:
     5202    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); }
     5203    break;
     5204
     5205  case 70:
    52165206
    52175207/* Line 1806 of yacc.c  */
    52185208#line 497 "parser.yy"
    5219     { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); }
    5220     break;
    5221 
    5222   case 68:
     5209    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }
     5210    break;
     5211
     5212  case 71:
    52235213
    52245214/* Line 1806 of yacc.c  */
    52255215#line 499 "parser.yy"
    5226     { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); }
    5227     break;
    5228 
    5229   case 69:
    5230 
    5231 /* Line 1806 of yacc.c  */
    5232 #line 501 "parser.yy"
    5233     { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); }
    5234     break;
    5235 
    5236   case 70:
    5237 
    5238 /* Line 1806 of yacc.c  */
    5239 #line 503 "parser.yy"
    5240     { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }
    5241     break;
    5242 
    5243   case 71:
     5216    { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); }
     5217    break;
     5218
     5219  case 72:
    52445220
    52455221/* Line 1806 of yacc.c  */
    52465222#line 505 "parser.yy"
    5247     { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); }
    5248     break;
    5249 
    5250   case 72:
    5251 
    5252 /* Line 1806 of yacc.c  */
    5253 #line 511 "parser.yy"
    52545223    { (yyval.op) = OperKinds::PointTo; }
    52555224    break;
     
    52585227
    52595228/* Line 1806 of yacc.c  */
     5229#line 506 "parser.yy"
     5230    { (yyval.op) = OperKinds::AddressOf; }
     5231    break;
     5232
     5233  case 74:
     5234
     5235/* Line 1806 of yacc.c  */
    52605236#line 512 "parser.yy"
    5261     { (yyval.op) = OperKinds::AddressOf; }
    5262     break;
    5263 
    5264   case 74:
    5265 
    5266 /* Line 1806 of yacc.c  */
    5267 #line 518 "parser.yy"
    52685237    { (yyval.op) = OperKinds::UnPlus; }
    52695238    break;
     
    52725241
    52735242/* Line 1806 of yacc.c  */
    5274 #line 519 "parser.yy"
     5243#line 513 "parser.yy"
    52755244    { (yyval.op) = OperKinds::UnMinus; }
    52765245    break;
     
    52795248
    52805249/* Line 1806 of yacc.c  */
    5281 #line 520 "parser.yy"
     5250#line 514 "parser.yy"
    52825251    { (yyval.op) = OperKinds::Neg; }
    52835252    break;
     
    52865255
    52875256/* Line 1806 of yacc.c  */
     5257#line 515 "parser.yy"
     5258    { (yyval.op) = OperKinds::BitNeg; }
     5259    break;
     5260
     5261  case 79:
     5262
     5263/* Line 1806 of yacc.c  */
    52885264#line 521 "parser.yy"
    5289     { (yyval.op) = OperKinds::BitNeg; }
    5290     break;
    5291 
    5292   case 79:
    5293 
    5294 /* Line 1806 of yacc.c  */
    5295 #line 527 "parser.yy"
    52965265    { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); }
    52975266    break;
     
    53005269
    53015270/* Line 1806 of yacc.c  */
    5302 #line 535 "parser.yy"
     5271#line 529 "parser.yy"
    53035272    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53045273    break;
     
    53075276
    53085277/* Line 1806 of yacc.c  */
    5309 #line 537 "parser.yy"
     5278#line 531 "parser.yy"
    53105279    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53115280    break;
     
    53145283
    53155284/* Line 1806 of yacc.c  */
     5285#line 533 "parser.yy"
     5286    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5287    break;
     5288
     5289  case 85:
     5290
     5291/* Line 1806 of yacc.c  */
    53165292#line 539 "parser.yy"
    5317     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5318     break;
    5319 
    5320   case 85:
    5321 
    5322 /* Line 1806 of yacc.c  */
    5323 #line 545 "parser.yy"
    53245293    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53255294    break;
     
    53285297
    53295298/* Line 1806 of yacc.c  */
     5299#line 541 "parser.yy"
     5300    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5301    break;
     5302
     5303  case 88:
     5304
     5305/* Line 1806 of yacc.c  */
    53305306#line 547 "parser.yy"
    5331     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5332     break;
    5333 
    5334   case 88:
    5335 
    5336 /* Line 1806 of yacc.c  */
    5337 #line 553 "parser.yy"
    53385307    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53395308    break;
     
    53425311
    53435312/* Line 1806 of yacc.c  */
     5313#line 549 "parser.yy"
     5314    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5315    break;
     5316
     5317  case 91:
     5318
     5319/* Line 1806 of yacc.c  */
    53445320#line 555 "parser.yy"
    5345     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5346     break;
    5347 
    5348   case 91:
     5321    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5322    break;
     5323
     5324  case 92:
     5325
     5326/* Line 1806 of yacc.c  */
     5327#line 557 "parser.yy"
     5328    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5329    break;
     5330
     5331  case 93:
     5332
     5333/* Line 1806 of yacc.c  */
     5334#line 559 "parser.yy"
     5335    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5336    break;
     5337
     5338  case 94:
    53495339
    53505340/* Line 1806 of yacc.c  */
    53515341#line 561 "parser.yy"
    5352     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5353     break;
    5354 
    5355   case 92:
    5356 
    5357 /* Line 1806 of yacc.c  */
    5358 #line 563 "parser.yy"
    5359     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5360     break;
    5361 
    5362   case 93:
    5363 
    5364 /* Line 1806 of yacc.c  */
    5365 #line 565 "parser.yy"
    5366     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5367     break;
    5368 
    5369   case 94:
     5342    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5343    break;
     5344
     5345  case 96:
    53705346
    53715347/* Line 1806 of yacc.c  */
    53725348#line 567 "parser.yy"
    5373     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5374     break;
    5375 
    5376   case 96:
    5377 
    5378 /* Line 1806 of yacc.c  */
    5379 #line 573 "parser.yy"
    53805349    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53815350    break;
     
    53845353
    53855354/* Line 1806 of yacc.c  */
     5355#line 569 "parser.yy"
     5356    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5357    break;
     5358
     5359  case 99:
     5360
     5361/* Line 1806 of yacc.c  */
    53865362#line 575 "parser.yy"
    5387     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5388     break;
    5389 
    5390   case 99:
     5363    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5364    break;
     5365
     5366  case 101:
    53915367
    53925368/* Line 1806 of yacc.c  */
    53935369#line 581 "parser.yy"
    5394     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5395     break;
    5396 
    5397   case 101:
     5370    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5371    break;
     5372
     5373  case 103:
    53985374
    53995375/* Line 1806 of yacc.c  */
    54005376#line 587 "parser.yy"
    5401     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5402     break;
    5403 
    5404   case 103:
     5377    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5378    break;
     5379
     5380  case 105:
    54055381
    54065382/* Line 1806 of yacc.c  */
    54075383#line 593 "parser.yy"
    5408     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5409     break;
    5410 
    5411   case 105:
     5384    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); }
     5385    break;
     5386
     5387  case 107:
    54125388
    54135389/* Line 1806 of yacc.c  */
    54145390#line 599 "parser.yy"
    5415     { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); }
    5416     break;
    5417 
    5418   case 107:
     5391    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); }
     5392    break;
     5393
     5394  case 109:
    54195395
    54205396/* Line 1806 of yacc.c  */
    54215397#line 605 "parser.yy"
    5422     { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); }
    5423     break;
    5424 
    5425   case 109:
    5426 
    5427 /* Line 1806 of yacc.c  */
    5428 #line 611 "parser.yy"
    54295398    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    54305399    break;
     
    54335402
    54345403/* Line 1806 of yacc.c  */
    5435 #line 614 "parser.yy"
     5404#line 608 "parser.yy"
    54365405    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); }
    54375406    break;
     
    54405409
    54415410/* Line 1806 of yacc.c  */
    5442 #line 627 "parser.yy"
     5411#line 621 "parser.yy"
    54435412    { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54445413    break;
     
    54475416
    54485417/* Line 1806 of yacc.c  */
     5418#line 628 "parser.yy"
     5419    { (yyval.en) = nullptr; }
     5420    break;
     5421
     5422  case 116:
     5423
     5424/* Line 1806 of yacc.c  */
     5425#line 633 "parser.yy"
     5426    { (yyval.op) = OperKinds::Assign; }
     5427    break;
     5428
     5429  case 117:
     5430
     5431/* Line 1806 of yacc.c  */
    54495432#line 634 "parser.yy"
    5450     { (yyval.en) = nullptr; }
    5451     break;
    5452 
    5453   case 116:
     5433    { (yyval.op) = OperKinds::AtAssn; }
     5434    break;
     5435
     5436  case 118:
     5437
     5438/* Line 1806 of yacc.c  */
     5439#line 635 "parser.yy"
     5440    { (yyval.op) = OperKinds::MulAssn; }
     5441    break;
     5442
     5443  case 119:
     5444
     5445/* Line 1806 of yacc.c  */
     5446#line 636 "parser.yy"
     5447    { (yyval.op) = OperKinds::DivAssn; }
     5448    break;
     5449
     5450  case 120:
     5451
     5452/* Line 1806 of yacc.c  */
     5453#line 637 "parser.yy"
     5454    { (yyval.op) = OperKinds::ModAssn; }
     5455    break;
     5456
     5457  case 121:
     5458
     5459/* Line 1806 of yacc.c  */
     5460#line 638 "parser.yy"
     5461    { (yyval.op) = OperKinds::PlusAssn; }
     5462    break;
     5463
     5464  case 122:
    54545465
    54555466/* Line 1806 of yacc.c  */
    54565467#line 639 "parser.yy"
    5457     { (yyval.op) = OperKinds::Assign; }
    5458     break;
    5459 
    5460   case 117:
     5468    { (yyval.op) = OperKinds::MinusAssn; }
     5469    break;
     5470
     5471  case 123:
    54615472
    54625473/* Line 1806 of yacc.c  */
    54635474#line 640 "parser.yy"
    5464     { (yyval.op) = OperKinds::AtAssn; }
    5465     break;
    5466 
    5467   case 118:
     5475    { (yyval.op) = OperKinds::LSAssn; }
     5476    break;
     5477
     5478  case 124:
    54685479
    54695480/* Line 1806 of yacc.c  */
    54705481#line 641 "parser.yy"
    5471     { (yyval.op) = OperKinds::MulAssn; }
    5472     break;
    5473 
    5474   case 119:
     5482    { (yyval.op) = OperKinds::RSAssn; }
     5483    break;
     5484
     5485  case 125:
    54755486
    54765487/* Line 1806 of yacc.c  */
    54775488#line 642 "parser.yy"
    5478     { (yyval.op) = OperKinds::DivAssn; }
    5479     break;
    5480 
    5481   case 120:
     5489    { (yyval.op) = OperKinds::AndAssn; }
     5490    break;
     5491
     5492  case 126:
    54825493
    54835494/* Line 1806 of yacc.c  */
    54845495#line 643 "parser.yy"
    5485     { (yyval.op) = OperKinds::ModAssn; }
    5486     break;
    5487 
    5488   case 121:
     5496    { (yyval.op) = OperKinds::ERAssn; }
     5497    break;
     5498
     5499  case 127:
    54895500
    54905501/* Line 1806 of yacc.c  */
    54915502#line 644 "parser.yy"
    5492     { (yyval.op) = OperKinds::PlusAssn; }
    5493     break;
    5494 
    5495   case 122:
    5496 
    5497 /* Line 1806 of yacc.c  */
    5498 #line 645 "parser.yy"
    5499     { (yyval.op) = OperKinds::MinusAssn; }
    5500     break;
    5501 
    5502   case 123:
    5503 
    5504 /* Line 1806 of yacc.c  */
    5505 #line 646 "parser.yy"
    5506     { (yyval.op) = OperKinds::LSAssn; }
    5507     break;
    5508 
    5509   case 124:
    5510 
    5511 /* Line 1806 of yacc.c  */
    5512 #line 647 "parser.yy"
    5513     { (yyval.op) = OperKinds::RSAssn; }
    5514     break;
    5515 
    5516   case 125:
    5517 
    5518 /* Line 1806 of yacc.c  */
    5519 #line 648 "parser.yy"
    5520     { (yyval.op) = OperKinds::AndAssn; }
    5521     break;
    5522 
    5523   case 126:
    5524 
    5525 /* Line 1806 of yacc.c  */
    5526 #line 649 "parser.yy"
    5527     { (yyval.op) = OperKinds::ERAssn; }
    5528     break;
    5529 
    5530   case 127:
    5531 
    5532 /* Line 1806 of yacc.c  */
    5533 #line 650 "parser.yy"
    55345503    { (yyval.op) = OperKinds::OrAssn; }
    55355504    break;
     
    55385507
    55395508/* Line 1806 of yacc.c  */
    5540 #line 661 "parser.yy"
     5509#line 655 "parser.yy"
    55415510    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); }
    55425511    break;
     
    55455514
    55465515/* Line 1806 of yacc.c  */
     5516#line 657 "parser.yy"
     5517    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); }
     5518    break;
     5519
     5520  case 131:
     5521
     5522/* Line 1806 of yacc.c  */
    55475523#line 663 "parser.yy"
    5548     { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); }
    5549     break;
    5550 
    5551   case 131:
     5524    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
     5525    break;
     5526
     5527  case 133:
    55525528
    55535529/* Line 1806 of yacc.c  */
    55545530#line 669 "parser.yy"
    5555     { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    5556     break;
    5557 
    5558   case 133:
    5559 
    5560 /* Line 1806 of yacc.c  */
    5561 #line 675 "parser.yy"
    55625531    { (yyval.en) = new ExpressionNode( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    55635532    break;
     
    55665535
    55675536/* Line 1806 of yacc.c  */
    5568 #line 680 "parser.yy"
     5537#line 674 "parser.yy"
    55695538    { (yyval.en) = 0; }
    55705539    break;
     
    55735542
    55745543/* Line 1806 of yacc.c  */
    5575 #line 689 "parser.yy"
     5544#line 683 "parser.yy"
    55765545    { (yyval.sn) = (yyvsp[(1) - (1)].sn); }
    55775546    break;
     
    55805549
    55815550/* Line 1806 of yacc.c  */
    5582 #line 696 "parser.yy"
     5551#line 690 "parser.yy"
    55835552    {
    55845553                        Token fn;
     
    55915560
    55925561/* Line 1806 of yacc.c  */
    5593 #line 706 "parser.yy"
     5562#line 700 "parser.yy"
    55945563    {
    55955564                        (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) );
     
    56005569
    56015570/* Line 1806 of yacc.c  */
    5602 #line 713 "parser.yy"
     5571#line 707 "parser.yy"
    56035572    { (yyval.sn) = new StatementNode( build_compound( (StatementNode *)0 ) ); }
    56045573    break;
     
    56075576
    56085577/* Line 1806 of yacc.c  */
     5578#line 714 "parser.yy"
     5579    { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); }
     5580    break;
     5581
     5582  case 149:
     5583
     5584/* Line 1806 of yacc.c  */
    56095585#line 720 "parser.yy"
    5610     { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); }
    5611     break;
    5612 
    5613   case 149:
    5614 
    5615 /* Line 1806 of yacc.c  */
    5616 #line 726 "parser.yy"
    56175586    { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } }
    56185587    break;
     
    56215590
    56225591/* Line 1806 of yacc.c  */
    5623 #line 731 "parser.yy"
     5592#line 725 "parser.yy"
    56245593    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    56255594    break;
     
    56285597
    56295598/* Line 1806 of yacc.c  */
    5630 #line 733 "parser.yy"
     5599#line 727 "parser.yy"
    56315600    {   // mark all fields in list
    56325601                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    56395608
    56405609/* Line 1806 of yacc.c  */
    5641 #line 739 "parser.yy"
     5610#line 733 "parser.yy"
    56425611    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    56435612    break;
     
    56465615
    56475616/* Line 1806 of yacc.c  */
    5648 #line 746 "parser.yy"
     5617#line 740 "parser.yy"
    56495618    { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } }
    56505619    break;
     
    56535622
    56545623/* Line 1806 of yacc.c  */
     5624#line 745 "parser.yy"
     5625    { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); }
     5626    break;
     5627
     5628  case 157:
     5629
     5630/* Line 1806 of yacc.c  */
    56555631#line 751 "parser.yy"
    5656     { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); }
    5657     break;
    5658 
    5659   case 157:
     5632    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); }
     5633    break;
     5634
     5635  case 158:
     5636
     5637/* Line 1806 of yacc.c  */
     5638#line 753 "parser.yy"
     5639    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }
     5640    break;
     5641
     5642  case 159:
     5643
     5644/* Line 1806 of yacc.c  */
     5645#line 755 "parser.yy"
     5646    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
     5647    break;
     5648
     5649  case 160:
    56605650
    56615651/* Line 1806 of yacc.c  */
    56625652#line 757 "parser.yy"
    5663     { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); }
    5664     break;
    5665 
    5666   case 158:
    5667 
    5668 /* Line 1806 of yacc.c  */
    5669 #line 759 "parser.yy"
    5670     { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }
    5671     break;
    5672 
    5673   case 159:
    5674 
    5675 /* Line 1806 of yacc.c  */
    5676 #line 761 "parser.yy"
    5677     { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    5678     break;
    5679 
    5680   case 160:
    5681 
    5682 /* Line 1806 of yacc.c  */
    5683 #line 763 "parser.yy"
    56845653    {
    56855654                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    56965665
    56975666/* Line 1806 of yacc.c  */
    5698 #line 773 "parser.yy"
     5667#line 767 "parser.yy"
    56995668    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    57005669    break;
     
    57035672
    57045673/* Line 1806 of yacc.c  */
    5705 #line 775 "parser.yy"
     5674#line 769 "parser.yy"
    57065675    {
    57075676                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    57135682
    57145683/* Line 1806 of yacc.c  */
    5715 #line 785 "parser.yy"
     5684#line 779 "parser.yy"
    57165685    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    57175686    break;
     
    57205689
    57215690/* Line 1806 of yacc.c  */
    5722 #line 787 "parser.yy"
     5691#line 781 "parser.yy"
    57235692    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    57245693    break;
     
    57275696
    57285697/* Line 1806 of yacc.c  */
     5698#line 786 "parser.yy"
     5699    { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }
     5700    break;
     5701
     5702  case 167:
     5703
     5704/* Line 1806 of yacc.c  */
     5705#line 788 "parser.yy"
     5706    { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); }
     5707    break;
     5708
     5709  case 168:
     5710
     5711/* Line 1806 of yacc.c  */
    57295712#line 792 "parser.yy"
    5730     { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }
    5731     break;
    5732 
    5733   case 167:
    5734 
    5735 /* Line 1806 of yacc.c  */
    5736 #line 794 "parser.yy"
    5737     { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); }
    5738     break;
    5739 
    5740   case 168:
    5741 
    5742 /* Line 1806 of yacc.c  */
    5743 #line 798 "parser.yy"
    57445713    { (yyval.sn) = (yyvsp[(2) - (3)].sn); }
    57455714    break;
     
    57485717
    57495718/* Line 1806 of yacc.c  */
     5719#line 793 "parser.yy"
     5720    { (yyval.sn) = new StatementNode( build_default() ); }
     5721    break;
     5722
     5723  case 171:
     5724
     5725/* Line 1806 of yacc.c  */
    57505726#line 799 "parser.yy"
    5751     { (yyval.sn) = new StatementNode( build_default() ); }
    5752     break;
    5753 
    5754   case 171:
    5755 
    5756 /* Line 1806 of yacc.c  */
    5757 #line 805 "parser.yy"
    57585727    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) )); }
    57595728    break;
     
    57625731
    57635732/* Line 1806 of yacc.c  */
    5764 #line 809 "parser.yy"
     5733#line 803 "parser.yy"
    57655734    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    57665735    break;
     
    57695738
    57705739/* Line 1806 of yacc.c  */
     5740#line 808 "parser.yy"
     5741    { (yyval.sn) = 0; }
     5742    break;
     5743
     5744  case 175:
     5745
     5746/* Line 1806 of yacc.c  */
    57715747#line 814 "parser.yy"
     5748    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
     5749    break;
     5750
     5751  case 176:
     5752
     5753/* Line 1806 of yacc.c  */
     5754#line 816 "parser.yy"
     5755    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); }
     5756    break;
     5757
     5758  case 177:
     5759
     5760/* Line 1806 of yacc.c  */
     5761#line 821 "parser.yy"
    57725762    { (yyval.sn) = 0; }
    57735763    break;
    57745764
    5775   case 175:
    5776 
    5777 /* Line 1806 of yacc.c  */
    5778 #line 820 "parser.yy"
    5779     { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    5780     break;
    5781 
    5782   case 176:
    5783 
    5784 /* Line 1806 of yacc.c  */
    5785 #line 822 "parser.yy"
    5786     { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); }
    5787     break;
    5788 
    5789   case 177:
     5765  case 179:
    57905766
    57915767/* Line 1806 of yacc.c  */
    57925768#line 827 "parser.yy"
     5769    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
     5770    break;
     5771
     5772  case 180:
     5773
     5774/* Line 1806 of yacc.c  */
     5775#line 829 "parser.yy"
     5776    { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); }
     5777    break;
     5778
     5779  case 181:
     5780
     5781/* Line 1806 of yacc.c  */
     5782#line 831 "parser.yy"
     5783    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
     5784    break;
     5785
     5786  case 182:
     5787
     5788/* Line 1806 of yacc.c  */
     5789#line 833 "parser.yy"
     5790    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); }
     5791    break;
     5792
     5793  case 183:
     5794
     5795/* Line 1806 of yacc.c  */
     5796#line 838 "parser.yy"
     5797    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
     5798    break;
     5799
     5800  case 185:
     5801
     5802/* Line 1806 of yacc.c  */
     5803#line 844 "parser.yy"
    57935804    { (yyval.sn) = 0; }
    57945805    break;
    57955806
    5796   case 179:
    5797 
    5798 /* Line 1806 of yacc.c  */
    5799 #line 833 "parser.yy"
    5800     { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
    5801     break;
    5802 
    5803   case 180:
    5804 
    5805 /* Line 1806 of yacc.c  */
    5806 #line 835 "parser.yy"
    5807     { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); }
    5808     break;
    5809 
    5810   case 181:
    5811 
    5812 /* Line 1806 of yacc.c  */
    5813 #line 837 "parser.yy"
    5814     { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
    5815     break;
    5816 
    5817   case 182:
    5818 
    5819 /* Line 1806 of yacc.c  */
    5820 #line 839 "parser.yy"
    5821     { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); }
    5822     break;
    5823 
    5824   case 183:
    5825 
    5826 /* Line 1806 of yacc.c  */
    5827 #line 844 "parser.yy"
     5807  case 186:
     5808
     5809/* Line 1806 of yacc.c  */
     5810#line 846 "parser.yy"
     5811    { (yyval.sn) = 0; }
     5812    break;
     5813
     5814  case 187:
     5815
     5816/* Line 1806 of yacc.c  */
     5817#line 851 "parser.yy"
     5818    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
     5819    break;
     5820
     5821  case 188:
     5822
     5823/* Line 1806 of yacc.c  */
     5824#line 853 "parser.yy"
     5825    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
     5826    break;
     5827
     5828  case 189:
     5829
     5830/* Line 1806 of yacc.c  */
     5831#line 855 "parser.yy"
     5832    { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); }
     5833    break;
     5834
     5835  case 190:
     5836
     5837/* Line 1806 of yacc.c  */
     5838#line 860 "parser.yy"
     5839    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
     5840    break;
     5841
     5842  case 191:
     5843
     5844/* Line 1806 of yacc.c  */
     5845#line 862 "parser.yy"
     5846    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); }
     5847    break;
     5848
     5849  case 192:
     5850
     5851/* Line 1806 of yacc.c  */
     5852#line 867 "parser.yy"
     5853    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); }
     5854    break;
     5855
     5856  case 193:
     5857
     5858/* Line 1806 of yacc.c  */
     5859#line 871 "parser.yy"
     5860    { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); }
     5861    break;
     5862
     5863  case 194:
     5864
     5865/* Line 1806 of yacc.c  */
     5866#line 874 "parser.yy"
     5867    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); }
     5868    break;
     5869
     5870  case 195:
     5871
     5872/* Line 1806 of yacc.c  */
     5873#line 878 "parser.yy"
     5874    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); }
     5875    break;
     5876
     5877  case 196:
     5878
     5879/* Line 1806 of yacc.c  */
     5880#line 881 "parser.yy"
    58285881    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    58295882    break;
    58305883
    5831   case 185:
    5832 
    5833 /* Line 1806 of yacc.c  */
    5834 #line 850 "parser.yy"
    5835     { (yyval.sn) = 0; }
    5836     break;
    5837 
    5838   case 186:
    5839 
    5840 /* Line 1806 of yacc.c  */
    5841 #line 852 "parser.yy"
    5842     { (yyval.sn) = 0; }
    5843     break;
    5844 
    5845   case 187:
    5846 
    5847 /* Line 1806 of yacc.c  */
    5848 #line 857 "parser.yy"
    5849     { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    5850     break;
    5851 
    5852   case 188:
    5853 
    5854 /* Line 1806 of yacc.c  */
    5855 #line 859 "parser.yy"
    5856     { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
    5857     break;
    5858 
    5859   case 189:
    5860 
    5861 /* Line 1806 of yacc.c  */
    5862 #line 861 "parser.yy"
    5863     { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); }
    5864     break;
    5865 
    5866   case 190:
    5867 
    5868 /* Line 1806 of yacc.c  */
    5869 #line 866 "parser.yy"
    5870     { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
    5871     break;
    5872 
    5873   case 191:
    5874 
    5875 /* Line 1806 of yacc.c  */
    5876 #line 868 "parser.yy"
    5877     { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); }
    5878     break;
    5879 
    5880   case 192:
    5881 
    5882 /* Line 1806 of yacc.c  */
    5883 #line 873 "parser.yy"
    5884     { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); }
    5885     break;
    5886 
    5887   case 193:
    5888 
    5889 /* Line 1806 of yacc.c  */
    5890 #line 877 "parser.yy"
    5891     { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); }
    5892     break;
    5893 
    5894   case 194:
    5895 
    5896 /* Line 1806 of yacc.c  */
    5897 #line 880 "parser.yy"
    5898     { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); }
    5899     break;
    5900 
    5901   case 195:
    5902 
    5903 /* Line 1806 of yacc.c  */
    5904 #line 884 "parser.yy"
    5905     { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); }
    5906     break;
    5907 
    5908   case 196:
     5884  case 197:
     5885
     5886/* Line 1806 of yacc.c  */
     5887#line 885 "parser.yy"
     5888    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); }
     5889    break;
     5890
     5891  case 198:
    59095892
    59105893/* Line 1806 of yacc.c  */
    59115894#line 887 "parser.yy"
    5912     { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    5913     break;
    5914 
    5915   case 197:
     5895    { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); }
     5896    break;
     5897
     5898  case 199:
     5899
     5900/* Line 1806 of yacc.c  */
     5901#line 889 "parser.yy"
     5902    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
     5903    break;
     5904
     5905  case 200:
    59165906
    59175907/* Line 1806 of yacc.c  */
    59185908#line 891 "parser.yy"
    5919     { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); }
    5920     break;
    5921 
    5922   case 198:
     5909    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
     5910    break;
     5911
     5912  case 201:
    59235913
    59245914/* Line 1806 of yacc.c  */
    59255915#line 893 "parser.yy"
    5926     { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); }
    5927     break;
    5928 
    5929   case 199:
    5930 
    5931 /* Line 1806 of yacc.c  */
    5932 #line 895 "parser.yy"
    5933     { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
    5934     break;
    5935 
    5936   case 200:
    5937 
    5938 /* Line 1806 of yacc.c  */
    5939 #line 897 "parser.yy"
    5940     { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
    5941     break;
    5942 
    5943   case 201:
    5944 
    5945 /* Line 1806 of yacc.c  */
    5946 #line 899 "parser.yy"
    59475916    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (5)].en) ) ); }
    59485917    break;
     
    59515920
    59525921/* Line 1806 of yacc.c  */
    5953 #line 904 "parser.yy"
     5922#line 898 "parser.yy"
    59545923    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); }
    59555924    break;
     
    59585927
    59595928/* Line 1806 of yacc.c  */
    5960 #line 906 "parser.yy"
     5929#line 900 "parser.yy"
    59615930    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); }
    59625931    break;
     
    59655934
    59665935/* Line 1806 of yacc.c  */
    5967 #line 908 "parser.yy"
     5936#line 902 "parser.yy"
    59685937    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (4)].sn), (yyvsp[(3) - (4)].sn), (yyvsp[(4) - (4)].sn) ) ); }
    59695938    break;
     
    59725941
    59735942/* Line 1806 of yacc.c  */
     5943#line 909 "parser.yy"
     5944    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
     5945    break;
     5946
     5947  case 207:
     5948
     5949/* Line 1806 of yacc.c  */
     5950#line 911 "parser.yy"
     5951    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
     5952    break;
     5953
     5954  case 208:
     5955
     5956/* Line 1806 of yacc.c  */
     5957#line 913 "parser.yy"
     5958    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
     5959    break;
     5960
     5961  case 209:
     5962
     5963/* Line 1806 of yacc.c  */
    59745964#line 915 "parser.yy"
    5975     { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    5976     break;
    5977 
    5978   case 207:
    5979 
    5980 /* Line 1806 of yacc.c  */
    5981 #line 917 "parser.yy"
    59825965    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    59835966    break;
    59845967
    5985   case 208:
    5986 
    5987 /* Line 1806 of yacc.c  */
    5988 #line 919 "parser.yy"
    5989     { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    5990     break;
    5991 
    5992   case 209:
    5993 
    5994 /* Line 1806 of yacc.c  */
    5995 #line 921 "parser.yy"
    5996     { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    5997     break;
    5998 
    59995968  case 210:
    60005969
    60015970/* Line 1806 of yacc.c  */
     5971#line 920 "parser.yy"
     5972    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
     5973    break;
     5974
     5975  case 211:
     5976
     5977/* Line 1806 of yacc.c  */
     5978#line 922 "parser.yy"
     5979    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
     5980    break;
     5981
     5982  case 212:
     5983
     5984/* Line 1806 of yacc.c  */
     5985#line 924 "parser.yy"
     5986    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
     5987    break;
     5988
     5989  case 213:
     5990
     5991/* Line 1806 of yacc.c  */
    60025992#line 926 "parser.yy"
    6003     { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    6004     break;
    6005 
    6006   case 211:
    6007 
    6008 /* Line 1806 of yacc.c  */
    6009 #line 928 "parser.yy"
    60105993    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    60115994    break;
    60125995
    6013   case 212:
    6014 
    6015 /* Line 1806 of yacc.c  */
    6016 #line 930 "parser.yy"
    6017     { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    6018     break;
    6019 
    6020   case 213:
    6021 
    6022 /* Line 1806 of yacc.c  */
    6023 #line 932 "parser.yy"
    6024     { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    6025     break;
    6026 
    60275996  case 214:
    60285997
    60295998/* Line 1806 of yacc.c  */
    6030 #line 937 "parser.yy"
     5999#line 931 "parser.yy"
    60316000    {
    60326001                        (yyval.sn) = new StatementNode( build_finally( (yyvsp[(2) - (2)].sn) ) );
     
    60376006
    60386007/* Line 1806 of yacc.c  */
    6039 #line 950 "parser.yy"
     6008#line 944 "parser.yy"
    60406009    {
    60416010                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    60476016
    60486017/* Line 1806 of yacc.c  */
    6049 #line 955 "parser.yy"
     6018#line 949 "parser.yy"
    60506019    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    60516020    break;
     
    60546023
    60556024/* Line 1806 of yacc.c  */
    6056 #line 957 "parser.yy"
     6025#line 951 "parser.yy"
    60576026    {
    60586027                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    60646033
    60656034/* Line 1806 of yacc.c  */
     6035#line 960 "parser.yy"
     6036    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); }
     6037    break;
     6038
     6039  case 221:
     6040
     6041/* Line 1806 of yacc.c  */
     6042#line 962 "parser.yy"
     6043    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }
     6044    break;
     6045
     6046  case 222:
     6047
     6048/* Line 1806 of yacc.c  */
     6049#line 964 "parser.yy"
     6050    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }
     6051    break;
     6052
     6053  case 223:
     6054
     6055/* Line 1806 of yacc.c  */
    60666056#line 966 "parser.yy"
    6067     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); }
    6068     break;
    6069 
    6070   case 221:
     6057    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }
     6058    break;
     6059
     6060  case 224:
    60716061
    60726062/* Line 1806 of yacc.c  */
    60736063#line 968 "parser.yy"
    6074     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }
    6075     break;
    6076 
    6077   case 222:
    6078 
    6079 /* Line 1806 of yacc.c  */
    6080 #line 970 "parser.yy"
    6081     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }
    6082     break;
    6083 
    6084   case 223:
    6085 
    6086 /* Line 1806 of yacc.c  */
    6087 #line 972 "parser.yy"
    6088     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }
    6089     break;
    6090 
    6091   case 224:
    6092 
    6093 /* Line 1806 of yacc.c  */
    6094 #line 974 "parser.yy"
    60956064    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].en), (yyvsp[(12) - (14)].label) ) ); }
    60966065    break;
     
    60996068
    61006069/* Line 1806 of yacc.c  */
    6101 #line 979 "parser.yy"
     6070#line 973 "parser.yy"
    61026071    { (yyval.flag) = false; }
    61036072    break;
     
    61066075
    61076076/* Line 1806 of yacc.c  */
    6108 #line 981 "parser.yy"
     6077#line 975 "parser.yy"
    61096078    { (yyval.flag) = true; }
    61106079    break;
     
    61136082
    61146083/* Line 1806 of yacc.c  */
    6115 #line 986 "parser.yy"
     6084#line 980 "parser.yy"
    61166085    { (yyval.en) = 0; }
    61176086    break;
     
    61206089
    61216090/* Line 1806 of yacc.c  */
    6122 #line 993 "parser.yy"
     6091#line 987 "parser.yy"
    61236092    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    61246093    break;
     
    61276096
    61286097/* Line 1806 of yacc.c  */
    6129 #line 998 "parser.yy"
     6098#line 992 "parser.yy"
    61306099    { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); }
    61316100    break;
     
    61346103
    61356104/* Line 1806 of yacc.c  */
    6136 #line 1000 "parser.yy"
     6105#line 994 "parser.yy"
    61376106    { (yyval.en) = new ExpressionNode( build_asmexpr( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ) ); }
    61386107    break;
     
    61416110
    61426111/* Line 1806 of yacc.c  */
    6143 #line 1005 "parser.yy"
     6112#line 999 "parser.yy"
    61446113    { (yyval.en) = 0; }
    61456114    break;
     
    61486117
    61496118/* Line 1806 of yacc.c  */
    6150 #line 1007 "parser.yy"
     6119#line 1001 "parser.yy"
    61516120    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    61526121    break;
     
    61556124
    61566125/* Line 1806 of yacc.c  */
    6157 #line 1009 "parser.yy"
     6126#line 1003 "parser.yy"
    61586127    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( (yyvsp[(3) - (3)].constant) ) ); }
    61596128    break;
     
    61626131
    61636132/* Line 1806 of yacc.c  */
    6164 #line 1014 "parser.yy"
     6133#line 1008 "parser.yy"
    61656134    {
    61666135                        (yyval.label) = new LabelNode(); (yyval.label)->labels.push_back( *(yyvsp[(1) - (1)].tok) );
     
    61726141
    61736142/* Line 1806 of yacc.c  */
    6174 #line 1019 "parser.yy"
     6143#line 1013 "parser.yy"
    61756144    {
    61766145                        (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->labels.push_back( *(yyvsp[(3) - (3)].tok) );
     
    61826151
    61836152/* Line 1806 of yacc.c  */
    6184 #line 1029 "parser.yy"
     6153#line 1023 "parser.yy"
    61856154    { (yyval.decl) = 0; }
    61866155    break;
     
    61896158
    61906159/* Line 1806 of yacc.c  */
    6191 #line 1036 "parser.yy"
     6160#line 1030 "parser.yy"
    61926161    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    61936162    break;
     
    61966165
    61976166/* Line 1806 of yacc.c  */
    6198 #line 1041 "parser.yy"
     6167#line 1035 "parser.yy"
    61996168    { (yyval.decl) = 0; }
    62006169    break;
     
    62036172
    62046173/* Line 1806 of yacc.c  */
    6205 #line 1048 "parser.yy"
     6174#line 1042 "parser.yy"
    62066175    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    62076176    break;
     
    62106179
    62116180/* Line 1806 of yacc.c  */
    6212 #line 1062 "parser.yy"
     6181#line 1056 "parser.yy"
    62136182    {}
    62146183    break;
     
    62176186
    62186187/* Line 1806 of yacc.c  */
    6219 #line 1063 "parser.yy"
     6188#line 1057 "parser.yy"
    62206189    {}
    62216190    break;
     
    62246193
    62256194/* Line 1806 of yacc.c  */
    6226 #line 1092 "parser.yy"
     6195#line 1086 "parser.yy"
    62276196    {
    62286197                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62346203
    62356204/* Line 1806 of yacc.c  */
    6236 #line 1099 "parser.yy"
     6205#line 1093 "parser.yy"
    62376206    {
    62386207                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62446213
    62456214/* Line 1806 of yacc.c  */
    6246 #line 1104 "parser.yy"
     6215#line 1098 "parser.yy"
    62476216    {
    62486217                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID );
     
    62546223
    62556224/* Line 1806 of yacc.c  */
    6256 #line 1114 "parser.yy"
     6225#line 1108 "parser.yy"
    62576226    {
    62586227                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    62646233
    62656234/* Line 1806 of yacc.c  */
    6266 #line 1119 "parser.yy"
     6235#line 1113 "parser.yy"
    62676236    {
    62686237                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    62746243
    62756244/* Line 1806 of yacc.c  */
    6276 #line 1124 "parser.yy"
     6245#line 1118 "parser.yy"
    62776246    {
    62786247                        typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) );
     
    62846253
    62856254/* Line 1806 of yacc.c  */
    6286 #line 1132 "parser.yy"
     6255#line 1126 "parser.yy"
    62876256    {
    62886257                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62946263
    62956264/* Line 1806 of yacc.c  */
    6296 #line 1137 "parser.yy"
     6265#line 1131 "parser.yy"
    62976266    {
    62986267                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63046273
    63056274/* Line 1806 of yacc.c  */
    6306 #line 1142 "parser.yy"
     6275#line 1136 "parser.yy"
    63076276    {
    63086277                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63146283
    63156284/* Line 1806 of yacc.c  */
    6316 #line 1147 "parser.yy"
     6285#line 1141 "parser.yy"
    63176286    {
    63186287                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63246293
    63256294/* Line 1806 of yacc.c  */
    6326 #line 1152 "parser.yy"
     6295#line 1146 "parser.yy"
    63276296    {
    63286297                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    63346303
    63356304/* Line 1806 of yacc.c  */
    6336 #line 1183 "parser.yy"
     6305#line 1177 "parser.yy"
    63376306    {
    63386307                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    63436312
    63446313/* Line 1806 of yacc.c  */
    6345 #line 1187 "parser.yy"
     6314#line 1181 "parser.yy"
    63466315    {
    63476316                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    63526321
    63536322/* Line 1806 of yacc.c  */
    6354 #line 1194 "parser.yy"
     6323#line 1188 "parser.yy"
    63556324    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    63566325    break;
     
    63596328
    63606329/* Line 1806 of yacc.c  */
    6361 #line 1198 "parser.yy"
     6330#line 1192 "parser.yy"
    63626331    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); }
    63636332    break;
     
    63666335
    63676336/* Line 1806 of yacc.c  */
    6368 #line 1203 "parser.yy"
     6337#line 1197 "parser.yy"
    63696338    {
    63706339                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63766345
    63776346/* Line 1806 of yacc.c  */
    6378 #line 1208 "parser.yy"
     6347#line 1202 "parser.yy"
    63796348    {
    63806349                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63866355
    63876356/* Line 1806 of yacc.c  */
    6388 #line 1213 "parser.yy"
     6357#line 1207 "parser.yy"
    63896358    {
    63906359                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD );
     
    63966365
    63976366/* Line 1806 of yacc.c  */
    6398 #line 1224 "parser.yy"
     6367#line 1218 "parser.yy"
    63996368    {
    64006369                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64066375
    64076376/* Line 1806 of yacc.c  */
    6408 #line 1229 "parser.yy"
     6377#line 1223 "parser.yy"
    64096378    {
    64106379                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64166385
    64176386/* Line 1806 of yacc.c  */
    6418 #line 1234 "parser.yy"
     6387#line 1228 "parser.yy"
    64196388    {
    64206389                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64266395
    64276396/* Line 1806 of yacc.c  */
    6428 #line 1239 "parser.yy"
     6397#line 1233 "parser.yy"
    64296398    {
    64306399                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64366405
    64376406/* Line 1806 of yacc.c  */
    6438 #line 1244 "parser.yy"
     6407#line 1238 "parser.yy"
    64396408    {
    64406409                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64466415
    64476416/* Line 1806 of yacc.c  */
    6448 #line 1253 "parser.yy"
     6417#line 1247 "parser.yy"
    64496418    {
    64506419                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD );
     
    64566425
    64576426/* Line 1806 of yacc.c  */
    6458 #line 1258 "parser.yy"
     6427#line 1252 "parser.yy"
    64596428    {
    64606429                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD );
     
    64666435
    64676436/* Line 1806 of yacc.c  */
    6468 #line 1275 "parser.yy"
     6437#line 1269 "parser.yy"
    64696438    {
    64706439                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64766445
    64776446/* Line 1806 of yacc.c  */
    6478 #line 1280 "parser.yy"
     6447#line 1274 "parser.yy"
    64796448    {
    64806449                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64866455
    64876456/* Line 1806 of yacc.c  */
    6488 #line 1302 "parser.yy"
     6457#line 1296 "parser.yy"
    64896458    { (yyval.decl) = 0; }
    64906459    break;
     
    64936462
    64946463/* Line 1806 of yacc.c  */
    6495 #line 1314 "parser.yy"
     6464#line 1308 "parser.yy"
    64966465    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    64976466    break;
     
    65006469
    65016470/* Line 1806 of yacc.c  */
     6471#line 1319 "parser.yy"
     6472    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
     6473    break;
     6474
     6475  case 305:
     6476
     6477/* Line 1806 of yacc.c  */
     6478#line 1321 "parser.yy"
     6479    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
     6480    break;
     6481
     6482  case 306:
     6483
     6484/* Line 1806 of yacc.c  */
     6485#line 1323 "parser.yy"
     6486    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
     6487    break;
     6488
     6489  case 307:
     6490
     6491/* Line 1806 of yacc.c  */
    65026492#line 1325 "parser.yy"
    6503     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
    6504     break;
    6505 
    6506   case 305:
     6493    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
     6494    break;
     6495
     6496  case 308:
    65076497
    65086498/* Line 1806 of yacc.c  */
    65096499#line 1327 "parser.yy"
    6510     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
    6511     break;
    6512 
    6513   case 306:
     6500    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
     6501    break;
     6502
     6503  case 309:
    65146504
    65156505/* Line 1806 of yacc.c  */
    65166506#line 1329 "parser.yy"
    6517     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
    6518     break;
    6519 
    6520   case 307:
    6521 
    6522 /* Line 1806 of yacc.c  */
    6523 #line 1331 "parser.yy"
    6524     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
    6525     break;
    6526 
    6527   case 308:
    6528 
    6529 /* Line 1806 of yacc.c  */
    6530 #line 1333 "parser.yy"
    6531     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
    6532     break;
    6533 
    6534   case 309:
    6535 
    6536 /* Line 1806 of yacc.c  */
    6537 #line 1335 "parser.yy"
    65386507    {
    65396508                        typedefTable.enterScope();
     
    65446513
    65456514/* Line 1806 of yacc.c  */
    6546 #line 1339 "parser.yy"
     6515#line 1333 "parser.yy"
    65476516    {
    65486517                        typedefTable.leaveScope();
     
    65546523
    65556524/* Line 1806 of yacc.c  */
    6556 #line 1348 "parser.yy"
     6525#line 1342 "parser.yy"
    65576526    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    65586527    break;
     
    65616530
    65626531/* Line 1806 of yacc.c  */
    6563 #line 1350 "parser.yy"
     6532#line 1344 "parser.yy"
    65646533    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    65656534    break;
     
    65686537
    65696538/* Line 1806 of yacc.c  */
    6570 #line 1361 "parser.yy"
     6539#line 1355 "parser.yy"
    65716540    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    65726541    break;
     
    65756544
    65766545/* Line 1806 of yacc.c  */
     6546#line 1360 "parser.yy"
     6547    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
     6548    break;
     6549
     6550  case 317:
     6551
     6552/* Line 1806 of yacc.c  */
     6553#line 1362 "parser.yy"
     6554    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
     6555    break;
     6556
     6557  case 318:
     6558
     6559/* Line 1806 of yacc.c  */
     6560#line 1364 "parser.yy"
     6561    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
     6562    break;
     6563
     6564  case 319:
     6565
     6566/* Line 1806 of yacc.c  */
    65776567#line 1366 "parser.yy"
    6578     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
    6579     break;
    6580 
    6581   case 317:
    6582 
    6583 /* Line 1806 of yacc.c  */
    6584 #line 1368 "parser.yy"
    6585     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
    6586     break;
    6587 
    6588   case 318:
    6589 
    6590 /* Line 1806 of yacc.c  */
    6591 #line 1370 "parser.yy"
    6592     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
    6593     break;
    6594 
    6595   case 319:
    6596 
    6597 /* Line 1806 of yacc.c  */
    6598 #line 1372 "parser.yy"
    65996568    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
    66006569    break;
     
    66036572
    66046573/* Line 1806 of yacc.c  */
    6605 #line 1375 "parser.yy"
     6574#line 1369 "parser.yy"
    66066575    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; }
    66076576    break;
     
    66106579
    66116580/* Line 1806 of yacc.c  */
    6612 #line 1377 "parser.yy"
     6581#line 1371 "parser.yy"
    66136582    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
    66146583    break;
     
    66176586
    66186587/* Line 1806 of yacc.c  */
    6619 #line 1380 "parser.yy"
     6588#line 1374 "parser.yy"
    66206589    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; }
    66216590    break;
     
    66246593
    66256594/* Line 1806 of yacc.c  */
    6626 #line 1382 "parser.yy"
     6595#line 1376 "parser.yy"
    66276596    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    66286597    break;
     
    66316600
    66326601/* Line 1806 of yacc.c  */
     6602#line 1381 "parser.yy"
     6603    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     6604    break;
     6605
     6606  case 325:
     6607
     6608/* Line 1806 of yacc.c  */
     6609#line 1383 "parser.yy"
     6610    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
     6611    break;
     6612
     6613  case 326:
     6614
     6615/* Line 1806 of yacc.c  */
     6616#line 1385 "parser.yy"
     6617    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     6618    break;
     6619
     6620  case 327:
     6621
     6622/* Line 1806 of yacc.c  */
    66336623#line 1387 "parser.yy"
    6634     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
    6635     break;
    6636 
    6637   case 325:
     6624    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     6625    break;
     6626
     6627  case 328:
    66386628
    66396629/* Line 1806 of yacc.c  */
    66406630#line 1389 "parser.yy"
    6641     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    6642     break;
    6643 
    6644   case 326:
     6631    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
     6632    break;
     6633
     6634  case 329:
    66456635
    66466636/* Line 1806 of yacc.c  */
    66476637#line 1391 "parser.yy"
    6648     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    6649     break;
    6650 
    6651   case 327:
     6638    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
     6639    break;
     6640
     6641  case 330:
    66526642
    66536643/* Line 1806 of yacc.c  */
    66546644#line 1393 "parser.yy"
    6655     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    6656     break;
    6657 
    6658   case 328:
     6645    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
     6646    break;
     6647
     6648  case 331:
    66596649
    66606650/* Line 1806 of yacc.c  */
    66616651#line 1395 "parser.yy"
    6662     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
    6663     break;
    6664 
    6665   case 329:
     6652    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
     6653    break;
     6654
     6655  case 332:
    66666656
    66676657/* Line 1806 of yacc.c  */
    66686658#line 1397 "parser.yy"
    6669     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
    6670     break;
    6671 
    6672   case 330:
     6659    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     6660    break;
     6661
     6662  case 333:
    66736663
    66746664/* Line 1806 of yacc.c  */
    66756665#line 1399 "parser.yy"
    6676     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    6677     break;
    6678 
    6679   case 331:
     6666    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     6667    break;
     6668
     6669  case 334:
    66806670
    66816671/* Line 1806 of yacc.c  */
    66826672#line 1401 "parser.yy"
    6683     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    6684     break;
    6685 
    6686   case 332:
     6673    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     6674    break;
     6675
     6676  case 335:
    66876677
    66886678/* Line 1806 of yacc.c  */
    66896679#line 1403 "parser.yy"
    6690     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    6691     break;
    6692 
    6693   case 333:
     6680    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     6681    break;
     6682
     6683  case 336:
    66946684
    66956685/* Line 1806 of yacc.c  */
    66966686#line 1405 "parser.yy"
    6697     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    6698     break;
    6699 
    6700   case 334:
    6701 
    6702 /* Line 1806 of yacc.c  */
    6703 #line 1407 "parser.yy"
    6704     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    6705     break;
    6706 
    6707   case 335:
    6708 
    6709 /* Line 1806 of yacc.c  */
    6710 #line 1409 "parser.yy"
    6711     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    6712     break;
    6713 
    6714   case 336:
    6715 
    6716 /* Line 1806 of yacc.c  */
    6717 #line 1411 "parser.yy"
    67186687    { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    67196688    break;
     
    67226691
    67236692/* Line 1806 of yacc.c  */
     6693#line 1412 "parser.yy"
     6694    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6695    break;
     6696
     6697  case 339:
     6698
     6699/* Line 1806 of yacc.c  */
     6700#line 1414 "parser.yy"
     6701    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     6702    break;
     6703
     6704  case 340:
     6705
     6706/* Line 1806 of yacc.c  */
     6707#line 1416 "parser.yy"
     6708    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     6709    break;
     6710
     6711  case 341:
     6712
     6713/* Line 1806 of yacc.c  */
    67246714#line 1418 "parser.yy"
     6715    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
     6716    break;
     6717
     6718  case 343:
     6719
     6720/* Line 1806 of yacc.c  */
     6721#line 1424 "parser.yy"
     6722    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     6723    break;
     6724
     6725  case 345:
     6726
     6727/* Line 1806 of yacc.c  */
     6728#line 1431 "parser.yy"
    67256729    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    67266730    break;
    67276731
    6728   case 339:
    6729 
    6730 /* Line 1806 of yacc.c  */
    6731 #line 1420 "parser.yy"
     6732  case 346:
     6733
     6734/* Line 1806 of yacc.c  */
     6735#line 1433 "parser.yy"
    67326736    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    67336737    break;
    67346738
    6735   case 340:
    6736 
    6737 /* Line 1806 of yacc.c  */
    6738 #line 1422 "parser.yy"
     6739  case 347:
     6740
     6741/* Line 1806 of yacc.c  */
     6742#line 1435 "parser.yy"
     6743    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
     6744    break;
     6745
     6746  case 348:
     6747
     6748/* Line 1806 of yacc.c  */
     6749#line 1440 "parser.yy"
     6750    { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
     6751    break;
     6752
     6753  case 349:
     6754
     6755/* Line 1806 of yacc.c  */
     6756#line 1442 "parser.yy"
     6757    { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
     6758    break;
     6759
     6760  case 350:
     6761
     6762/* Line 1806 of yacc.c  */
     6763#line 1444 "parser.yy"
     6764    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
     6765    break;
     6766
     6767  case 351:
     6768
     6769/* Line 1806 of yacc.c  */
     6770#line 1446 "parser.yy"
     6771    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
     6772    break;
     6773
     6774  case 353:
     6775
     6776/* Line 1806 of yacc.c  */
     6777#line 1452 "parser.yy"
     6778    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6779    break;
     6780
     6781  case 354:
     6782
     6783/* Line 1806 of yacc.c  */
     6784#line 1454 "parser.yy"
     6785    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     6786    break;
     6787
     6788  case 355:
     6789
     6790/* Line 1806 of yacc.c  */
     6791#line 1456 "parser.yy"
    67396792    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    67406793    break;
    67416794
    6742   case 341:
    6743 
    6744 /* Line 1806 of yacc.c  */
    6745 #line 1424 "parser.yy"
    6746     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
    6747     break;
    6748 
    6749   case 343:
    6750 
    6751 /* Line 1806 of yacc.c  */
    6752 #line 1430 "parser.yy"
    6753     { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    6754     break;
    6755 
    6756   case 345:
    6757 
    6758 /* Line 1806 of yacc.c  */
    6759 #line 1437 "parser.yy"
     6795  case 357:
     6796
     6797/* Line 1806 of yacc.c  */
     6798#line 1462 "parser.yy"
    67606799    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    67616800    break;
    67626801
    6763   case 346:
    6764 
    6765 /* Line 1806 of yacc.c  */
    6766 #line 1439 "parser.yy"
     6802  case 358:
     6803
     6804/* Line 1806 of yacc.c  */
     6805#line 1464 "parser.yy"
    67676806    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    67686807    break;
    67696808
    6770   case 347:
    6771 
    6772 /* Line 1806 of yacc.c  */
    6773 #line 1441 "parser.yy"
    6774     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
    6775     break;
    6776 
    6777   case 348:
    6778 
    6779 /* Line 1806 of yacc.c  */
    6780 #line 1446 "parser.yy"
    6781     { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
    6782     break;
    6783 
    6784   case 349:
    6785 
    6786 /* Line 1806 of yacc.c  */
    6787 #line 1448 "parser.yy"
    6788     { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
    6789     break;
    6790 
    6791   case 350:
    6792 
    6793 /* Line 1806 of yacc.c  */
    6794 #line 1450 "parser.yy"
    6795     { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
    6796     break;
    6797 
    6798   case 351:
    6799 
    6800 /* Line 1806 of yacc.c  */
    6801 #line 1452 "parser.yy"
    6802     { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    6803     break;
    6804 
    6805   case 353:
    6806 
    6807 /* Line 1806 of yacc.c  */
    6808 #line 1458 "parser.yy"
     6809  case 360:
     6810
     6811/* Line 1806 of yacc.c  */
     6812#line 1470 "parser.yy"
    68096813    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68106814    break;
    68116815
    6812   case 354:
    6813 
    6814 /* Line 1806 of yacc.c  */
    6815 #line 1460 "parser.yy"
     6816  case 361:
     6817
     6818/* Line 1806 of yacc.c  */
     6819#line 1472 "parser.yy"
    68166820    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68176821    break;
    68186822
    6819   case 355:
    6820 
    6821 /* Line 1806 of yacc.c  */
    6822 #line 1462 "parser.yy"
     6823  case 362:
     6824
     6825/* Line 1806 of yacc.c  */
     6826#line 1474 "parser.yy"
    68236827    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    68246828    break;
    68256829
    6826   case 357:
    6827 
    6828 /* Line 1806 of yacc.c  */
    6829 #line 1468 "parser.yy"
    6830     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6831     break;
    6832 
    6833   case 358:
    6834 
    6835 /* Line 1806 of yacc.c  */
    6836 #line 1470 "parser.yy"
     6830  case 363:
     6831
     6832/* Line 1806 of yacc.c  */
     6833#line 1479 "parser.yy"
     6834    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
     6835    break;
     6836
     6837  case 364:
     6838
     6839/* Line 1806 of yacc.c  */
     6840#line 1481 "parser.yy"
     6841    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6842    break;
     6843
     6844  case 365:
     6845
     6846/* Line 1806 of yacc.c  */
     6847#line 1483 "parser.yy"
    68376848    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68386849    break;
    68396850
    6840   case 360:
    6841 
    6842 /* Line 1806 of yacc.c  */
    6843 #line 1476 "parser.yy"
    6844     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6845     break;
    6846 
    6847   case 361:
    6848 
    6849 /* Line 1806 of yacc.c  */
    6850 #line 1478 "parser.yy"
    6851     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    6852     break;
    6853 
    6854   case 362:
    6855 
    6856 /* Line 1806 of yacc.c  */
    6857 #line 1480 "parser.yy"
    6858     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    6859     break;
    6860 
    6861   case 363:
    6862 
    6863 /* Line 1806 of yacc.c  */
    6864 #line 1485 "parser.yy"
    6865     { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
    6866     break;
    6867 
    6868   case 364:
    6869 
    6870 /* Line 1806 of yacc.c  */
    6871 #line 1487 "parser.yy"
    6872     { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6873     break;
    6874 
    6875   case 365:
    6876 
    6877 /* Line 1806 of yacc.c  */
    6878 #line 1489 "parser.yy"
    6879     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    6880     break;
    6881 
    68826851  case 368:
    68836852
    68846853/* Line 1806 of yacc.c  */
    6885 #line 1499 "parser.yy"
     6854#line 1493 "parser.yy"
    68866855    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), nullptr, nullptr, (yyvsp[(3) - (4)].decl), true ); }
    68876856    break;
     
    68906859
    68916860/* Line 1806 of yacc.c  */
    6892 #line 1501 "parser.yy"
     6861#line 1495 "parser.yy"
    68936862    {
    68946863                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    69006869
    69016870/* Line 1806 of yacc.c  */
     6871#line 1500 "parser.yy"
     6872    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
     6873    break;
     6874
     6875  case 371:
     6876
     6877/* Line 1806 of yacc.c  */
     6878#line 1502 "parser.yy"
     6879    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), nullptr, (yyvsp[(5) - (6)].decl), true ); }
     6880    break;
     6881
     6882  case 372:
     6883
     6884/* Line 1806 of yacc.c  */
     6885#line 1504 "parser.yy"
     6886    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), nullptr, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
     6887    break;
     6888
     6889  case 373:
     6890
     6891/* Line 1806 of yacc.c  */
    69026892#line 1506 "parser.yy"
    6903     { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    6904     break;
    6905 
    6906   case 371:
    6907 
    6908 /* Line 1806 of yacc.c  */
    6909 #line 1508 "parser.yy"
    6910     { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), nullptr, (yyvsp[(5) - (6)].decl), true ); }
    6911     break;
    6912 
    6913   case 372:
    6914 
    6915 /* Line 1806 of yacc.c  */
    6916 #line 1510 "parser.yy"
    6917     { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), nullptr, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
    6918     break;
    6919 
    6920   case 373:
    6921 
    6922 /* Line 1806 of yacc.c  */
    6923 #line 1512 "parser.yy"
    69246893    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    69256894    break;
     
    69286897
    69296898/* Line 1806 of yacc.c  */
    6930 #line 1517 "parser.yy"
     6899#line 1511 "parser.yy"
    69316900    { (yyval.aggKey) = DeclarationNode::Struct; }
    69326901    break;
     
    69356904
    69366905/* Line 1806 of yacc.c  */
    6937 #line 1519 "parser.yy"
     6906#line 1513 "parser.yy"
    69386907    { (yyval.aggKey) = DeclarationNode::Union; }
    69396908    break;
     
    69426911
    69436912/* Line 1806 of yacc.c  */
    6944 #line 1524 "parser.yy"
     6913#line 1518 "parser.yy"
    69456914    { (yyval.decl) = 0; }
    69466915    break;
     
    69496918
    69506919/* Line 1806 of yacc.c  */
     6920#line 1520 "parser.yy"
     6921    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
     6922    break;
     6923
     6924  case 379:
     6925
     6926/* Line 1806 of yacc.c  */
    69516927#line 1526 "parser.yy"
    6952     { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    6953     break;
    6954 
    6955   case 379:
    6956 
    6957 /* Line 1806 of yacc.c  */
    6958 #line 1532 "parser.yy"
    69596928    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); }
    69606929    break;
     
    69636932
    69646933/* Line 1806 of yacc.c  */
    6965 #line 1535 "parser.yy"
     6934#line 1529 "parser.yy"
    69666935    {   // mark all fields in list
    69676936                        for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    69746943
    69756944/* Line 1806 of yacc.c  */
    6976 #line 1545 "parser.yy"
     6945#line 1539 "parser.yy"
    69776946    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }
    69786947    break;
     
    69816950
    69826951/* Line 1806 of yacc.c  */
    6983 #line 1547 "parser.yy"
     6952#line 1541 "parser.yy"
    69846953    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }
    69856954    break;
     
    69886957
    69896958/* Line 1806 of yacc.c  */
    6990 #line 1549 "parser.yy"
     6959#line 1543 "parser.yy"
    69916960    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); }
    69926961    break;
     
    69956964
    69966965/* Line 1806 of yacc.c  */
    6997 #line 1554 "parser.yy"
     6966#line 1548 "parser.yy"
    69986967    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    69996968    break;
     
    70026971
    70036972/* Line 1806 of yacc.c  */
    7004 #line 1556 "parser.yy"
     6973#line 1550 "parser.yy"
    70056974    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); }
    70066975    break;
     
    70096978
    70106979/* Line 1806 of yacc.c  */
    7011 #line 1561 "parser.yy"
     6980#line 1555 "parser.yy"
    70126981    { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }
    70136982    break;
     
    70166985
    70176986/* Line 1806 of yacc.c  */
     6987#line 1557 "parser.yy"
     6988    { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }
     6989    break;
     6990
     6991  case 390:
     6992
     6993/* Line 1806 of yacc.c  */
     6994#line 1560 "parser.yy"
     6995    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
     6996    break;
     6997
     6998  case 391:
     6999
     7000/* Line 1806 of yacc.c  */
    70187001#line 1563 "parser.yy"
    7019     { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }
    7020     break;
    7021 
    7022   case 390:
    7023 
    7024 /* Line 1806 of yacc.c  */
    7025 #line 1566 "parser.yy"
    70267002    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    70277003    break;
    70287004
    7029   case 391:
     7005  case 393:
    70307006
    70317007/* Line 1806 of yacc.c  */
    70327008#line 1569 "parser.yy"
    7033     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    7034     break;
    7035 
    7036   case 393:
    7037 
    7038 /* Line 1806 of yacc.c  */
    7039 #line 1575 "parser.yy"
    70407009    { (yyval.en) = 0; }
    70417010    break;
     
    70447013
    70457014/* Line 1806 of yacc.c  */
    7046 #line 1577 "parser.yy"
     7015#line 1571 "parser.yy"
    70477016    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    70487017    break;
     
    70517020
    70527021/* Line 1806 of yacc.c  */
    7053 #line 1582 "parser.yy"
     7022#line 1576 "parser.yy"
    70547023    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    70557024    break;
     
    70587027
    70597028/* Line 1806 of yacc.c  */
    7060 #line 1591 "parser.yy"
     7029#line 1585 "parser.yy"
    70617030    { (yyval.decl) = DeclarationNode::newEnum( nullptr, (yyvsp[(3) - (5)].decl) ); }
    70627031    break;
     
    70657034
    70667035/* Line 1806 of yacc.c  */
    7067 #line 1593 "parser.yy"
     7036#line 1587 "parser.yy"
    70687037    {
    70697038                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    70757044
    70767045/* Line 1806 of yacc.c  */
    7077 #line 1598 "parser.yy"
     7046#line 1592 "parser.yy"
    70787047    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    70797048    break;
     
    70827051
    70837052/* Line 1806 of yacc.c  */
    7084 #line 1600 "parser.yy"
     7053#line 1594 "parser.yy"
    70857054    { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); }
    70867055    break;
     
    70897058
    70907059/* Line 1806 of yacc.c  */
    7091 #line 1605 "parser.yy"
     7060#line 1599 "parser.yy"
    70927061    { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }
    70937062    break;
     
    70967065
    70977066/* Line 1806 of yacc.c  */
    7098 #line 1607 "parser.yy"
     7067#line 1601 "parser.yy"
    70997068    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); }
    71007069    break;
     
    71037072
    71047073/* Line 1806 of yacc.c  */
    7105 #line 1612 "parser.yy"
     7074#line 1606 "parser.yy"
    71067075    { (yyval.en) = 0; }
    71077076    break;
     
    71107079
    71117080/* Line 1806 of yacc.c  */
    7112 #line 1614 "parser.yy"
     7081#line 1608 "parser.yy"
    71137082    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    71147083    break;
     
    71177086
    71187087/* Line 1806 of yacc.c  */
    7119 #line 1621 "parser.yy"
     7088#line 1615 "parser.yy"
    71207089    { (yyval.decl) = 0; }
    71217090    break;
     
    71247093
    71257094/* Line 1806 of yacc.c  */
    7126 #line 1629 "parser.yy"
     7095#line 1623 "parser.yy"
    71277096    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71287097    break;
     
    71317100
    71327101/* Line 1806 of yacc.c  */
    7133 #line 1631 "parser.yy"
     7102#line 1625 "parser.yy"
    71347103    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71357104    break;
     
    71387107
    71397108/* Line 1806 of yacc.c  */
    7140 #line 1633 "parser.yy"
     7109#line 1627 "parser.yy"
    71417110    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71427111    break;
     
    71457114
    71467115/* Line 1806 of yacc.c  */
    7147 #line 1641 "parser.yy"
     7116#line 1635 "parser.yy"
    71487117    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71497118    break;
     
    71527121
    71537122/* Line 1806 of yacc.c  */
    7154 #line 1643 "parser.yy"
     7123#line 1637 "parser.yy"
    71557124    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71567125    break;
     
    71597128
    71607129/* Line 1806 of yacc.c  */
     7130#line 1639 "parser.yy"
     7131    { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
     7132    break;
     7133
     7134  case 417:
     7135
     7136/* Line 1806 of yacc.c  */
    71617137#line 1645 "parser.yy"
    7162     { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
    7163     break;
    7164 
    7165   case 417:
    7166 
    7167 /* Line 1806 of yacc.c  */
    7168 #line 1651 "parser.yy"
    71697138    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71707139    break;
     
    71737142
    71747143/* Line 1806 of yacc.c  */
    7175 #line 1656 "parser.yy"
     7144#line 1650 "parser.yy"
    71767145    { (yyval.decl) = 0; }
    71777146    break;
     
    71807149
    71817150/* Line 1806 of yacc.c  */
    7182 #line 1663 "parser.yy"
     7151#line 1657 "parser.yy"
    71837152    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71847153    break;
     
    71877156
    71887157/* Line 1806 of yacc.c  */
    7189 #line 1670 "parser.yy"
     7158#line 1664 "parser.yy"
    71907159    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71917160    break;
     
    71947163
    71957164/* Line 1806 of yacc.c  */
    7196 #line 1672 "parser.yy"
     7165#line 1666 "parser.yy"
    71977166    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71987167    break;
     
    72017170
    72027171/* Line 1806 of yacc.c  */
    7203 #line 1681 "parser.yy"
     7172#line 1675 "parser.yy"
    72047173    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    72057174    break;
     
    72087177
    72097178/* Line 1806 of yacc.c  */
    7210 #line 1684 "parser.yy"
     7179#line 1678 "parser.yy"
    72117180    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    72127181    break;
     
    72157184
    72167185/* Line 1806 of yacc.c  */
    7217 #line 1686 "parser.yy"
     7186#line 1680 "parser.yy"
    72187187    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); }
    72197188    break;
     
    72227191
    72237192/* Line 1806 of yacc.c  */
     7193#line 1690 "parser.yy"
     7194    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     7195    break;
     7196
     7197  case 436:
     7198
     7199/* Line 1806 of yacc.c  */
    72247200#line 1696 "parser.yy"
    7225     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    7226     break;
    7227 
    7228   case 436:
    7229 
    7230 /* Line 1806 of yacc.c  */
    7231 #line 1702 "parser.yy"
    72327201    {
    72337202                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    72397208
    72407209/* Line 1806 of yacc.c  */
    7241 #line 1707 "parser.yy"
     7210#line 1701 "parser.yy"
    72427211    {
    72437212                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    72497218
    72507219/* Line 1806 of yacc.c  */
    7251 #line 1716 "parser.yy"
     7220#line 1710 "parser.yy"
    72527221    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72537222    break;
     
    72567225
    72577226/* Line 1806 of yacc.c  */
    7258 #line 1725 "parser.yy"
     7227#line 1719 "parser.yy"
    72597228    { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }
    72607229    break;
     
    72637232
    72647233/* Line 1806 of yacc.c  */
    7265 #line 1727 "parser.yy"
     7234#line 1721 "parser.yy"
    72667235    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); }
    72677236    break;
     
    72707239
    72717240/* Line 1806 of yacc.c  */
    7272 #line 1752 "parser.yy"
     7241#line 1746 "parser.yy"
    72737242    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72747243    break;
     
    72777246
    72787247/* Line 1806 of yacc.c  */
    7279 #line 1760 "parser.yy"
     7248#line 1754 "parser.yy"
    72807249    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72817250    break;
     
    72847253
    72857254/* Line 1806 of yacc.c  */
    7286 #line 1765 "parser.yy"
     7255#line 1759 "parser.yy"
    72877256    { (yyval.in) = 0; }
    72887257    break;
     
    72917260
    72927261/* Line 1806 of yacc.c  */
     7262#line 1761 "parser.yy"
     7263    { (yyval.in) = (yyvsp[(2) - (2)].in); }
     7264    break;
     7265
     7266  case 460:
     7267
     7268/* Line 1806 of yacc.c  */
     7269#line 1763 "parser.yy"
     7270    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
     7271    break;
     7272
     7273  case 461:
     7274
     7275/* Line 1806 of yacc.c  */
    72937276#line 1767 "parser.yy"
    7294     { (yyval.in) = (yyvsp[(2) - (2)].in); }
    7295     break;
    7296 
    7297   case 460:
    7298 
    7299 /* Line 1806 of yacc.c  */
    7300 #line 1769 "parser.yy"
    7301     { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
    7302     break;
    7303 
    7304   case 461:
     7277    { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
     7278    break;
     7279
     7280  case 462:
     7281
     7282/* Line 1806 of yacc.c  */
     7283#line 1768 "parser.yy"
     7284    { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
     7285    break;
     7286
     7287  case 463:
    73057288
    73067289/* Line 1806 of yacc.c  */
    73077290#line 1773 "parser.yy"
    7308     { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
    7309     break;
    7310 
    7311   case 462:
    7312 
    7313 /* Line 1806 of yacc.c  */
    7314 #line 1774 "parser.yy"
    7315     { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
    7316     break;
    7317 
    7318   case 463:
    7319 
    7320 /* Line 1806 of yacc.c  */
    7321 #line 1779 "parser.yy"
    73227291    { (yyval.in) = 0; }
    73237292    break;
     
    73267295
    73277296/* Line 1806 of yacc.c  */
    7328 #line 1781 "parser.yy"
     7297#line 1775 "parser.yy"
    73297298    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); }
    73307299    break;
     
    73337302
    73347303/* Line 1806 of yacc.c  */
    7335 #line 1782 "parser.yy"
     7304#line 1776 "parser.yy"
    73367305    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); }
    73377306    break;
     
    73407309
    73417310/* Line 1806 of yacc.c  */
    7342 #line 1784 "parser.yy"
     7311#line 1778 "parser.yy"
    73437312    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_last( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); }
    73447313    break;
     
    73477316
    73487317/* Line 1806 of yacc.c  */
     7318#line 1794 "parser.yy"
     7319    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); }
     7320    break;
     7321
     7322  case 471:
     7323
     7324/* Line 1806 of yacc.c  */
    73497325#line 1800 "parser.yy"
    7350     { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); }
    7351     break;
    7352 
    7353   case 471:
     7326    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); }
     7327    break;
     7328
     7329  case 472:
    73547330
    73557331/* Line 1806 of yacc.c  */
    73567332#line 1806 "parser.yy"
    7357     { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); }
    7358     break;
    7359 
    7360   case 472:
    7361 
    7362 /* Line 1806 of yacc.c  */
    7363 #line 1812 "parser.yy"
    73647333    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(2) - (2)].tok) ) ); }
    73657334    break;
     
    73687337
    73697338/* Line 1806 of yacc.c  */
     7339#line 1809 "parser.yy"
     7340    { (yyval.en) = (yyvsp[(3) - (5)].en); }
     7341    break;
     7342
     7343  case 474:
     7344
     7345/* Line 1806 of yacc.c  */
     7346#line 1811 "parser.yy"
     7347    { (yyval.en) = (yyvsp[(3) - (5)].en); }
     7348    break;
     7349
     7350  case 475:
     7351
     7352/* Line 1806 of yacc.c  */
     7353#line 1813 "parser.yy"
     7354    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }
     7355    break;
     7356
     7357  case 476:
     7358
     7359/* Line 1806 of yacc.c  */
    73707360#line 1815 "parser.yy"
    7371     { (yyval.en) = (yyvsp[(3) - (5)].en); }
    7372     break;
    7373 
    7374   case 474:
    7375 
    7376 /* Line 1806 of yacc.c  */
    7377 #line 1817 "parser.yy"
    7378     { (yyval.en) = (yyvsp[(3) - (5)].en); }
    7379     break;
    7380 
    7381   case 475:
    7382 
    7383 /* Line 1806 of yacc.c  */
    7384 #line 1819 "parser.yy"
    7385     { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }
    7386     break;
    7387 
    7388   case 476:
    7389 
    7390 /* Line 1806 of yacc.c  */
    7391 #line 1821 "parser.yy"
    73927361    { (yyval.en) = (yyvsp[(4) - (6)].en); }
    73937362    break;
     
    73967365
    73977366/* Line 1806 of yacc.c  */
    7398 #line 1845 "parser.yy"
     7367#line 1839 "parser.yy"
    73997368    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    74007369    break;
     
    74037372
    74047373/* Line 1806 of yacc.c  */
    7405 #line 1847 "parser.yy"
     7374#line 1841 "parser.yy"
    74067375    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    74077376    break;
     
    74107379
    74117380/* Line 1806 of yacc.c  */
     7381#line 1843 "parser.yy"
     7382    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     7383    break;
     7384
     7385  case 482:
     7386
     7387/* Line 1806 of yacc.c  */
    74127388#line 1849 "parser.yy"
    7413     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    7414     break;
    7415 
    7416   case 482:
    7417 
    7418 /* Line 1806 of yacc.c  */
    7419 #line 1855 "parser.yy"
    74207389    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    74217390    break;
     
    74247393
    74257394/* Line 1806 of yacc.c  */
    7426 #line 1857 "parser.yy"
     7395#line 1851 "parser.yy"
    74277396    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    74287397    break;
     
    74317400
    74327401/* Line 1806 of yacc.c  */
     7402#line 1856 "parser.yy"
     7403    { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
     7404    break;
     7405
     7406  case 486:
     7407
     7408/* Line 1806 of yacc.c  */
    74337409#line 1862 "parser.yy"
    7434     { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    7435     break;
    7436 
    7437   case 486:
    7438 
    7439 /* Line 1806 of yacc.c  */
    7440 #line 1868 "parser.yy"
    74417410    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); }
    74427411    break;
     
    74457414
    74467415/* Line 1806 of yacc.c  */
    7447 #line 1873 "parser.yy"
     7416#line 1867 "parser.yy"
    74487417    { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }
    74497418    break;
     
    74527421
    74537422/* Line 1806 of yacc.c  */
     7423#line 1869 "parser.yy"
     7424    { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }
     7425    break;
     7426
     7427  case 490:
     7428
     7429/* Line 1806 of yacc.c  */
    74547430#line 1875 "parser.yy"
    7455     { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }
    7456     break;
    7457 
    7458   case 490:
    7459 
    7460 /* Line 1806 of yacc.c  */
    7461 #line 1881 "parser.yy"
    74627431    { (yyval.tclass) = DeclarationNode::Otype; }
    74637432    break;
     
    74667435
    74677436/* Line 1806 of yacc.c  */
    7468 #line 1883 "parser.yy"
     7437#line 1877 "parser.yy"
    74697438    { (yyval.tclass) = DeclarationNode::Ftype; }
    74707439    break;
     
    74737442
    74747443/* Line 1806 of yacc.c  */
    7475 #line 1885 "parser.yy"
     7444#line 1879 "parser.yy"
    74767445    { (yyval.tclass) = DeclarationNode::Dtype; }
    74777446    break;
     
    74807449
    74817450/* Line 1806 of yacc.c  */
    7482 #line 1890 "parser.yy"
     7451#line 1884 "parser.yy"
    74837452    { (yyval.decl) = 0; }
    74847453    break;
     
    74877456
    74887457/* Line 1806 of yacc.c  */
    7489 #line 1892 "parser.yy"
     7458#line 1886 "parser.yy"
    74907459    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    74917460    break;
     
    74947463
    74957464/* Line 1806 of yacc.c  */
    7496 #line 1897 "parser.yy"
     7465#line 1891 "parser.yy"
    74977466    {
    74987467                        typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) );
     
    75047473
    75057474/* Line 1806 of yacc.c  */
    7506 #line 1902 "parser.yy"
     7475#line 1896 "parser.yy"
    75077476    { (yyval.decl) = (yyvsp[(4) - (5)].decl); }
    75087477    break;
     
    75117480
    75127481/* Line 1806 of yacc.c  */
    7513 #line 1904 "parser.yy"
     7482#line 1898 "parser.yy"
    75147483    { (yyval.decl) = 0; }
    75157484    break;
     
    75187487
    75197488/* Line 1806 of yacc.c  */
    7520 #line 1909 "parser.yy"
     7489#line 1903 "parser.yy"
    75217490    { (yyval.en) = new ExpressionNode( build_typevalue( (yyvsp[(1) - (1)].decl) ) ); }
    75227491    break;
     
    75257494
    75267495/* Line 1806 of yacc.c  */
    7527 #line 1912 "parser.yy"
     7496#line 1906 "parser.yy"
    75287497    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); }
    75297498    break;
     
    75327501
    75337502/* Line 1806 of yacc.c  */
    7534 #line 1914 "parser.yy"
     7503#line 1908 "parser.yy"
    75357504    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    75367505    break;
     
    75397508
    75407509/* Line 1806 of yacc.c  */
    7541 #line 1919 "parser.yy"
     7510#line 1913 "parser.yy"
    75427511    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    75437512    break;
     
    75467515
    75477516/* Line 1806 of yacc.c  */
    7548 #line 1921 "parser.yy"
     7517#line 1915 "parser.yy"
    75497518    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }
    75507519    break;
     
    75537522
    75547523/* Line 1806 of yacc.c  */
    7555 #line 1923 "parser.yy"
     7524#line 1917 "parser.yy"
    75567525    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); }
    75577526    break;
     
    75607529
    75617530/* Line 1806 of yacc.c  */
    7562 #line 1928 "parser.yy"
     7531#line 1922 "parser.yy"
    75637532    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }
    75647533    break;
     
    75677536
    75687537/* Line 1806 of yacc.c  */
    7569 #line 1930 "parser.yy"
     7538#line 1924 "parser.yy"
    75707539    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); }
    75717540    break;
     
    75747543
    75757544/* Line 1806 of yacc.c  */
    7576 #line 1935 "parser.yy"
     7545#line 1929 "parser.yy"
    75777546    {
    75787547                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD );
     
    75847553
    75857554/* Line 1806 of yacc.c  */
    7586 #line 1940 "parser.yy"
     7555#line 1934 "parser.yy"
    75877556    {
    75887557                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG );
     
    75947563
    75957564/* Line 1806 of yacc.c  */
    7596 #line 1948 "parser.yy"
     7565#line 1942 "parser.yy"
    75977566    {
    75987567                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID );
     
    76047573
    76057574/* Line 1806 of yacc.c  */
    7606 #line 1953 "parser.yy"
     7575#line 1947 "parser.yy"
    76077576    {
    76087577                        typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) );
     
    76147583
    76157584/* Line 1806 of yacc.c  */
    7616 #line 1958 "parser.yy"
     7585#line 1952 "parser.yy"
    76177586    {
    76187587                        typedefTable.leaveTrait();
     
    76257594
    76267595/* Line 1806 of yacc.c  */
    7627 #line 1968 "parser.yy"
     7596#line 1962 "parser.yy"
    76287597    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    76297598    break;
     
    76327601
    76337602/* Line 1806 of yacc.c  */
    7634 #line 1978 "parser.yy"
     7603#line 1972 "parser.yy"
    76357604    {
    76367605                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76427611
    76437612/* Line 1806 of yacc.c  */
    7644 #line 1983 "parser.yy"
     7613#line 1977 "parser.yy"
    76457614    {
    76467615                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76527621
    76537622/* Line 1806 of yacc.c  */
    7654 #line 1988 "parser.yy"
     7623#line 1982 "parser.yy"
    76557624    {
    76567625                        typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    76627631
    76637632/* Line 1806 of yacc.c  */
    7664 #line 1996 "parser.yy"
     7633#line 1990 "parser.yy"
    76657634    {
    76667635                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76727641
    76737642/* Line 1806 of yacc.c  */
    7674 #line 2001 "parser.yy"
     7643#line 1995 "parser.yy"
    76757644    {
    76767645                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76827651
    76837652/* Line 1806 of yacc.c  */
    7684 #line 2011 "parser.yy"
     7653#line 2005 "parser.yy"
    76857654    {}
    76867655    break;
     
    76897658
    76907659/* Line 1806 of yacc.c  */
     7660#line 2007 "parser.yy"
     7661    { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl);    }
     7662    break;
     7663
     7664  case 524:
     7665
     7666/* Line 1806 of yacc.c  */
    76917667#line 2013 "parser.yy"
    7692     { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl);    }
    7693     break;
    7694 
    7695   case 524:
    7696 
    7697 /* Line 1806 of yacc.c  */
    7698 #line 2019 "parser.yy"
    76997668    { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }
    77007669    break;
     
    77037672
    77047673/* Line 1806 of yacc.c  */
    7705 #line 2024 "parser.yy"
     7674#line 2018 "parser.yy"
    77067675    { (yyval.decl) = 0; }
    77077676    break;
     
    77107679
    77117680/* Line 1806 of yacc.c  */
    7712 #line 2032 "parser.yy"
     7681#line 2026 "parser.yy"
    77137682    {}
    77147683    break;
     
    77177686
    77187687/* Line 1806 of yacc.c  */
    7719 #line 2034 "parser.yy"
     7688#line 2028 "parser.yy"
    77207689    {
    77217690                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
     
    77277696
    77287697/* Line 1806 of yacc.c  */
    7729 #line 2039 "parser.yy"
     7698#line 2033 "parser.yy"
    77307699    {
    77317700                        linkage = linkageStack.top();
     
    77387707
    77397708/* Line 1806 of yacc.c  */
    7740 #line 2045 "parser.yy"
     7709#line 2039 "parser.yy"
    77417710    {   // mark all fields in list
    77427711                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    77497718
    77507719/* Line 1806 of yacc.c  */
    7751 #line 2060 "parser.yy"
     7720#line 2054 "parser.yy"
    77527721    {
    77537722                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77607729
    77617730/* Line 1806 of yacc.c  */
    7762 #line 2066 "parser.yy"
     7731#line 2060 "parser.yy"
    77637732    {
    77647733                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77717740
    77727741/* Line 1806 of yacc.c  */
    7773 #line 2075 "parser.yy"
     7742#line 2069 "parser.yy"
    77747743    {
    77757744                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77827751
    77837752/* Line 1806 of yacc.c  */
    7784 #line 2081 "parser.yy"
     7753#line 2075 "parser.yy"
    77857754    {
    77867755                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77917760
    77927761  case 538:
     7762
     7763/* Line 1806 of yacc.c  */
     7764#line 2081 "parser.yy"
     7765    {
     7766                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     7767                        typedefTable.leaveScope();
     7768                        (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) );
     7769                }
     7770    break;
     7771
     7772  case 539:
    77937773
    77947774/* Line 1806 of yacc.c  */
     
    78017781    break;
    78027782
    7803   case 539:
     7783  case 540:
    78047784
    78057785/* Line 1806 of yacc.c  */
    78067786#line 2093 "parser.yy"
    7807     {
    7808                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    7809                         typedefTable.leaveScope();
    7810                         (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) );
    7811                 }
    7812     break;
    7813 
    7814   case 540:
    7815 
    7816 /* Line 1806 of yacc.c  */
    7817 #line 2099 "parser.yy"
    78187787    {
    78197788                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78267795
    78277796/* Line 1806 of yacc.c  */
    7828 #line 2107 "parser.yy"
     7797#line 2101 "parser.yy"
    78297798    {
    78307799                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78377806
    78387807/* Line 1806 of yacc.c  */
    7839 #line 2113 "parser.yy"
     7808#line 2107 "parser.yy"
    78407809    {
    78417810                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78487817
    78497818/* Line 1806 of yacc.c  */
    7850 #line 2121 "parser.yy"
     7819#line 2115 "parser.yy"
    78517820    {
    78527821                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78597828
    78607829/* Line 1806 of yacc.c  */
    7861 #line 2127 "parser.yy"
     7830#line 2121 "parser.yy"
    78627831    {
    78637832                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78707839
    78717840/* Line 1806 of yacc.c  */
    7872 #line 2142 "parser.yy"
     7841#line 2136 "parser.yy"
    78737842    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    78747843    break;
     
    78777846
    78787847/* Line 1806 of yacc.c  */
    7879 #line 2147 "parser.yy"
     7848#line 2141 "parser.yy"
    78807849    { delete (yyvsp[(3) - (5)].str); }
    78817850    break;
     
    78847853
    78857854/* Line 1806 of yacc.c  */
    7886 #line 2152 "parser.yy"
     7855#line 2146 "parser.yy"
    78877856    { (yyval.decl) = 0; }
    78887857    break;
     
    78917860
    78927861/* Line 1806 of yacc.c  */
     7862#line 2153 "parser.yy"
     7863    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     7864    break;
     7865
     7866  case 555:
     7867
     7868/* Line 1806 of yacc.c  */
    78937869#line 2159 "parser.yy"
    7894     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    7895     break;
    7896 
    7897   case 555:
    7898 
    7899 /* Line 1806 of yacc.c  */
    7900 #line 2165 "parser.yy"
    79017870    { (yyval.decl) = 0; }
    79027871    break;
     
    79057874
    79067875/* Line 1806 of yacc.c  */
     7876#line 2170 "parser.yy"
     7877    { delete (yyvsp[(3) - (4)].en); }
     7878    break;
     7879
     7880  case 561:
     7881
     7882/* Line 1806 of yacc.c  */
     7883#line 2174 "parser.yy"
     7884    { delete (yyvsp[(1) - (1)].tok); }
     7885    break;
     7886
     7887  case 562:
     7888
     7889/* Line 1806 of yacc.c  */
     7890#line 2175 "parser.yy"
     7891    { delete (yyvsp[(1) - (1)].decl); }
     7892    break;
     7893
     7894  case 563:
     7895
     7896/* Line 1806 of yacc.c  */
    79077897#line 2176 "parser.yy"
    7908     { delete (yyvsp[(3) - (4)].en); }
    7909     break;
    7910 
    7911   case 561:
    7912 
    7913 /* Line 1806 of yacc.c  */
    7914 #line 2180 "parser.yy"
    7915     { delete (yyvsp[(1) - (1)].tok); }
    7916     break;
    7917 
    7918   case 562:
    7919 
    7920 /* Line 1806 of yacc.c  */
    7921 #line 2181 "parser.yy"
    79227898    { delete (yyvsp[(1) - (1)].decl); }
    79237899    break;
    79247900
    7925   case 563:
    7926 
    7927 /* Line 1806 of yacc.c  */
    7928 #line 2182 "parser.yy"
     7901  case 564:
     7902
     7903/* Line 1806 of yacc.c  */
     7904#line 2177 "parser.yy"
    79297905    { delete (yyvsp[(1) - (1)].decl); }
    79307906    break;
    79317907
    7932   case 564:
    7933 
    7934 /* Line 1806 of yacc.c  */
    7935 #line 2183 "parser.yy"
    7936     { delete (yyvsp[(1) - (1)].decl); }
    7937     break;
    7938 
    79397908  case 565:
    79407909
    79417910/* Line 1806 of yacc.c  */
    7942 #line 2218 "parser.yy"
     7911#line 2212 "parser.yy"
    79437912    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79447913    break;
     
    79477916
    79487917/* Line 1806 of yacc.c  */
    7949 #line 2221 "parser.yy"
     7918#line 2215 "parser.yy"
    79507919    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79517920    break;
     
    79547923
    79557924/* Line 1806 of yacc.c  */
    7956 #line 2223 "parser.yy"
     7925#line 2217 "parser.yy"
    79577926    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79587927    break;
     
    79617930
    79627931/* Line 1806 of yacc.c  */
    7963 #line 2228 "parser.yy"
     7932#line 2222 "parser.yy"
    79647933    {
    79657934                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    79717940
    79727941/* Line 1806 of yacc.c  */
    7973 #line 2233 "parser.yy"
     7942#line 2227 "parser.yy"
    79747943    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    79757944    break;
     
    79787947
    79797948/* Line 1806 of yacc.c  */
    7980 #line 2238 "parser.yy"
     7949#line 2232 "parser.yy"
    79817950    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    79827951    break;
     
    79857954
    79867955/* Line 1806 of yacc.c  */
    7987 #line 2240 "parser.yy"
     7956#line 2234 "parser.yy"
    79887957    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    79897958    break;
     
    79927961
    79937962/* Line 1806 of yacc.c  */
    7994 #line 2242 "parser.yy"
     7963#line 2236 "parser.yy"
    79957964    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    79967965    break;
     
    79997968
    80007969/* Line 1806 of yacc.c  */
     7970#line 2241 "parser.yy"
     7971    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     7972    break;
     7973
     7974  case 575:
     7975
     7976/* Line 1806 of yacc.c  */
     7977#line 2243 "parser.yy"
     7978    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     7979    break;
     7980
     7981  case 576:
     7982
     7983/* Line 1806 of yacc.c  */
     7984#line 2245 "parser.yy"
     7985    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     7986    break;
     7987
     7988  case 577:
     7989
     7990/* Line 1806 of yacc.c  */
    80017991#line 2247 "parser.yy"
     7992    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     7993    break;
     7994
     7995  case 578:
     7996
     7997/* Line 1806 of yacc.c  */
     7998#line 2252 "parser.yy"
     7999    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8000    break;
     8001
     8002  case 579:
     8003
     8004/* Line 1806 of yacc.c  */
     8005#line 2254 "parser.yy"
     8006    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8007    break;
     8008
     8009  case 580:
     8010
     8011/* Line 1806 of yacc.c  */
     8012#line 2263 "parser.yy"
     8013    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8014    break;
     8015
     8016  case 582:
     8017
     8018/* Line 1806 of yacc.c  */
     8019#line 2266 "parser.yy"
     8020    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8021    break;
     8022
     8023  case 583:
     8024
     8025/* Line 1806 of yacc.c  */
     8026#line 2271 "parser.yy"
     8027    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8028    break;
     8029
     8030  case 584:
     8031
     8032/* Line 1806 of yacc.c  */
     8033#line 2273 "parser.yy"
     8034    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8035    break;
     8036
     8037  case 585:
     8038
     8039/* Line 1806 of yacc.c  */
     8040#line 2275 "parser.yy"
     8041    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8042    break;
     8043
     8044  case 586:
     8045
     8046/* Line 1806 of yacc.c  */
     8047#line 2280 "parser.yy"
     8048    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8049    break;
     8050
     8051  case 587:
     8052
     8053/* Line 1806 of yacc.c  */
     8054#line 2282 "parser.yy"
     8055    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8056    break;
     8057
     8058  case 588:
     8059
     8060/* Line 1806 of yacc.c  */
     8061#line 2284 "parser.yy"
     8062    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8063    break;
     8064
     8065  case 589:
     8066
     8067/* Line 1806 of yacc.c  */
     8068#line 2289 "parser.yy"
     8069    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8070    break;
     8071
     8072  case 590:
     8073
     8074/* Line 1806 of yacc.c  */
     8075#line 2291 "parser.yy"
     8076    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8077    break;
     8078
     8079  case 591:
     8080
     8081/* Line 1806 of yacc.c  */
     8082#line 2293 "parser.yy"
     8083    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8084    break;
     8085
     8086  case 595:
     8087
     8088/* Line 1806 of yacc.c  */
     8089#line 2308 "parser.yy"
     8090    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
     8091    break;
     8092
     8093  case 596:
     8094
     8095/* Line 1806 of yacc.c  */
     8096#line 2310 "parser.yy"
     8097    { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
     8098    break;
     8099
     8100  case 597:
     8101
     8102/* Line 1806 of yacc.c  */
     8103#line 2312 "parser.yy"
     8104    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8105    break;
     8106
     8107  case 598:
     8108
     8109/* Line 1806 of yacc.c  */
     8110#line 2317 "parser.yy"
     8111    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8112    break;
     8113
     8114  case 599:
     8115
     8116/* Line 1806 of yacc.c  */
     8117#line 2319 "parser.yy"
     8118    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8119    break;
     8120
     8121  case 600:
     8122
     8123/* Line 1806 of yacc.c  */
     8124#line 2321 "parser.yy"
     8125    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8126    break;
     8127
     8128  case 601:
     8129
     8130/* Line 1806 of yacc.c  */
     8131#line 2326 "parser.yy"
     8132    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8133    break;
     8134
     8135  case 602:
     8136
     8137/* Line 1806 of yacc.c  */
     8138#line 2328 "parser.yy"
     8139    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8140    break;
     8141
     8142  case 603:
     8143
     8144/* Line 1806 of yacc.c  */
     8145#line 2330 "parser.yy"
     8146    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8147    break;
     8148
     8149  case 604:
     8150
     8151/* Line 1806 of yacc.c  */
     8152#line 2345 "parser.yy"
     8153    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8154    break;
     8155
     8156  case 606:
     8157
     8158/* Line 1806 of yacc.c  */
     8159#line 2348 "parser.yy"
     8160    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8161    break;
     8162
     8163  case 607:
     8164
     8165/* Line 1806 of yacc.c  */
     8166#line 2350 "parser.yy"
     8167    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8168    break;
     8169
     8170  case 609:
     8171
     8172/* Line 1806 of yacc.c  */
     8173#line 2356 "parser.yy"
     8174    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8175    break;
     8176
     8177  case 610:
     8178
     8179/* Line 1806 of yacc.c  */
     8180#line 2361 "parser.yy"
     8181    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8182    break;
     8183
     8184  case 611:
     8185
     8186/* Line 1806 of yacc.c  */
     8187#line 2363 "parser.yy"
     8188    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8189    break;
     8190
     8191  case 612:
     8192
     8193/* Line 1806 of yacc.c  */
     8194#line 2365 "parser.yy"
     8195    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8196    break;
     8197
     8198  case 613:
     8199
     8200/* Line 1806 of yacc.c  */
     8201#line 2370 "parser.yy"
    80028202    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    80038203    break;
    80048204
    8005   case 575:
    8006 
    8007 /* Line 1806 of yacc.c  */
    8008 #line 2249 "parser.yy"
     8205  case 614:
     8206
     8207/* Line 1806 of yacc.c  */
     8208#line 2372 "parser.yy"
    80098209    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    80108210    break;
    80118211
    8012   case 576:
    8013 
    8014 /* Line 1806 of yacc.c  */
    8015 #line 2251 "parser.yy"
     8212  case 615:
     8213
     8214/* Line 1806 of yacc.c  */
     8215#line 2374 "parser.yy"
    80168216    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    80178217    break;
    80188218
    8019   case 577:
    8020 
    8021 /* Line 1806 of yacc.c  */
    8022 #line 2253 "parser.yy"
     8219  case 616:
     8220
     8221/* Line 1806 of yacc.c  */
     8222#line 2376 "parser.yy"
    80238223    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80248224    break;
    80258225
    8026   case 578:
    8027 
    8028 /* Line 1806 of yacc.c  */
    8029 #line 2258 "parser.yy"
     8226  case 617:
     8227
     8228/* Line 1806 of yacc.c  */
     8229#line 2381 "parser.yy"
     8230    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8231    break;
     8232
     8233  case 618:
     8234
     8235/* Line 1806 of yacc.c  */
     8236#line 2383 "parser.yy"
    80308237    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    80318238    break;
    80328239
    8033   case 579:
    8034 
    8035 /* Line 1806 of yacc.c  */
    8036 #line 2260 "parser.yy"
     8240  case 619:
     8241
     8242/* Line 1806 of yacc.c  */
     8243#line 2385 "parser.yy"
    80378244    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80388245    break;
    80398246
    8040   case 580:
    8041 
    8042 /* Line 1806 of yacc.c  */
    8043 #line 2269 "parser.yy"
     8247  case 620:
     8248
     8249/* Line 1806 of yacc.c  */
     8250#line 2395 "parser.yy"
    80448251    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    80458252    break;
    80468253
    8047   case 582:
    8048 
    8049 /* Line 1806 of yacc.c  */
    8050 #line 2272 "parser.yy"
     8254  case 622:
     8255
     8256/* Line 1806 of yacc.c  */
     8257#line 2398 "parser.yy"
    80518258    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    80528259    break;
    80538260
    8054   case 583:
    8055 
    8056 /* Line 1806 of yacc.c  */
    8057 #line 2277 "parser.yy"
     8261  case 623:
     8262
     8263/* Line 1806 of yacc.c  */
     8264#line 2400 "parser.yy"
     8265    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8266    break;
     8267
     8268  case 624:
     8269
     8270/* Line 1806 of yacc.c  */
     8271#line 2405 "parser.yy"
     8272    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8273    break;
     8274
     8275  case 625:
     8276
     8277/* Line 1806 of yacc.c  */
     8278#line 2407 "parser.yy"
     8279    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8280    break;
     8281
     8282  case 626:
     8283
     8284/* Line 1806 of yacc.c  */
     8285#line 2409 "parser.yy"
     8286    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8287    break;
     8288
     8289  case 627:
     8290
     8291/* Line 1806 of yacc.c  */
     8292#line 2414 "parser.yy"
     8293    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8294    break;
     8295
     8296  case 628:
     8297
     8298/* Line 1806 of yacc.c  */
     8299#line 2416 "parser.yy"
     8300    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8301    break;
     8302
     8303  case 629:
     8304
     8305/* Line 1806 of yacc.c  */
     8306#line 2418 "parser.yy"
     8307    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8308    break;
     8309
     8310  case 630:
     8311
     8312/* Line 1806 of yacc.c  */
     8313#line 2420 "parser.yy"
     8314    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8315    break;
     8316
     8317  case 631:
     8318
     8319/* Line 1806 of yacc.c  */
     8320#line 2425 "parser.yy"
    80588321    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    80598322    break;
    80608323
    8061   case 584:
    8062 
    8063 /* Line 1806 of yacc.c  */
    8064 #line 2279 "parser.yy"
     8324  case 632:
     8325
     8326/* Line 1806 of yacc.c  */
     8327#line 2427 "parser.yy"
    80658328    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    80668329    break;
    80678330
    8068   case 585:
    8069 
    8070 /* Line 1806 of yacc.c  */
    8071 #line 2281 "parser.yy"
     8331  case 633:
     8332
     8333/* Line 1806 of yacc.c  */
     8334#line 2429 "parser.yy"
    80728335    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80738336    break;
    80748337
    8075   case 586:
    8076 
    8077 /* Line 1806 of yacc.c  */
    8078 #line 2286 "parser.yy"
    8079     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8080     break;
    8081 
    8082   case 587:
    8083 
    8084 /* Line 1806 of yacc.c  */
    8085 #line 2288 "parser.yy"
    8086     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8087     break;
    8088 
    8089   case 588:
    8090 
    8091 /* Line 1806 of yacc.c  */
    8092 #line 2290 "parser.yy"
    8093     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8094     break;
    8095 
    8096   case 589:
    8097 
    8098 /* Line 1806 of yacc.c  */
    8099 #line 2295 "parser.yy"
    8100     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8101     break;
    8102 
    8103   case 590:
    8104 
    8105 /* Line 1806 of yacc.c  */
    8106 #line 2297 "parser.yy"
    8107     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8108     break;
    8109 
    8110   case 591:
    8111 
    8112 /* Line 1806 of yacc.c  */
    8113 #line 2299 "parser.yy"
    8114     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8115     break;
    8116 
    8117   case 595:
    8118 
    8119 /* Line 1806 of yacc.c  */
    8120 #line 2314 "parser.yy"
    8121     { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
    8122     break;
    8123 
    8124   case 596:
    8125 
    8126 /* Line 1806 of yacc.c  */
    8127 #line 2316 "parser.yy"
    8128     { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
    8129     break;
    8130 
    8131   case 597:
    8132 
    8133 /* Line 1806 of yacc.c  */
    8134 #line 2318 "parser.yy"
    8135     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8136     break;
    8137 
    8138   case 598:
    8139 
    8140 /* Line 1806 of yacc.c  */
    8141 #line 2323 "parser.yy"
    8142     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8143     break;
    8144 
    8145   case 599:
    8146 
    8147 /* Line 1806 of yacc.c  */
    8148 #line 2325 "parser.yy"
    8149     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8150     break;
    8151 
    8152   case 600:
    8153 
    8154 /* Line 1806 of yacc.c  */
    8155 #line 2327 "parser.yy"
    8156     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8157     break;
    8158 
    8159   case 601:
    8160 
    8161 /* Line 1806 of yacc.c  */
    8162 #line 2332 "parser.yy"
    8163     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8164     break;
    8165 
    8166   case 602:
    8167 
    8168 /* Line 1806 of yacc.c  */
    8169 #line 2334 "parser.yy"
    8170     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8171     break;
    8172 
    8173   case 603:
    8174 
    8175 /* Line 1806 of yacc.c  */
    8176 #line 2336 "parser.yy"
    8177     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8178     break;
    8179 
    8180   case 604:
    8181 
    8182 /* Line 1806 of yacc.c  */
    8183 #line 2351 "parser.yy"
     8338  case 634:
     8339
     8340/* Line 1806 of yacc.c  */
     8341#line 2460 "parser.yy"
    81848342    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81858343    break;
    81868344
    8187   case 606:
    8188 
    8189 /* Line 1806 of yacc.c  */
    8190 #line 2354 "parser.yy"
     8345  case 636:
     8346
     8347/* Line 1806 of yacc.c  */
     8348#line 2463 "parser.yy"
    81918349    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81928350    break;
    81938351
    8194   case 607:
    8195 
    8196 /* Line 1806 of yacc.c  */
    8197 #line 2356 "parser.yy"
     8352  case 637:
     8353
     8354/* Line 1806 of yacc.c  */
     8355#line 2465 "parser.yy"
    81988356    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81998357    break;
    82008358
    8201   case 609:
    8202 
    8203 /* Line 1806 of yacc.c  */
    8204 #line 2362 "parser.yy"
    8205     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8206     break;
    8207 
    8208   case 610:
    8209 
    8210 /* Line 1806 of yacc.c  */
    8211 #line 2367 "parser.yy"
    8212     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8213     break;
    8214 
    8215   case 611:
    8216 
    8217 /* Line 1806 of yacc.c  */
    8218 #line 2369 "parser.yy"
    8219     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8220     break;
    8221 
    8222   case 612:
    8223 
    8224 /* Line 1806 of yacc.c  */
    8225 #line 2371 "parser.yy"
    8226     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8227     break;
    8228 
    8229   case 613:
    8230 
    8231 /* Line 1806 of yacc.c  */
    8232 #line 2376 "parser.yy"
    8233     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8234     break;
    8235 
    8236   case 614:
    8237 
    8238 /* Line 1806 of yacc.c  */
    8239 #line 2378 "parser.yy"
    8240     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8241     break;
    8242 
    8243   case 615:
    8244 
    8245 /* Line 1806 of yacc.c  */
    8246 #line 2380 "parser.yy"
    8247     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8248     break;
    8249 
    8250   case 616:
    8251 
    8252 /* Line 1806 of yacc.c  */
    8253 #line 2382 "parser.yy"
    8254     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8255     break;
    8256 
    8257   case 617:
    8258 
    8259 /* Line 1806 of yacc.c  */
    8260 #line 2387 "parser.yy"
    8261     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8262     break;
    8263 
    8264   case 618:
    8265 
    8266 /* Line 1806 of yacc.c  */
    8267 #line 2389 "parser.yy"
    8268     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8269     break;
    8270 
    8271   case 619:
    8272 
    8273 /* Line 1806 of yacc.c  */
    8274 #line 2391 "parser.yy"
    8275     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8276     break;
    8277 
    8278   case 620:
    8279 
    8280 /* Line 1806 of yacc.c  */
    8281 #line 2401 "parser.yy"
    8282     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8283     break;
    8284 
    8285   case 622:
    8286 
    8287 /* Line 1806 of yacc.c  */
    8288 #line 2404 "parser.yy"
    8289     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8290     break;
    8291 
    8292   case 623:
    8293 
    8294 /* Line 1806 of yacc.c  */
    8295 #line 2406 "parser.yy"
    8296     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8297     break;
    8298 
    8299   case 624:
    8300 
    8301 /* Line 1806 of yacc.c  */
    8302 #line 2411 "parser.yy"
    8303     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8304     break;
    8305 
    8306   case 625:
    8307 
    8308 /* Line 1806 of yacc.c  */
    8309 #line 2413 "parser.yy"
    8310     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8311     break;
    8312 
    8313   case 626:
    8314 
    8315 /* Line 1806 of yacc.c  */
    8316 #line 2415 "parser.yy"
    8317     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8318     break;
    8319 
    8320   case 627:
    8321 
    8322 /* Line 1806 of yacc.c  */
    8323 #line 2420 "parser.yy"
    8324     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8325     break;
    8326 
    8327   case 628:
    8328 
    8329 /* Line 1806 of yacc.c  */
    8330 #line 2422 "parser.yy"
    8331     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8332     break;
    8333 
    8334   case 629:
    8335 
    8336 /* Line 1806 of yacc.c  */
    8337 #line 2424 "parser.yy"
    8338     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8339     break;
    8340 
    8341   case 630:
    8342 
    8343 /* Line 1806 of yacc.c  */
    8344 #line 2426 "parser.yy"
    8345     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8346     break;
    8347 
    8348   case 631:
    8349 
    8350 /* Line 1806 of yacc.c  */
    8351 #line 2431 "parser.yy"
    8352     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8353     break;
    8354 
    8355   case 632:
    8356 
    8357 /* Line 1806 of yacc.c  */
    8358 #line 2433 "parser.yy"
    8359     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8360     break;
    8361 
    8362   case 633:
    8363 
    8364 /* Line 1806 of yacc.c  */
    8365 #line 2435 "parser.yy"
    8366     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8367     break;
    8368 
    8369   case 634:
    8370 
    8371 /* Line 1806 of yacc.c  */
    8372 #line 2466 "parser.yy"
    8373     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8374     break;
    8375 
    8376   case 636:
    8377 
    8378 /* Line 1806 of yacc.c  */
    8379 #line 2469 "parser.yy"
    8380     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8381     break;
    8382 
    8383   case 637:
    8384 
    8385 /* Line 1806 of yacc.c  */
    8386 #line 2471 "parser.yy"
    8387     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8388     break;
    8389 
    83908359  case 638:
    83918360
    83928361/* Line 1806 of yacc.c  */
    8393 #line 2476 "parser.yy"
     8362#line 2470 "parser.yy"
    83948363    {
    83958364                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    84018370
    84028371/* Line 1806 of yacc.c  */
    8403 #line 2481 "parser.yy"
     8372#line 2475 "parser.yy"
    84048373    {
    84058374                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    84118380
    84128381/* Line 1806 of yacc.c  */
    8413 #line 2489 "parser.yy"
     8382#line 2483 "parser.yy"
    84148383    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    84158384    break;
     
    84188387
    84198388/* Line 1806 of yacc.c  */
    8420 #line 2491 "parser.yy"
     8389#line 2485 "parser.yy"
    84218390    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    84228391    break;
     
    84258394
    84268395/* Line 1806 of yacc.c  */
    8427 #line 2493 "parser.yy"
     8396#line 2487 "parser.yy"
    84288397    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84298398    break;
     
    84328401
    84338402/* Line 1806 of yacc.c  */
    8434 #line 2498 "parser.yy"
     8403#line 2492 "parser.yy"
    84358404    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    84368405    break;
     
    84398408
    84408409/* Line 1806 of yacc.c  */
    8441 #line 2500 "parser.yy"
     8410#line 2494 "parser.yy"
    84428411    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84438412    break;
     
    84468415
    84478416/* Line 1806 of yacc.c  */
    8448 #line 2505 "parser.yy"
     8417#line 2499 "parser.yy"
    84498418    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    84508419    break;
     
    84538422
    84548423/* Line 1806 of yacc.c  */
    8455 #line 2507 "parser.yy"
     8424#line 2501 "parser.yy"
    84568425    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    84578426    break;
     
    84608429
    84618430/* Line 1806 of yacc.c  */
    8462 #line 2522 "parser.yy"
     8431#line 2516 "parser.yy"
    84638432    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    84648433    break;
     
    84678436
    84688437/* Line 1806 of yacc.c  */
    8469 #line 2524 "parser.yy"
     8438#line 2518 "parser.yy"
    84708439    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    84718440    break;
     
    84748443
    84758444/* Line 1806 of yacc.c  */
     8445#line 2523 "parser.yy"
     8446    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
     8447    break;
     8448
     8449  case 651:
     8450
     8451/* Line 1806 of yacc.c  */
     8452#line 2525 "parser.yy"
     8453    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
     8454    break;
     8455
     8456  case 652:
     8457
     8458/* Line 1806 of yacc.c  */
     8459#line 2527 "parser.yy"
     8460    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8461    break;
     8462
     8463  case 653:
     8464
     8465/* Line 1806 of yacc.c  */
    84768466#line 2529 "parser.yy"
     8467    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8468    break;
     8469
     8470  case 654:
     8471
     8472/* Line 1806 of yacc.c  */
     8473#line 2531 "parser.yy"
     8474    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8475    break;
     8476
     8477  case 656:
     8478
     8479/* Line 1806 of yacc.c  */
     8480#line 2537 "parser.yy"
     8481    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8482    break;
     8483
     8484  case 657:
     8485
     8486/* Line 1806 of yacc.c  */
     8487#line 2539 "parser.yy"
     8488    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8489    break;
     8490
     8491  case 658:
     8492
     8493/* Line 1806 of yacc.c  */
     8494#line 2541 "parser.yy"
     8495    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8496    break;
     8497
     8498  case 659:
     8499
     8500/* Line 1806 of yacc.c  */
     8501#line 2546 "parser.yy"
     8502    { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); }
     8503    break;
     8504
     8505  case 660:
     8506
     8507/* Line 1806 of yacc.c  */
     8508#line 2548 "parser.yy"
     8509    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8510    break;
     8511
     8512  case 661:
     8513
     8514/* Line 1806 of yacc.c  */
     8515#line 2550 "parser.yy"
     8516    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8517    break;
     8518
     8519  case 662:
     8520
     8521/* Line 1806 of yacc.c  */
     8522#line 2556 "parser.yy"
     8523    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
     8524    break;
     8525
     8526  case 663:
     8527
     8528/* Line 1806 of yacc.c  */
     8529#line 2558 "parser.yy"
     8530    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }
     8531    break;
     8532
     8533  case 665:
     8534
     8535/* Line 1806 of yacc.c  */
     8536#line 2564 "parser.yy"
     8537    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
     8538    break;
     8539
     8540  case 666:
     8541
     8542/* Line 1806 of yacc.c  */
     8543#line 2566 "parser.yy"
     8544    { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
     8545    break;
     8546
     8547  case 667:
     8548
     8549/* Line 1806 of yacc.c  */
     8550#line 2568 "parser.yy"
     8551    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
     8552    break;
     8553
     8554  case 668:
     8555
     8556/* Line 1806 of yacc.c  */
     8557#line 2570 "parser.yy"
     8558    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); }
     8559    break;
     8560
     8561  case 670:
     8562
     8563/* Line 1806 of yacc.c  */
     8564#line 2585 "parser.yy"
     8565    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8566    break;
     8567
     8568  case 671:
     8569
     8570/* Line 1806 of yacc.c  */
     8571#line 2587 "parser.yy"
     8572    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8573    break;
     8574
     8575  case 672:
     8576
     8577/* Line 1806 of yacc.c  */
     8578#line 2592 "parser.yy"
    84778579    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    84788580    break;
    84798581
    8480   case 651:
    8481 
    8482 /* Line 1806 of yacc.c  */
    8483 #line 2531 "parser.yy"
     8582  case 673:
     8583
     8584/* Line 1806 of yacc.c  */
     8585#line 2594 "parser.yy"
    84848586    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    84858587    break;
    84868588
    8487   case 652:
    8488 
    8489 /* Line 1806 of yacc.c  */
    8490 #line 2533 "parser.yy"
     8589  case 674:
     8590
     8591/* Line 1806 of yacc.c  */
     8592#line 2596 "parser.yy"
    84918593    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    84928594    break;
    84938595
    8494   case 653:
    8495 
    8496 /* Line 1806 of yacc.c  */
    8497 #line 2535 "parser.yy"
     8596  case 675:
     8597
     8598/* Line 1806 of yacc.c  */
     8599#line 2598 "parser.yy"
    84988600    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    84998601    break;
    85008602
    8501   case 654:
    8502 
    8503 /* Line 1806 of yacc.c  */
    8504 #line 2537 "parser.yy"
     8603  case 676:
     8604
     8605/* Line 1806 of yacc.c  */
     8606#line 2600 "parser.yy"
    85058607    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85068608    break;
    85078609
    8508   case 656:
    8509 
    8510 /* Line 1806 of yacc.c  */
    8511 #line 2543 "parser.yy"
     8610  case 678:
     8611
     8612/* Line 1806 of yacc.c  */
     8613#line 2606 "parser.yy"
    85128614    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    85138615    break;
    85148616
    8515   case 657:
    8516 
    8517 /* Line 1806 of yacc.c  */
    8518 #line 2545 "parser.yy"
     8617  case 679:
     8618
     8619/* Line 1806 of yacc.c  */
     8620#line 2608 "parser.yy"
    85198621    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    85208622    break;
    85218623
    8522   case 658:
    8523 
    8524 /* Line 1806 of yacc.c  */
    8525 #line 2547 "parser.yy"
     8624  case 680:
     8625
     8626/* Line 1806 of yacc.c  */
     8627#line 2610 "parser.yy"
    85268628    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85278629    break;
    85288630
    8529   case 659:
    8530 
    8531 /* Line 1806 of yacc.c  */
    8532 #line 2552 "parser.yy"
     8631  case 681:
     8632
     8633/* Line 1806 of yacc.c  */
     8634#line 2615 "parser.yy"
    85338635    { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); }
    85348636    break;
    85358637
    8536   case 660:
    8537 
    8538 /* Line 1806 of yacc.c  */
    8539 #line 2554 "parser.yy"
     8638  case 682:
     8639
     8640/* Line 1806 of yacc.c  */
     8641#line 2617 "parser.yy"
    85408642    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    85418643    break;
    85428644
    8543   case 661:
    8544 
    8545 /* Line 1806 of yacc.c  */
    8546 #line 2556 "parser.yy"
     8645  case 683:
     8646
     8647/* Line 1806 of yacc.c  */
     8648#line 2619 "parser.yy"
    85478649    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85488650    break;
    85498651
    8550   case 662:
    8551 
    8552 /* Line 1806 of yacc.c  */
    8553 #line 2562 "parser.yy"
     8652  case 685:
     8653
     8654/* Line 1806 of yacc.c  */
     8655#line 2626 "parser.yy"
     8656    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8657    break;
     8658
     8659  case 687:
     8660
     8661/* Line 1806 of yacc.c  */
     8662#line 2637 "parser.yy"
    85548663    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    85558664    break;
    85568665
    8557   case 663:
    8558 
    8559 /* Line 1806 of yacc.c  */
    8560 #line 2564 "parser.yy"
    8561     { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }
    8562     break;
    8563 
    8564   case 665:
    8565 
    8566 /* Line 1806 of yacc.c  */
    8567 #line 2570 "parser.yy"
    8568     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
    8569     break;
    8570 
    8571   case 666:
    8572 
    8573 /* Line 1806 of yacc.c  */
    8574 #line 2572 "parser.yy"
    8575     { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
    8576     break;
    8577 
    8578   case 667:
    8579 
    8580 /* Line 1806 of yacc.c  */
    8581 #line 2574 "parser.yy"
    8582     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
    8583     break;
    8584 
    8585   case 668:
    8586 
    8587 /* Line 1806 of yacc.c  */
    8588 #line 2576 "parser.yy"
    8589     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); }
    8590     break;
    8591 
    8592   case 670:
    8593 
    8594 /* Line 1806 of yacc.c  */
    8595 #line 2591 "parser.yy"
     8666  case 688:
     8667
     8668/* Line 1806 of yacc.c  */
     8669#line 2640 "parser.yy"
     8670    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
     8671    break;
     8672
     8673  case 689:
     8674
     8675/* Line 1806 of yacc.c  */
     8676#line 2642 "parser.yy"
     8677    { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }
     8678    break;
     8679
     8680  case 690:
     8681
     8682/* Line 1806 of yacc.c  */
     8683#line 2645 "parser.yy"
     8684    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
     8685    break;
     8686
     8687  case 691:
     8688
     8689/* Line 1806 of yacc.c  */
     8690#line 2647 "parser.yy"
     8691    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
     8692    break;
     8693
     8694  case 692:
     8695
     8696/* Line 1806 of yacc.c  */
     8697#line 2649 "parser.yy"
     8698    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }
     8699    break;
     8700
     8701  case 694:
     8702
     8703/* Line 1806 of yacc.c  */
     8704#line 2663 "parser.yy"
    85968705    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85978706    break;
    85988707
    8599   case 671:
    8600 
    8601 /* Line 1806 of yacc.c  */
    8602 #line 2593 "parser.yy"
     8708  case 695:
     8709
     8710/* Line 1806 of yacc.c  */
     8711#line 2665 "parser.yy"
    86038712    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    86048713    break;
    86058714
    8606   case 672:
    8607 
    8608 /* Line 1806 of yacc.c  */
    8609 #line 2598 "parser.yy"
     8715  case 696:
     8716
     8717/* Line 1806 of yacc.c  */
     8718#line 2670 "parser.yy"
    86108719    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    86118720    break;
    86128721
    8613   case 673:
    8614 
    8615 /* Line 1806 of yacc.c  */
    8616 #line 2600 "parser.yy"
     8722  case 697:
     8723
     8724/* Line 1806 of yacc.c  */
     8725#line 2672 "parser.yy"
    86178726    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    86188727    break;
    86198728
    8620   case 674:
    8621 
    8622 /* Line 1806 of yacc.c  */
    8623 #line 2602 "parser.yy"
     8729  case 698:
     8730
     8731/* Line 1806 of yacc.c  */
     8732#line 2674 "parser.yy"
    86248733    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    86258734    break;
    86268735
    8627   case 675:
    8628 
    8629 /* Line 1806 of yacc.c  */
    8630 #line 2604 "parser.yy"
     8736  case 699:
     8737
     8738/* Line 1806 of yacc.c  */
     8739#line 2676 "parser.yy"
    86318740    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    86328741    break;
    86338742
    8634   case 676:
    8635 
    8636 /* Line 1806 of yacc.c  */
    8637 #line 2606 "parser.yy"
     8743  case 700:
     8744
     8745/* Line 1806 of yacc.c  */
     8746#line 2678 "parser.yy"
    86388747    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86398748    break;
    86408749
    8641   case 678:
    8642 
    8643 /* Line 1806 of yacc.c  */
    8644 #line 2612 "parser.yy"
     8750  case 702:
     8751
     8752/* Line 1806 of yacc.c  */
     8753#line 2684 "parser.yy"
    86458754    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86468755    break;
    86478756
    8648   case 679:
    8649 
    8650 /* Line 1806 of yacc.c  */
    8651 #line 2614 "parser.yy"
     8757  case 703:
     8758
     8759/* Line 1806 of yacc.c  */
     8760#line 2686 "parser.yy"
    86528761    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86538762    break;
    86548763
    8655   case 680:
    8656 
    8657 /* Line 1806 of yacc.c  */
    8658 #line 2616 "parser.yy"
     8764  case 704:
     8765
     8766/* Line 1806 of yacc.c  */
     8767#line 2688 "parser.yy"
    86598768    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86608769    break;
    86618770
    8662   case 681:
    8663 
    8664 /* Line 1806 of yacc.c  */
    8665 #line 2621 "parser.yy"
    8666     { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); }
    8667     break;
    8668 
    8669   case 682:
    8670 
    8671 /* Line 1806 of yacc.c  */
    8672 #line 2623 "parser.yy"
     8771  case 705:
     8772
     8773/* Line 1806 of yacc.c  */
     8774#line 2693 "parser.yy"
    86738775    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    86748776    break;
    86758777
    8676   case 683:
    8677 
    8678 /* Line 1806 of yacc.c  */
    8679 #line 2625 "parser.yy"
     8778  case 706:
     8779
     8780/* Line 1806 of yacc.c  */
     8781#line 2695 "parser.yy"
    86808782    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86818783    break;
    86828784
    8683   case 685:
    8684 
    8685 /* Line 1806 of yacc.c  */
    8686 #line 2632 "parser.yy"
    8687     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8688     break;
    8689 
    8690   case 687:
    8691 
    8692 /* Line 1806 of yacc.c  */
    8693 #line 2643 "parser.yy"
    8694     { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    8695     break;
    8696 
    8697   case 688:
    8698 
    8699 /* Line 1806 of yacc.c  */
    8700 #line 2646 "parser.yy"
    8701     { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    8702     break;
    8703 
    8704   case 689:
    8705 
    8706 /* Line 1806 of yacc.c  */
    8707 #line 2648 "parser.yy"
    8708     { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }
    8709     break;
    8710 
    8711   case 690:
    8712 
    8713 /* Line 1806 of yacc.c  */
    8714 #line 2651 "parser.yy"
    8715     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    8716     break;
    8717 
    8718   case 691:
    8719 
    8720 /* Line 1806 of yacc.c  */
    8721 #line 2653 "parser.yy"
    8722     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
    8723     break;
    8724 
    8725   case 692:
    8726 
    8727 /* Line 1806 of yacc.c  */
    8728 #line 2655 "parser.yy"
    8729     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }
    8730     break;
    8731 
    8732   case 694:
    8733 
    8734 /* Line 1806 of yacc.c  */
    8735 #line 2669 "parser.yy"
    8736     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8737     break;
    8738 
    8739   case 695:
    8740 
    8741 /* Line 1806 of yacc.c  */
    8742 #line 2671 "parser.yy"
    8743     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8744     break;
    8745 
    8746   case 696:
    8747 
    8748 /* Line 1806 of yacc.c  */
    8749 #line 2676 "parser.yy"
    8750     { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    8751     break;
    8752 
    8753   case 697:
    8754 
    8755 /* Line 1806 of yacc.c  */
    8756 #line 2678 "parser.yy"
    8757     { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    8758     break;
    8759 
    8760   case 698:
    8761 
    8762 /* Line 1806 of yacc.c  */
    8763 #line 2680 "parser.yy"
    8764     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8765     break;
    8766 
    8767   case 699:
    8768 
    8769 /* Line 1806 of yacc.c  */
    8770 #line 2682 "parser.yy"
    8771     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8772     break;
    8773 
    8774   case 700:
    8775 
    8776 /* Line 1806 of yacc.c  */
    8777 #line 2684 "parser.yy"
    8778     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8779     break;
    8780 
    8781   case 702:
    8782 
    8783 /* Line 1806 of yacc.c  */
    8784 #line 2690 "parser.yy"
    8785     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8786     break;
    8787 
    8788   case 703:
    8789 
    8790 /* Line 1806 of yacc.c  */
    8791 #line 2692 "parser.yy"
    8792     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8793     break;
    8794 
    8795   case 704:
    8796 
    8797 /* Line 1806 of yacc.c  */
    8798 #line 2694 "parser.yy"
    8799     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8800     break;
    8801 
    8802   case 705:
    8803 
    8804 /* Line 1806 of yacc.c  */
    8805 #line 2699 "parser.yy"
    8806     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8807     break;
    8808 
    8809   case 706:
    8810 
    8811 /* Line 1806 of yacc.c  */
    8812 #line 2701 "parser.yy"
    8813     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8814     break;
    8815 
    88168785  case 709:
    88178786
    88188787/* Line 1806 of yacc.c  */
    8819 #line 2711 "parser.yy"
     8788#line 2705 "parser.yy"
    88208789    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    88218790    break;
     
    88248793
    88258794/* Line 1806 of yacc.c  */
     8795#line 2715 "parser.yy"
     8796    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8797    break;
     8798
     8799  case 713:
     8800
     8801/* Line 1806 of yacc.c  */
     8802#line 2717 "parser.yy"
     8803    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8804    break;
     8805
     8806  case 714:
     8807
     8808/* Line 1806 of yacc.c  */
     8809#line 2719 "parser.yy"
     8810    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8811    break;
     8812
     8813  case 715:
     8814
     8815/* Line 1806 of yacc.c  */
    88268816#line 2721 "parser.yy"
     8817    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8818    break;
     8819
     8820  case 716:
     8821
     8822/* Line 1806 of yacc.c  */
     8823#line 2723 "parser.yy"
    88278824    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    88288825    break;
    88298826
    8830   case 713:
    8831 
    8832 /* Line 1806 of yacc.c  */
    8833 #line 2723 "parser.yy"
     8827  case 717:
     8828
     8829/* Line 1806 of yacc.c  */
     8830#line 2725 "parser.yy"
    88348831    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    88358832    break;
    88368833
    8837   case 714:
    8838 
    8839 /* Line 1806 of yacc.c  */
    8840 #line 2725 "parser.yy"
    8841     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    8842     break;
    8843 
    8844   case 715:
    8845 
    8846 /* Line 1806 of yacc.c  */
    8847 #line 2727 "parser.yy"
    8848     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    8849     break;
    8850 
    8851   case 716:
    8852 
    8853 /* Line 1806 of yacc.c  */
    8854 #line 2729 "parser.yy"
    8855     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    8856     break;
    8857 
    8858   case 717:
    8859 
    8860 /* Line 1806 of yacc.c  */
    8861 #line 2731 "parser.yy"
    8862     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    8863     break;
    8864 
    88658834  case 718:
    88668835
    88678836/* Line 1806 of yacc.c  */
     8837#line 2732 "parser.yy"
     8838    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8839    break;
     8840
     8841  case 719:
     8842
     8843/* Line 1806 of yacc.c  */
     8844#line 2734 "parser.yy"
     8845    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     8846    break;
     8847
     8848  case 720:
     8849
     8850/* Line 1806 of yacc.c  */
     8851#line 2736 "parser.yy"
     8852    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8853    break;
     8854
     8855  case 721:
     8856
     8857/* Line 1806 of yacc.c  */
    88688858#line 2738 "parser.yy"
    8869     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    8870     break;
    8871 
    8872   case 719:
     8859    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
     8860    break;
     8861
     8862  case 722:
    88738863
    88748864/* Line 1806 of yacc.c  */
     
    88778867    break;
    88788868
    8879   case 720:
    8880 
    8881 /* Line 1806 of yacc.c  */
    8882 #line 2742 "parser.yy"
     8869  case 723:
     8870
     8871/* Line 1806 of yacc.c  */
     8872#line 2743 "parser.yy"
     8873    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8874    break;
     8875
     8876  case 724:
     8877
     8878/* Line 1806 of yacc.c  */
     8879#line 2745 "parser.yy"
     8880    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     8881    break;
     8882
     8883  case 725:
     8884
     8885/* Line 1806 of yacc.c  */
     8886#line 2747 "parser.yy"
    88838887    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    88848888    break;
    88858889
    8886   case 721:
    8887 
    8888 /* Line 1806 of yacc.c  */
    8889 #line 2744 "parser.yy"
     8890  case 726:
     8891
     8892/* Line 1806 of yacc.c  */
     8893#line 2749 "parser.yy"
    88908894    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    88918895    break;
    88928896
    8893   case 722:
    8894 
    8895 /* Line 1806 of yacc.c  */
    8896 #line 2746 "parser.yy"
    8897     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    8898     break;
    8899 
    8900   case 723:
    8901 
    8902 /* Line 1806 of yacc.c  */
    8903 #line 2749 "parser.yy"
    8904     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    8905     break;
    8906 
    8907   case 724:
     8897  case 727:
    89088898
    89098899/* Line 1806 of yacc.c  */
     
    89128902    break;
    89138903
    8914   case 725:
    8915 
    8916 /* Line 1806 of yacc.c  */
    8917 #line 2753 "parser.yy"
    8918     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    8919     break;
    8920 
    8921   case 726:
    8922 
    8923 /* Line 1806 of yacc.c  */
    8924 #line 2755 "parser.yy"
    8925     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    8926     break;
    8927 
    8928   case 727:
    8929 
    8930 /* Line 1806 of yacc.c  */
    8931 #line 2757 "parser.yy"
     8904  case 728:
     8905
     8906/* Line 1806 of yacc.c  */
     8907#line 2756 "parser.yy"
     8908    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
     8909    break;
     8910
     8911  case 729:
     8912
     8913/* Line 1806 of yacc.c  */
     8914#line 2758 "parser.yy"
     8915    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
     8916    break;
     8917
     8918  case 730:
     8919
     8920/* Line 1806 of yacc.c  */
     8921#line 2763 "parser.yy"
     8922    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
     8923    break;
     8924
     8925  case 731:
     8926
     8927/* Line 1806 of yacc.c  */
     8928#line 2765 "parser.yy"
     8929    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
     8930    break;
     8931
     8932  case 733:
     8933
     8934/* Line 1806 of yacc.c  */
     8935#line 2792 "parser.yy"
     8936    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     8937    break;
     8938
     8939  case 737:
     8940
     8941/* Line 1806 of yacc.c  */
     8942#line 2803 "parser.yy"
     8943    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8944    break;
     8945
     8946  case 738:
     8947
     8948/* Line 1806 of yacc.c  */
     8949#line 2805 "parser.yy"
     8950    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8951    break;
     8952
     8953  case 739:
     8954
     8955/* Line 1806 of yacc.c  */
     8956#line 2807 "parser.yy"
     8957    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8958    break;
     8959
     8960  case 740:
     8961
     8962/* Line 1806 of yacc.c  */
     8963#line 2809 "parser.yy"
     8964    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8965    break;
     8966
     8967  case 741:
     8968
     8969/* Line 1806 of yacc.c  */
     8970#line 2811 "parser.yy"
     8971    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8972    break;
     8973
     8974  case 742:
     8975
     8976/* Line 1806 of yacc.c  */
     8977#line 2813 "parser.yy"
     8978    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8979    break;
     8980
     8981  case 743:
     8982
     8983/* Line 1806 of yacc.c  */
     8984#line 2820 "parser.yy"
     8985    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
     8986    break;
     8987
     8988  case 744:
     8989
     8990/* Line 1806 of yacc.c  */
     8991#line 2822 "parser.yy"
     8992    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
     8993    break;
     8994
     8995  case 745:
     8996
     8997/* Line 1806 of yacc.c  */
     8998#line 2824 "parser.yy"
    89328999    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    89339000    break;
    89349001
    8935   case 728:
    8936 
    8937 /* Line 1806 of yacc.c  */
    8938 #line 2762 "parser.yy"
    8939     { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    8940     break;
    8941 
    8942   case 729:
    8943 
    8944 /* Line 1806 of yacc.c  */
    8945 #line 2764 "parser.yy"
    8946     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    8947     break;
    8948 
    8949   case 730:
    8950 
    8951 /* Line 1806 of yacc.c  */
    8952 #line 2769 "parser.yy"
    8953     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
    8954     break;
    8955 
    8956   case 731:
    8957 
    8958 /* Line 1806 of yacc.c  */
    8959 #line 2771 "parser.yy"
    8960     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
    8961     break;
    8962 
    8963   case 733:
    8964 
    8965 /* Line 1806 of yacc.c  */
    8966 #line 2798 "parser.yy"
    8967     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    8968     break;
    8969 
    8970   case 737:
    8971 
    8972 /* Line 1806 of yacc.c  */
    8973 #line 2809 "parser.yy"
    8974     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    8975     break;
    8976 
    8977   case 738:
    8978 
    8979 /* Line 1806 of yacc.c  */
    8980 #line 2811 "parser.yy"
    8981     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    8982     break;
    8983 
    8984   case 739:
    8985 
    8986 /* Line 1806 of yacc.c  */
    8987 #line 2813 "parser.yy"
    8988     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    8989     break;
    8990 
    8991   case 740:
    8992 
    8993 /* Line 1806 of yacc.c  */
    8994 #line 2815 "parser.yy"
    8995     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    8996     break;
    8997 
    8998   case 741:
    8999 
    9000 /* Line 1806 of yacc.c  */
    9001 #line 2817 "parser.yy"
    9002     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    9003     break;
    9004 
    9005   case 742:
    9006 
    9007 /* Line 1806 of yacc.c  */
    9008 #line 2819 "parser.yy"
    9009     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    9010     break;
    9011 
    9012   case 743:
     9002  case 746:
    90139003
    90149004/* Line 1806 of yacc.c  */
     
    90179007    break;
    90189008
    9019   case 744:
     9009  case 747:
    90209010
    90219011/* Line 1806 of yacc.c  */
     
    90249014    break;
    90259015
    9026   case 745:
     9016  case 748:
    90279017
    90289018/* Line 1806 of yacc.c  */
     
    90319021    break;
    90329022
    9033   case 746:
    9034 
    9035 /* Line 1806 of yacc.c  */
    9036 #line 2832 "parser.yy"
    9037     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    9038     break;
    9039 
    9040   case 747:
    9041 
    9042 /* Line 1806 of yacc.c  */
    9043 #line 2834 "parser.yy"
    9044     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    9045     break;
    9046 
    9047   case 748:
    9048 
    9049 /* Line 1806 of yacc.c  */
    9050 #line 2836 "parser.yy"
    9051     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9052     break;
    9053 
    90549023  case 749:
    90559024
    90569025/* Line 1806 of yacc.c  */
    9057 #line 2841 "parser.yy"
     9026#line 2835 "parser.yy"
    90589027    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    90599028    break;
     
    90629031
    90639032/* Line 1806 of yacc.c  */
    9064 #line 2848 "parser.yy"
     9033#line 2842 "parser.yy"
    90659034    { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); }
    90669035    break;
     
    90699038
    90709039/* Line 1806 of yacc.c  */
    9071 #line 2850 "parser.yy"
     9040#line 2844 "parser.yy"
    90729041    { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); }
    90739042    break;
     
    90769045
    90779046/* Line 1806 of yacc.c  */
    9078 #line 2874 "parser.yy"
     9047#line 2868 "parser.yy"
    90799048    { (yyval.en) = 0; }
    90809049    break;
     
    90839052
    90849053/* Line 1806 of yacc.c  */
    9085 #line 2876 "parser.yy"
     9054#line 2870 "parser.yy"
    90869055    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    90879056    break;
     
    90909059
    90919060/* Line 1806 of yacc.c  */
    9092 #line 9093 "Parser/parser.cc"
     9061#line 9062 "Parser/parser.cc"
    90939062      default: break;
    90949063    }
     
    93219290
    93229291/* Line 2067 of yacc.c  */
    9323 #line 2879 "parser.yy"
     9292#line 2873 "parser.yy"
    93249293
    93259294// ----end of grammar----
  • src/Parser/parser.yy

    rb726084 r84118d8  
    199199
    200200%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    201 %type<en> field field_list field_name fraction_constants
     201%type<en> field field_list
     202%type<tok> field_name
    202203
    203204%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    383384                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    384385        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    385                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    386386        | postfix_expression REALFRACTIONconstant                       // CFA, tuple index
    387                 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_REALFRACTIONconstant( *$2 ) ) ); }
    388387        | postfix_expression ARROW no_attr_identifier
    389388                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
    390389        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    391                         { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    392390        | postfix_expression ICR
    393391                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
     
    423421field:                                                                                                  // CFA, tuple field selector
    424422        field_name
     423                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    425424        | REALDECIMALconstant field
    426                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); }
     425                { $$ = new ExpressionNode( build_fieldSel( $2, build_varref( $1 ) ) ); }
    427426        | REALDECIMALconstant '[' push field_list pop ']'
    428                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), build_tuple( $4 ) ) ); }
     427                { $$ = new ExpressionNode( build_fieldSel( $4, build_varref( $1 ) ) ); }
    429428        | field_name '.' field
    430                 { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     429                { $$ = new ExpressionNode( build_fieldSel( $3, build_varref( $1 ) ) ); }
    431430        | field_name '.' '[' push field_list pop ']'
    432                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
     431                { $$ = new ExpressionNode( build_fieldSel( $5, build_varref( $1 ) ) ); }
    433432        | field_name ARROW field
    434                 { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     433                { $$ = new ExpressionNode( build_pfieldSel( $3, build_varref( $1 ) ) ); }
    435434        | field_name ARROW '[' push field_list pop ']'
    436                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
     435                { $$ = new ExpressionNode( build_pfieldSel( $5, build_varref( $1 ) ) ); }
    437436        ;
    438437
    439438field_name:
    440439        INTEGERconstant fraction_constants
    441                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); }
     440                { $$ = $1; }
    442441        | FLOATINGconstant fraction_constants
    443                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); }
     442                { $$ = $1; }
    444443        | no_attr_identifier fraction_constants
    445                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); }
     444                { $$ = $1; }
    446445        ;
    447446
    448447fraction_constants:
    449448        // empty
    450                 { $$ = nullptr; }
    451449        | fraction_constants REALFRACTIONconstant
    452                 {
    453                         Expression * constant = build_field_name_REALFRACTIONconstant( *$2 );
    454                         $$ = $1 != nullptr ? new ExpressionNode( build_fieldSel( $1,  constant ) ) : new ExpressionNode( constant );
    455                 }
    456450        ;
    457451
  • src/ResolvExpr/Alternative.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Alternative.cc --
     7// Alternative.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1212// Last Modified On : Sat May 16 23:54:23 2015
    1313// Update Count     : 2
    14 //
     14// 
    1515
    1616#include "Alternative.h"
     
    2020
    2121namespace ResolvExpr {
    22         Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( 0 ) {}
     22        Alternative::Alternative() : expr( 0 ) {}
    2323
    2424        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     
    3535                if ( &other == this ) return *this;
    3636                initialize( other, *this );
    37                 return *this;
    38         }
    39 
    40         Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {
    41                 other.expr = nullptr;
    42         }
    43 
    44         Alternative & Alternative::operator=( Alternative && other ) {
    45                 if ( &other == this )  return *this;
    46                 delete expr;
    47                 cost = other.cost;
    48                 cvtCost = other.cvtCost;
    49                 expr = other.expr;
    50                 env = other.env;
    51                 other.expr = nullptr;
    5237                return *this;
    5338        }
     
    6954                        expr->print( os, indent );
    7055                        os << "(types:" << std::endl;
    71                         os << std::string( indent+4, ' ' );
    72                         expr->get_result()->print( os, indent + 4 );
    73                         os << std::endl << ")" << std::endl;
     56                        printAll( expr->get_results(), os, indent + 4 );
     57                        os << ")" << std::endl;
    7458                } else {
    7559                        os << "Null expression!" << std::endl;
  • src/ResolvExpr/Alternative.h

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Alternative.h --
     7// Alternative.h -- 
    88//
    99// Author           : Richard C. Bilson
     
    1212// Last Modified On : Sat May 16 23:54:39 2015
    1313// Update Count     : 2
    14 //
     14// 
    1515
    1616#ifndef ALTERNATIVE_H
     
    3232                Alternative( const Alternative &other );
    3333                Alternative &operator=( const Alternative &other );
    34                 Alternative( Alternative && other );
    35                 Alternative &operator=( Alternative && other );
    3634                ~Alternative();
    37 
     35 
    3836                void initialize( const Alternative &src, Alternative &dest );
    39 
     37 
    4038                void print( std::ostream &os, int indent = 0 ) const;
    41 
     39 
    4240                Cost cost;
    4341                Cost cvtCost;
  • src/ResolvExpr/AlternativeFinder.cc

    rb726084 r84118d8  
    3838#include "SynTree/TypeSubstitution.h"
    3939#include "SymTab/Validate.h"
    40 #include "Tuples/Tuples.h"
    41 #include "Tuples/Explode.h"
     40#include "Tuples/TupleAssignment.h"
     41#include "Tuples/NameMatcher.h"
    4242#include "Common/utility.h"
    4343#include "InitTweak/InitTweak.h"
    44 #include "InitTweak/GenInit.h"
    4544#include "ResolveTypeof.h"
    4645
     
    6564        }
    6665
    67         Cost sumCost( const AltList &in ) {
    68                 Cost total;
    69                 for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
    70                         total += i->cost;
    71                 }
    72                 return total;
    73         }
    74 
    7566        namespace {
    7667                void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) {
     
    8576                                out.push_back( i->expr->clone() );
    8677                        }
     78                }
     79
     80                Cost sumCost( const AltList &in ) {
     81                        Cost total;
     82                        for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
     83                                total += i->cost;
     84                        }
     85                        return total;
    8786                }
    8887
     
    102101                                PruneStruct current( candidate );
    103102                                std::string mangleName;
    104                                 {
    105                                         Type * newType = candidate->expr->get_result()->clone();
     103                                for ( std::list< Type* >::const_iterator retType = candidate->expr->get_results().begin(); retType != candidate->expr->get_results().end(); ++retType ) {
     104                                        Type *newType = (*retType)->clone();
    106105                                        candidate->env.apply( newType );
    107                                         mangleName = SymTab::Mangler::mangle( newType );
     106                                        mangleName += SymTab::Mangler::mangle( newType );
    108107                                        delete newType;
    109108                                }
     
    134133                                if ( ! target->second.isAmbiguous ) {
    135134                                        Alternative &alt = *target->second.candidate;
    136                                         alt.env.applyFree( alt.expr->get_result() );
     135                                        for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) {
     136                                                alt.env.applyFree( *result );
     137                                        }
    137138                                        *out++ = alt;
    138139                                }
    139140                        }
     141
     142                }
     143
     144                template< typename InputIterator, typename OutputIterator >
     145                void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
     146                        AltList alternatives;
     147
     148                        // select the alternatives that have the minimum parameter cost
     149                        Cost minCost = Cost::infinity;
     150                        for ( AltList::iterator i = begin; i != end; ++i ) {
     151                                if ( i->cost < minCost ) {
     152                                        minCost = i->cost;
     153                                        i->cost = i->cvtCost;
     154                                        alternatives.clear();
     155                                        alternatives.push_back( *i );
     156                                } else if ( i->cost == minCost ) {
     157                                        i->cost = i->cvtCost;
     158                                        alternatives.push_back( *i );
     159                                }
     160                        }
     161                        std::copy( alternatives.begin(), alternatives.end(), out );
     162                }
     163
     164                template< typename InputIterator >
     165                void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
     166                        while ( begin != end ) {
     167                                result.simpleCombine( (*begin++).env );
     168                        }
    140169                }
    141170
    142171                void renameTypes( Expression *expr ) {
    143                         expr->get_result()->accept( global_renamer );
     172                        for ( std::list< Type* >::iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
     173                                (*i)->accept( global_renamer );
     174                        }
    144175                }
    145176        }
     
    173204                for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    174205                        if ( adjust ) {
    175                                 adjustExprType( i->expr->get_result(), i->env, indexer );
     206                                adjustExprTypeList( i->expr->get_results().begin(), i->expr->get_results().end(), i->env, indexer );
    176207                        }
    177208                }
     
    209240        }
    210241
    211         // std::unordered_map< Expression *, UniqueExpr * > ;
    212 
    213242        template< typename StructOrUnionType >
    214         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    215                 // by this point, member must be a name expr
    216                 NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member );
    217                 const std::string & name = nameExpr->get_name();
     243        void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ) {
    218244                std::list< Declaration* > members;
    219245                aggInst->lookup( name, members );
     
    228254        }
    229255
    230         void AlternativeFinder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    231                 if ( ConstantExpr * constantExpr = dynamic_cast< ConstantExpr * >( member ) ) {
    232                         // get the value of the constant expression as an int, must be between 0 and the length of the tuple type to have meaning
    233                         // xxx - this should be improved by memoizing the value of constant exprs
    234                         // during parsing and reusing that information here.
    235                         std::stringstream ss( constantExpr->get_constant()->get_value() );
    236                         int val;
    237                         std::string tmp;
    238                         if ( ss >> val && ! (ss >> tmp) ) {
    239                                 if ( val >= 0 && (unsigned int)val < tupleType->size() ) {
    240                                         alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
    241                                 } // if
    242                         } // if
    243                 } else if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( member ) ) {
    244                         // xxx - temporary hack until 0/1 are int constants
    245                         if ( nameExpr->get_name() == "0" || nameExpr->get_name() == "1" ) {
    246                                 std::stringstream ss( nameExpr->get_name() );
    247                                 int val;
    248                                 ss >> val;
    249                                 alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
    250                         }
    251                 } // if
    252         }
    253 
    254256        void AlternativeFinder::visit( ApplicationExpr *applicationExpr ) {
    255257                alternatives.push_back( Alternative( applicationExpr->clone(), env, Cost::zero ) );
     
    257259
    258260        Cost computeConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) {
    259                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr );
    260                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    261                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     261                ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( alt.expr );
     262                assert( appExpr );
     263                PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     264                assert( pointer );
     265                FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     266                assert( function );
    262267
    263268                Cost convCost( 0, 0, 0 );
     
    265270                std::list< DeclarationWithType* >::iterator formal = formals.begin();
    266271                std::list< Expression* >& actuals = appExpr->get_args();
    267 
    268                 std::list< Type * > formalTypes;
    269                 std::list< Type * >::iterator formalType = formalTypes.end();
    270 
    271272                for ( std::list< Expression* >::iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
    272 
    273273                        PRINT(
    274274                                std::cerr << "actual expression:" << std::endl;
    275275                                (*actualExpr)->print( std::cerr, 8 );
    276276                                std::cerr << "--- results are" << std::endl;
    277                                 (*actualExpr)->get_result()->print( std::cerr, 8 );
     277                                printAll( (*actualExpr)->get_results(), std::cerr, 8 );
    278278                        )
    279279                        std::list< DeclarationWithType* >::iterator startFormal = formal;
    280280                        Cost actualCost;
    281                         std::list< Type * > flatActualTypes;
    282                         flatten( (*actualExpr)->get_result(), back_inserter( flatActualTypes ) );
    283                         for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType ) {
    284 
    285 
    286                                 // tuple handling code
    287                                 if ( formalType == formalTypes.end() ) {
    288                                         // the type of the formal parameter may be a tuple type. To make this easier to work with,
    289                                         // flatten the tuple type and traverse the resulting list of types, incrementing the formal
    290                                         // iterator once its types have been extracted. Once a particular formal parameter's type has
    291                                         // been exhausted load the next formal parameter's type.
    292                                         if ( formal == formals.end() ) {
    293                                                 if ( function->get_isVarArgs() ) {
    294                                                         convCost += Cost( 1, 0, 0 );
    295                                                         break;
    296                                                 } else {
    297                                                         return Cost::infinity;
    298                                                 }
     281                        for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) {
     282                                if ( formal == formals.end() ) {
     283                                        if ( function->get_isVarArgs() ) {
     284                                                convCost += Cost( 1, 0, 0 );
     285                                                break;
     286                                        } else {
     287                                                return Cost::infinity;
    299288                                        }
    300                                         formalTypes.clear();
    301                                         flatten( (*formal)->get_type(), back_inserter( formalTypes ) );
    302                                         formalType = formalTypes.begin();
    303                                         ++formal;
    304289                                }
    305 
    306290                                PRINT(
    307291                                        std::cerr << std::endl << "converting ";
    308                                         (*actualType)->print( std::cerr, 8 );
     292                                        (*actual)->print( std::cerr, 8 );
    309293                                        std::cerr << std::endl << " to ";
    310294                                        (*formal)->get_type()->print( std::cerr, 8 );
    311295                                )
    312                                 Cost newCost = conversionCost( *actualType, *formalType, indexer, alt.env );
     296                                Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
    313297                                PRINT(
    314298                                        std::cerr << std::endl << "cost is" << newCost << std::endl;
     
    321305                                actualCost += newCost;
    322306
    323                                 convCost += Cost( 0, polyCost( *formalType, alt.env, indexer ) + polyCost( *actualType, alt.env, indexer ), 0 );
    324 
    325                                 formalType++;
     307                                convCost += Cost( 0, polyCost( (*formal)->get_type(), alt.env, indexer ) + polyCost( *actual, alt.env, indexer ), 0 );
     308
     309                                formal++;
    326310                        }
    327311                        if ( actualCost != Cost( 0, 0, 0 ) ) {
     
    372356        /// Adds type variables to the open variable set and marks their assertions
    373357        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    374                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     358                for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    375359                        unifiableVars[ (*tyvar)->get_name() ] = (*tyvar)->get_kind();
    376360                        for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) {
     
    381365        }
    382366
    383         /// instantiate a single argument by matching actuals from [actualIt, actualEnd) against formalType,
    384         /// producing expression(s) in out and their total cost in cost.
    385         template< typename AltIterator, typename OutputIterator >
    386         bool instantiateArgument( Type * formalType, Initializer * defaultValue, AltIterator & actualIt, AltIterator actualEnd, OpenVarSet & openVars, TypeEnvironment & resultEnv, AssertionSet & resultNeed, AssertionSet & resultHave, const SymTab::Indexer & indexer, Cost & cost, OutputIterator out ) {
    387                 if ( TupleType * tupleType = dynamic_cast< TupleType * >( formalType ) ) {
    388                         // formalType is a TupleType - group actuals into a TupleExpr whose type unifies with the TupleType
    389                         TupleExpr * tupleExpr = new TupleExpr();
    390                         for ( Type * type : *tupleType ) {
    391                                 if ( ! instantiateArgument( type, defaultValue, actualIt, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( tupleExpr->get_exprs() ) ) ) {
    392                                         delete tupleExpr;
    393                                         return false;
    394                                 }
    395                         }
    396                         tupleExpr->set_result( Tuples::makeTupleType( tupleExpr->get_exprs() ) );
    397                         *out++ = tupleExpr;
    398                 } else if ( actualIt != actualEnd ) {
    399                         // both actualType and formalType are atomic (non-tuple) types - if they unify
    400                         // then accept actual as an argument, otherwise return false (fail to instantiate argument)
    401                         Expression * actual = actualIt->expr;
    402                         Type * actualType = actual->get_result();
    403                         PRINT(
    404                                 std::cerr << "formal type is ";
    405                                 formalType->print( std::cerr );
    406                                 std::cerr << std::endl << "actual type is ";
    407                                 actualType->print( std::cerr );
    408                                 std::cerr << std::endl;
    409                         )
    410                         if ( ! unify( formalType, actualType, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
    411                                 return false;
    412                         }
    413                         // move the expression from the alternative to the output iterator
    414                         *out++ = actual;
    415                         actualIt->expr = nullptr;
    416                         cost += actualIt->cost;
    417                         ++actualIt;
    418                 } else {
    419                         // End of actuals - Handle default values
    420                         if ( SingleInit *si = dynamic_cast<SingleInit *>( defaultValue )) {
    421                                 // so far, only constant expressions are accepted as default values
    422                                 if ( ConstantExpr *cnstexpr = dynamic_cast<ConstantExpr *>( si->get_value()) ) {
    423                                         if ( Constant *cnst = dynamic_cast<Constant *>( cnstexpr->get_constant() ) ) {
    424                                                 if ( unify( formalType, cnst->get_type(), resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
    425                                                         // xxx - Don't know if this is right
    426                                                         *out++ = cnstexpr->clone();
    427                                                         return true;
    428                                                 } // if
    429                                         } // if
    430                                 } // if
    431                         } // if
    432                         return false;
    433                 } // if
    434                 return true;
    435         }
    436 
    437         bool AlternativeFinder::instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out ) {
     367        bool AlternativeFinder::instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave ) {
    438368                simpleCombineEnvironments( actuals.begin(), actuals.end(), resultEnv );
    439369                // make sure we don't widen any existing bindings
     
    443373                resultEnv.extractOpenVars( openVars );
    444374
    445                 // flatten actuals so that each actual has an atomic (non-tuple) type
    446                 AltList exploded;
    447                 Tuples::explode( actuals, indexer, back_inserter( exploded ) );
    448 
    449                 AltList::iterator actualExpr = exploded.begin();
    450                 AltList::iterator actualEnd = exploded.end();
    451                 for ( DeclarationWithType * formal : formals ) {
    452                         // match flattened actuals with formal parameters - actuals will be grouped to match
    453                         // with formals as appropriate
    454                         Cost cost;
    455                         std::list< Expression * > newExprs;
    456                         ObjectDecl * obj = safe_dynamic_cast< ObjectDecl * >( formal );
    457                         if ( ! instantiateArgument( obj->get_type(), obj->get_init(), actualExpr, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( newExprs ) ) ) {
    458                                 deleteAll( newExprs );
    459                                 return false;
    460                         }
    461                         // success - produce argument as a new alternative
    462                         assert( newExprs.size() == 1 );
    463                         out.push_back( Alternative( newExprs.front(), resultEnv, cost ) );
    464                 }
    465                 if ( actualExpr != actualEnd ) {
    466                         // there are still actuals remaining, but we've run out of formal parameters to match against
    467                         // this is okay only if the function is variadic
    468                         if ( ! isVarArgs ) {
    469                                 return false;
    470                         }
    471                         out.splice( out.end(), exploded, actualExpr, actualEnd );
     375                /*
     376                  Tuples::NameMatcher matcher( formals );
     377                  try {
     378                  matcher.match( actuals );
     379                  } catch ( Tuples::NoMatch &e ) {
     380                  std::cerr << "Alternative doesn't match: " << e.message << std::endl;
     381                  }
     382                */
     383                std::list< DeclarationWithType* >::iterator formal = formals.begin();
     384                for ( AltList::const_iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
     385                        for ( std::list< Type* >::iterator actual = actualExpr->expr->get_results().begin(); actual != actualExpr->expr->get_results().end(); ++actual ) {
     386                                if ( formal == formals.end() ) {
     387                                        return isVarArgs;
     388                                }
     389                                PRINT(
     390                                        std::cerr << "formal type is ";
     391                                        (*formal)->get_type()->print( std::cerr );
     392                                        std::cerr << std::endl << "actual type is ";
     393                                        (*actual)->print( std::cerr );
     394                                        std::cerr << std::endl;
     395                                )
     396                                if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
     397                                        return false;
     398                                }
     399                                formal++;
     400                        }
     401                }
     402                // Handling of default values
     403                while ( formal != formals.end() ) {
     404                        if ( ObjectDecl *od = dynamic_cast<ObjectDecl *>( *formal ) )
     405                                if ( SingleInit *si = dynamic_cast<SingleInit *>( od->get_init() ))
     406                                        // so far, only constant expressions are accepted as default values
     407                                        if ( ConstantExpr *cnstexpr = dynamic_cast<ConstantExpr *>( si->get_value()) )
     408                                                if ( Constant *cnst = dynamic_cast<Constant *>( cnstexpr->get_constant() ) )
     409                                                        if ( unify( (*formal)->get_type(), cnst->get_type(), resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
     410                                                                // XXX Don't know if this is right
     411                                                                actuals.push_back( Alternative( cnstexpr->clone(), env, Cost::zero ) );
     412                                                                formal++;
     413                                                                if ( formal == formals.end()) break;
     414                                                        }
     415                        return false;
    472416                }
    473417                return true;
     
    556500                                //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
    557501                                Expression *varExpr = new VariableExpr( candDecl );
    558                                 delete varExpr->get_result();
    559                                 varExpr->set_result( adjType->clone() );
     502                                deleteAll( varExpr->get_results() );
     503                                varExpr->get_results().clear();
     504                                varExpr->get_results().push_front( adjType->clone() );
    560505                                PRINT(
    561506                                        std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " ";
     
    600545
    601546        template< typename OutputIterator >
    602         void AlternativeFinder::makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out ) {
     547        void AlternativeFinder::makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out ) {
    603548                OpenVarSet openVars;
    604549                AssertionSet resultNeed, resultHave;
    605550                TypeEnvironment resultEnv;
    606551                makeUnifiableVars( funcType, openVars, resultNeed );
    607                 AltList instantiatedActuals; // filled by instantiate function
    608                 if ( instantiateFunction( funcType->get_parameters(), actualAlt, funcType->get_isVarArgs(), openVars, resultEnv, resultNeed, resultHave, instantiatedActuals ) ) {
     552                if ( instantiateFunction( funcType->get_parameters(), actualAlt, funcType->get_isVarArgs(), openVars, resultEnv, resultNeed, resultHave ) ) {
    609553                        ApplicationExpr *appExpr = new ApplicationExpr( func.expr->clone() );
    610                         Alternative newAlt( appExpr, resultEnv, sumCost( instantiatedActuals ) );
    611                         makeExprList( instantiatedActuals, appExpr->get_args() );
     554                        Alternative newAlt( appExpr, resultEnv, sumCost( actualAlt ) );
     555                        makeExprList( actualAlt, appExpr->get_args() );
    612556                        PRINT(
    613557                                std::cerr << "need assertions:" << std::endl;
     
    630574                                PointerType pt( Type::Qualifiers(), v.clone() );
    631575                                UntypedExpr *vexpr = untypedExpr->clone();
    632                                 vexpr->set_result( pt.clone() );
     576                                vexpr->get_results().push_front( pt.clone() );
    633577                                alternatives.push_back( Alternative( vexpr, env, Cost()) );
    634578                                return;
     
    643587                combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) );
    644588
    645                 // take care of possible tuple assignments
    646                 // if not tuple assignment, assignment is taken care of as a normal function call
    647                 Tuples::handleTupleAssignment( *this, untypedExpr, possibilities );
     589                Tuples::TupleAssignSpotter tassign( this );
     590                if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) {
     591                        // take care of possible tuple assignments, or discard expression
     592                        return;
     593                } // else ...
    648594
    649595                AltList candidates;
     
    658604                                // check if the type is pointer to function
    659605                                PointerType *pointer;
    660                                 if ( ( pointer = dynamic_cast< PointerType* >( func->expr->get_result() ) ) ) {
     606                                if ( func->expr->get_results().size() == 1 && ( pointer = dynamic_cast< PointerType* >( func->expr->get_results().front() ) ) ) {
    661607                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    662608                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    694640                                                // check if the type is pointer to function
    695641                                                PointerType *pointer;
    696                                                 if ( ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result() ) ) ) {
     642                                                if ( funcOp->expr->get_results().size() == 1
     643                                                        && ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_results().front() ) ) ) {
    697644                                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    698645                                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    718665
    719666                        PRINT(
    720                                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr );
    721                                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    722                                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     667                                ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( withFunc->expr );
     668                                assert( appExpr );
     669                                PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     670                                assert( pointer );
     671                                FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     672                                assert( function );
    723673                                std::cerr << "Case +++++++++++++" << std::endl;
    724674                                std::cerr << "formals are:" << std::endl;
     
    742692
    743693        bool isLvalue( Expression *expr ) {
    744                 // xxx - recurse into tuples?
    745                 return expr->has_result() && expr->get_result()->get_isLvalue();
     694                for ( std::list< Type* >::const_iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
     695                        if ( !(*i)->get_isLvalue() ) return false;
     696                } // for
     697                return true;
    746698        }
    747699
     
    757709
    758710        void AlternativeFinder::visit( CastExpr *castExpr ) {
    759                 Type *& toType = castExpr->get_result();
    760                 toType = resolveTypeof( toType, indexer );
    761                 SymTab::validateType( toType, &indexer );
    762                 adjustExprType( toType, env, indexer );
     711                for ( std::list< Type* >::iterator i = castExpr->get_results().begin(); i != castExpr->get_results().end(); ++i ) {
     712                        *i = resolveTypeof( *i, indexer );
     713                        SymTab::validateType( *i, &indexer );
     714                        adjustExprType( *i, env, indexer );
     715                } // for
    763716
    764717                AlternativeFinder finder( indexer, env );
     
    774727                        // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    775728                        // to.
    776                         int discardedValues = (*i).expr->get_result()->size() - castExpr->get_result()->size();
     729                        int discardedValues = (*i).expr->get_results().size() - castExpr->get_results().size();
    777730                        if ( discardedValues < 0 ) continue;
    778                         // xxx - may need to go into tuple types and extract relavent types and use unifyList
     731                        std::list< Type* >::iterator candidate_end = (*i).expr->get_results().begin();
     732                        std::advance( candidate_end, castExpr->get_results().size() );
    779733                        // unification run for side-effects
    780                         unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer );
    781                         Cost thisCost = castCost( (*i).expr->get_result(), castExpr->get_result(), indexer, i->env );
     734                        unifyList( castExpr->get_results().begin(), castExpr->get_results().end(),
     735                                           (*i).expr->get_results().begin(), candidate_end,
     736                                   i->env, needAssertions, haveAssertions, openVars, indexer );
     737                        Cost thisCost = castCostList( (*i).expr->get_results().begin(), candidate_end,
     738                                                                                  castExpr->get_results().begin(), castExpr->get_results().end(),
     739                                                                                  indexer, i->env );
    782740                        if ( thisCost != Cost::infinity ) {
    783741                                // count one safe conversion for each value that is thrown away
     
    802760
    803761                for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) {
    804                         if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) {
    805                                 addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    806                         } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_result() ) ) {
    807                                 addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    808                         } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( agg->expr->get_result() ) ) {
    809                                 addTupleMembers( tupleType, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     762                        if ( agg->expr->get_results().size() == 1 ) {
     763                                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_results().front() ) ) {
     764                                        addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     765                                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_results().front() ) ) {
     766                                        addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     767                                } // if
    810768                        } // if
    811769                } // for
     
    833791                        renameTypes( alternatives.back().expr );
    834792                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
    835                                 NameExpr nameExpr( "" );
    836                                 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     793                                addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
    837794                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
    838                                 NameExpr nameExpr( "" );
    839                                 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     795                                addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
    840796                        } // if
    841797                } // for
     
    938894                        alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
    939895                        for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
    940                                 alternatives.back().expr->set_result( (*i)->get_type()->clone() );
     896                                alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
    941897                        } // for
    942898                } // if
     
    961917                                                        finder.find( attrExpr->get_expr() );
    962918                                                        for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) {
    963                                                                 if ( choice->expr->get_result()->size() == 1 ) {
    964                                                                         resolveAttr(*i, function, choice->expr->get_result(), choice->env );
     919                                                                if ( choice->expr->get_results().size() == 1 ) {
     920                                                                        resolveAttr(*i, function, choice->expr->get_results().front(), choice->env );
    965921                                                                } // fi
    966922                                                        } // for
     
    1004960                                        AssertionSet needAssertions, haveAssertions;
    1005961                                        Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );
    1006                                         Type* commonType;
    1007                                         if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     962                                        std::list< Type* > commonTypes;
     963                                        if ( unifyList( second->expr->get_results().begin(), second->expr->get_results().end(), third->expr->get_results().begin(), third->expr->get_results().end(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
    1008964                                                ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() );
    1009                                                 newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() );
     965                                                std::list< Type* >::const_iterator original = second->expr->get_results().begin();
     966                                                std::list< Type* >::const_iterator commonType = commonTypes.begin();
     967                                                for ( ; original != second->expr->get_results().end() && commonType != commonTypes.end(); ++original, ++commonType ) {
     968                                                        if ( *commonType ) {
     969                                                                newExpr->get_results().push_back( *commonType );
     970                                                        } else {
     971                                                                newExpr->get_results().push_back( (*original)->clone() );
     972                                                        } // if
     973                                                } // for
    1010974                                                newAlt.expr = newExpr;
    1011975                                                inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) );
     
    1035999                        TupleExpr *newExpr = new TupleExpr;
    10361000                        makeExprList( *i, newExpr->get_exprs() );
    1037                         newExpr->set_result( Tuples::makeTupleType( newExpr->get_exprs() ) );
     1001                        for ( std::list< Expression* >::const_iterator resultExpr = newExpr->get_exprs().begin(); resultExpr != newExpr->get_exprs().end(); ++resultExpr ) {
     1002                                for ( std::list< Type* >::const_iterator resultType = (*resultExpr)->get_results().begin(); resultType != (*resultExpr)->get_results().end(); ++resultType ) {
     1003                                        newExpr->get_results().push_back( (*resultType)->clone() );
     1004                                } // for
     1005                        } // for
    10381006
    10391007                        TypeEnvironment compositeEnv;
     
    10561024                }
    10571025        }
    1058 
    1059         void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {
    1060                 alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    1061         }
    1062 
    1063         void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {
    1064                 alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );
    1065         }
    1066 
    1067         void AlternativeFinder::visit( UniqueExpr *unqExpr ) {
    1068                 AlternativeFinder finder( indexer, env );
    1069                 finder.findWithAdjustment( unqExpr->get_expr() );
    1070                 for ( Alternative & alt : finder.alternatives ) {
    1071                         // ensure that the id is passed on to the UniqueExpr alternative so that the expressions are "linked"
    1072                         UniqueExpr * newUnqExpr = new UniqueExpr( alt.expr->clone(), unqExpr->get_id() );
    1073                         alternatives.push_back( Alternative( newUnqExpr, alt.env, alt.cost ) );
    1074                 }
    1075         }
    1076 
    10771026} // namespace ResolvExpr
    10781027
  • src/ResolvExpr/AlternativeFinder.h

    rb726084 r84118d8  
    6767                virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    6868                virtual void visit( ConstructorExpr * ctorExpr );
    69                 virtual void visit( TupleIndexExpr *tupleExpr );
    70                 virtual void visit( TupleAssignExpr *tupleExpr );
    71                 virtual void visit( UniqueExpr *unqExpr );
    72                 /// Runs a new alternative finder on each element in [begin, end)
    73                 /// and writes each alternative finder to out.
     69          public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
    7470                template< typename InputIterator, typename OutputIterator >
    7571                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7672
     73          private:
    7774                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    78                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
    79                 /// Adds alternatives for member expressions where the left side has tuple type
    80                 void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     75                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name );
    8176                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    8277                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
    83                 bool instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out );
     78                bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
    8479                template< typename OutputIterator >
    85                 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out );
     80                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
    8681                template< typename OutputIterator >
    8782                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     
    9489
    9590        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
    96 
    97         template< typename InputIterator, typename OutputIterator >
    98         void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    99                 AltList alternatives;
    100 
    101                 // select the alternatives that have the minimum parameter cost
    102                 Cost minCost = Cost::infinity;
    103                 for ( InputIterator i = begin; i != end; ++i ) {
    104                         if ( i->cost < minCost ) {
    105                                 minCost = i->cost;
    106                                 i->cost = i->cvtCost;
    107                                 alternatives.clear();
    108                                 alternatives.push_back( *i );
    109                         } else if ( i->cost == minCost ) {
    110                                 i->cost = i->cvtCost;
    111                                 alternatives.push_back( *i );
    112                         }
    113                 }
    114                 std::copy( alternatives.begin(), alternatives.end(), out );
    115         }
    116 
    117         Cost sumCost( const AltList &in );
    118 
    119         template< typename InputIterator >
    120         void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
    121                 while ( begin != end ) {
    122                         result.simpleCombine( (*begin++).env );
    123                 }
    124         }
    12591} // namespace ResolvExpr
    12692
  • src/ResolvExpr/AlternativePrinter.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AlternativePrinter.cc --
     7// AlternativePrinter.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    3333                for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    3434                        os << "Alternative " << count++ << " ==============" << std::endl;
    35                         i->expr->get_result()->print( os );
     35                        printAll( i->expr->get_results(), os );
    3636                        //    i->print( os );
    3737                        os << std::endl;
  • src/ResolvExpr/ConversionCost.cc

    rb726084 r84118d8  
    240240                        std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin();
    241241                        std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin();
    242                         while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
     242                        while ( srcIt != tupleType->get_types().end() ) {
    243243                                Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env );
    244244                                if ( newCost == Cost::infinity ) {
  • src/ResolvExpr/FindOpenVars.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindOpenVars.cc --
     7// FindOpenVars.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    4747        void FindOpenVars::common_action( Type *type ) {
    4848                if ( nextIsOpen ) {
    49                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     49                        for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    5050                                openVars[ (*i)->get_name() ] = (*i)->get_kind();
    5151                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
     
    5656                        }
    5757                } else {
    58                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     58                        for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    5959                                closedVars[ (*i)->get_name() ] = (*i)->get_kind();
    6060                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
  • src/ResolvExpr/RenameVars.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // RenameVars.cc --
     7// RenameVars.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    125125                        mapStack.push_front( mapStack.front() );
    126126                        // renames all "forall" type names to `_${level}_${name}'
    127                         for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     127                        for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    128128                                std::ostringstream output;
    129129                                output << "_" << level << "_" << (*i)->get_name();
  • src/ResolvExpr/ResolveTypeof.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ResolveTypeof.cc --
     7// ResolveTypeof.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    5858                if ( typeofType->get_expr() ) {
    5959                        Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer );
    60                         assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() );
    61                         Type *newType = newExpr->get_result();
     60                        assert( newExpr->get_results().size() > 0 );
     61                        Type *newType;
     62                        if ( newExpr->get_results().size() > 1 ) {
     63                                TupleType *tupleType = new TupleType( Type::Qualifiers() );
     64                                cloneAll( newExpr->get_results(), tupleType->get_types() );
     65                                newType = tupleType;
     66                        } else {
     67                                newType = newExpr->get_results().front()->clone();
     68                        } // if
    6269                        delete typeofType;
    6370                        return newType;
  • src/ResolvExpr/Resolver.cc

    rb726084 r84118d8  
    1919#include "RenameVars.h"
    2020#include "ResolveTypeof.h"
    21 #include "typeops.h"
    2221#include "SynTree/Statement.h"
    2322#include "SynTree/Type.h"
     
    6968          void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & );
    7069          void fallbackInit( ConstructorInit * ctorInit );
    71 
    72                 Type * functionReturn = nullptr;
    73                 Type *initContext = nullptr;
    74                 Type *switchType = nullptr;
     70                std::list< Type * > functionReturn;
     71                Type *initContext;
    7572                bool inEnumDecl = false;
    7673        };
     
    160157                        const TypeEnvironment *newEnv = 0;
    161158                        for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    162                                 if ( i->expr->get_result()->size() == 1 && isIntegralType( i->expr->get_result() ) ) {
     159                                if ( i->expr->get_results().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) {
    163160                                        if ( newExpr ) {
    164161                                                throw SemanticError( "Too many interpretations for case control expression", untyped );
     
    237234                Type *new_type = resolveTypeof( functionDecl->get_type(), *this );
    238235                functionDecl->set_type( new_type );
    239                 ValueGuard< Type * > oldFunctionReturn( functionReturn );
    240                 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
     236                std::list< Type * > oldFunctionReturn = functionReturn;
     237                functionReturn.clear();
     238                for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) {
     239                        functionReturn.push_back( (*i)->get_type() );
     240                } // for
    241241                SymTab::Indexer::visit( functionDecl );
     242                functionReturn = oldFunctionReturn;
    242243        }
    243244
     
    337338        void Resolver::visit( ReturnStmt *returnStmt ) {
    338339                if ( returnStmt->get_expr() ) {
    339                         CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() );
     340                        CastExpr *castExpr = new CastExpr( returnStmt->get_expr() );
     341                        cloneAll( functionReturn, castExpr->get_results() );
    340342                        Expression *newExpr = findSingleExpression( castExpr, *this );
    341343                        delete castExpr;
     
    382384                                if ( isCharType( at->get_base() ) ) {
    383385                                        // check if the resolved type is char *
    384                                         if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
     386                                        if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_results().front() ) ) {
    385387                                                if ( isCharType( pt->get_base() ) ) {
    386388                                                        // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
     
    444446                                (*iter)->accept( *this );
    445447                        } // for
    446                 } else if ( TupleType * tt = dynamic_cast< TupleType * > ( initContext ) ) {
    447                         for ( Type * t : *tt ) {
    448                                 if ( iter == end ) break;
    449                                 initContext = t;
    450                                 (*iter++)->accept( *this );
    451                         }
    452448                } else if ( StructInstType * st = dynamic_cast< StructInstType * >( initContext ) ) {
    453449                        resolveAggrInit( st->get_baseStruct(), iter, end );
  • src/ResolvExpr/TypeEnvironment.cc

    rb726084 r84118d8  
    158158        }
    159159
    160         void TypeEnvironment::add( const Type::ForallList &tyDecls ) {
    161                 for ( Type::ForallList::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) {
     160        void TypeEnvironment::add( const std::list< TypeDecl* > &tyDecls ) {
     161                for ( std::list< TypeDecl* >::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) {
    162162                        EqvClass newClass;
    163163                        newClass.vars.insert( (*i)->get_name() );
  • src/ResolvExpr/TypeEnvironment.h

    rb726084 r84118d8  
    5555                bool lookup( const std::string &var, EqvClass &eqvClass ) const;
    5656                void add( const EqvClass &eqvClass );
    57                 void add( const Type::ForallList &tyDecls );
     57                void add( const std::list< TypeDecl* > &tyDecls );
    5858                template< typename SynTreeClass > int apply( SynTreeClass *&type ) const;
    5959                template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const;
  • src/ResolvExpr/Unify.cc

    rb726084 r84118d8  
    597597        }
    598598
    599         // xxx - compute once and store in the FunctionType?
    600         Type * extractResultType( FunctionType * function ) {
    601                 if ( function->get_returnVals().size() == 0 ) {
    602                         return new VoidType( Type::Qualifiers() );
    603                 } else if ( function->get_returnVals().size() == 1 ) {
    604                         return function->get_returnVals().front()->get_type()->clone();
    605                 } else {
    606                         TupleType * tupleType = new TupleType( Type::Qualifiers() );
    607                         for ( DeclarationWithType * decl : function->get_returnVals() ) {
    608                                 tupleType->get_types().push_back( decl->get_type()->clone() );
    609                         } // for
    610                         return tupleType;
    611                 }
    612         }
    613599} // namespace ResolvExpr
    614600
  • src/ResolvExpr/typeops.h

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // typeops.h --
     7// typeops.h -- 
    88//
    99// Author           : Richard C. Bilson
     
    3030                typedef typename InputIterator::value_type SetType;
    3131                typedef typename std::list< typename SetType::value_type > ListType;
    32 
     32 
    3333                if ( begin == end )     {
    3434                        *out++ = ListType();
    3535                        return;
    3636                } // if
    37 
     37 
    3838                InputIterator current = begin;
    3939                begin++;
     
    4141                std::list< ListType > recursiveResult;
    4242                combos( begin, end, back_inserter( recursiveResult ) );
    43 
     43 
    4444                for ( typename std::list< ListType >::const_iterator i = recursiveResult.begin(); i != recursiveResult.end(); ++i ) {
    4545                        for ( typename ListType::const_iterator j = current->begin(); j != current->end(); ++j ) {
     
    5252                } // for
    5353        }
    54 
     54 
    5555        // in AdjustExprType.cc
    5656        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
     
    144144        }
    145145
    146         /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.
    147         Type * extractResultType( FunctionType * functionType );
    148 
    149146        // in CommonType.cc
    150147        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     
    155152        // in Occurs.cc
    156153        bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
    157 
    158         // flatten tuple type into list of types
    159         template< typename OutputIterator >
    160         void flatten( Type * type, OutputIterator out ) {
    161                 if ( TupleType * tupleType = dynamic_cast< TupleType * >( type ) ) {
    162                         for ( Type * t : tupleType->get_types() ) {
    163                                 flatten( t, out );
    164                         }
    165                 } else {
    166                         *out++ = type;
    167                 }
    168         }
    169154} // namespace ResolvExpr
    170155
  • src/SymTab/Autogen.cc

    rb726084 r84118d8  
    116116                // This happens before function pointer type conversion, so need to do it manually here
    117117                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
    118                 Type * assignVarExprType = assignVarExpr->get_result();
     118                Type *& assignVarExprType = assignVarExpr->get_results().front();
    119119                assignVarExprType = new PointerType( Type::Qualifiers(), assignVarExprType );
    120                 assignVarExpr->set_result( assignVarExprType );
    121120                ApplicationExpr * assignExpr = new ApplicationExpr( assignVarExpr );
    122121                assignExpr->get_args().push_back( new VariableExpr( dstParam ) );
  • src/SymTab/Indexer.cc

    rb726084 r84118d8  
    4040
    4141namespace SymTab {
    42         template< typename TreeType, typename VisitorType >
    43         inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {
     42        template< typename Container, typename VisitorType >
     43        inline void acceptAllNewScope( Container &container, VisitorType &visitor ) {
    4444                visitor.enterScope();
    45                 maybeAccept( tree, visitor );
     45                acceptAll( container, visitor );
    4646                visitor.leaveScope();
    4747        }
     
    143143                for ( DeclarationWithType * decl : copy ) {
    144144                        if ( FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl ) ) {
    145                                 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
     145                                std::list< DeclarationWithType * > params = function->get_functionType()->get_parameters();
    146146                                assert( ! params.empty() );
    147147                                // use base type of pointer, so that qualifiers on the pointer type aren't considered.
     
    337337
    338338        void Indexer::visit( ApplicationExpr *applicationExpr ) {
    339                 acceptNewScope( applicationExpr->get_result(), *this );
     339                acceptAllNewScope( applicationExpr->get_results(), *this );
    340340                maybeAccept( applicationExpr->get_function(), *this );
    341341                acceptAll( applicationExpr->get_args(), *this );
     
    343343
    344344        void Indexer::visit( UntypedExpr *untypedExpr ) {
    345                 acceptNewScope( untypedExpr->get_result(), *this );
     345                acceptAllNewScope( untypedExpr->get_results(), *this );
    346346                acceptAll( untypedExpr->get_args(), *this );
    347347        }
    348348
    349349        void Indexer::visit( NameExpr *nameExpr ) {
    350                 acceptNewScope( nameExpr->get_result(), *this );
     350                acceptAllNewScope( nameExpr->get_results(), *this );
    351351        }
    352352
    353353        void Indexer::visit( AddressExpr *addressExpr ) {
    354                 acceptNewScope( addressExpr->get_result(), *this );
     354                acceptAllNewScope( addressExpr->get_results(), *this );
    355355                maybeAccept( addressExpr->get_arg(), *this );
    356356        }
    357357
    358358        void Indexer::visit( LabelAddressExpr *labAddressExpr ) {
    359                 acceptNewScope( labAddressExpr->get_result(), *this );
     359                acceptAllNewScope( labAddressExpr->get_results(), *this );
    360360                maybeAccept( labAddressExpr->get_arg(), *this );
    361361        }
    362362
    363363        void Indexer::visit( CastExpr *castExpr ) {
    364                 acceptNewScope( castExpr->get_result(), *this );
     364                acceptAllNewScope( castExpr->get_results(), *this );
    365365                maybeAccept( castExpr->get_arg(), *this );
    366366        }
    367367
    368368        void Indexer::visit( UntypedMemberExpr *memberExpr ) {
    369                 acceptNewScope( memberExpr->get_result(), *this );
     369                acceptAllNewScope( memberExpr->get_results(), *this );
    370370                maybeAccept( memberExpr->get_aggregate(), *this );
    371371        }
    372372
    373373        void Indexer::visit( MemberExpr *memberExpr ) {
    374                 acceptNewScope( memberExpr->get_result(), *this );
     374                acceptAllNewScope( memberExpr->get_results(), *this );
    375375                maybeAccept( memberExpr->get_aggregate(), *this );
    376376        }
    377377
    378378        void Indexer::visit( VariableExpr *variableExpr ) {
    379                 acceptNewScope( variableExpr->get_result(), *this );
     379                acceptAllNewScope( variableExpr->get_results(), *this );
    380380        }
    381381
    382382        void Indexer::visit( ConstantExpr *constantExpr ) {
    383                 acceptNewScope( constantExpr->get_result(), *this );
     383                acceptAllNewScope( constantExpr->get_results(), *this );
    384384                maybeAccept( constantExpr->get_constant(), *this );
    385385        }
    386386
    387387        void Indexer::visit( SizeofExpr *sizeofExpr ) {
    388                 acceptNewScope( sizeofExpr->get_result(), *this );
     388                acceptAllNewScope( sizeofExpr->get_results(), *this );
    389389                if ( sizeofExpr->get_isType() ) {
    390390                        maybeAccept( sizeofExpr->get_type(), *this );
     
    395395
    396396        void Indexer::visit( AlignofExpr *alignofExpr ) {
    397                 acceptNewScope( alignofExpr->get_result(), *this );
     397                acceptAllNewScope( alignofExpr->get_results(), *this );
    398398                if ( alignofExpr->get_isType() ) {
    399399                        maybeAccept( alignofExpr->get_type(), *this );
     
    404404
    405405        void Indexer::visit( UntypedOffsetofExpr *offsetofExpr ) {
    406                 acceptNewScope( offsetofExpr->get_result(), *this );
     406                acceptAllNewScope( offsetofExpr->get_results(), *this );
    407407                maybeAccept( offsetofExpr->get_type(), *this );
    408408        }
    409409
    410410        void Indexer::visit( OffsetofExpr *offsetofExpr ) {
    411                 acceptNewScope( offsetofExpr->get_result(), *this );
     411                acceptAllNewScope( offsetofExpr->get_results(), *this );
    412412                maybeAccept( offsetofExpr->get_type(), *this );
    413413                maybeAccept( offsetofExpr->get_member(), *this );
     
    415415
    416416        void Indexer::visit( OffsetPackExpr *offsetPackExpr ) {
    417                 acceptNewScope( offsetPackExpr->get_result(), *this );
     417                acceptAllNewScope( offsetPackExpr->get_results(), *this );
    418418                maybeAccept( offsetPackExpr->get_type(), *this );
    419419        }
    420420
    421421        void Indexer::visit( AttrExpr *attrExpr ) {
    422                 acceptNewScope( attrExpr->get_result(), *this );
     422                acceptAllNewScope( attrExpr->get_results(), *this );
    423423                if ( attrExpr->get_isType() ) {
    424424                        maybeAccept( attrExpr->get_type(), *this );
     
    429429
    430430        void Indexer::visit( LogicalExpr *logicalExpr ) {
    431                 acceptNewScope( logicalExpr->get_result(), *this );
     431                acceptAllNewScope( logicalExpr->get_results(), *this );
    432432                maybeAccept( logicalExpr->get_arg1(), *this );
    433433                maybeAccept( logicalExpr->get_arg2(), *this );
     
    435435
    436436        void Indexer::visit( ConditionalExpr *conditionalExpr ) {
    437                 acceptNewScope( conditionalExpr->get_result(), *this );
     437                acceptAllNewScope( conditionalExpr->get_results(), *this );
    438438                maybeAccept( conditionalExpr->get_arg1(), *this );
    439439                maybeAccept( conditionalExpr->get_arg2(), *this );
     
    442442
    443443        void Indexer::visit( CommaExpr *commaExpr ) {
    444                 acceptNewScope( commaExpr->get_result(), *this );
     444                acceptAllNewScope( commaExpr->get_results(), *this );
    445445                maybeAccept( commaExpr->get_arg1(), *this );
    446446                maybeAccept( commaExpr->get_arg2(), *this );
     
    448448
    449449        void Indexer::visit( TupleExpr *tupleExpr ) {
    450                 acceptNewScope( tupleExpr->get_result(), *this );
     450                acceptAllNewScope( tupleExpr->get_results(), *this );
    451451                acceptAll( tupleExpr->get_exprs(), *this );
    452452        }
    453453
    454         void Indexer::visit( TupleAssignExpr *tupleExpr ) {
    455                 acceptNewScope( tupleExpr->get_result(), *this );
    456                 enterScope();
    457                 acceptAll( tupleExpr->get_tempDecls(), *this );
    458                 acceptAll( tupleExpr->get_assigns(), *this );
    459                 leaveScope();
     454        void Indexer::visit( SolvedTupleExpr *tupleExpr ) {
     455                acceptAllNewScope( tupleExpr->get_results(), *this );
     456                acceptAll( tupleExpr->get_exprs(), *this );
    460457        }
    461458
    462459        void Indexer::visit( TypeExpr *typeExpr ) {
    463                 acceptNewScope( typeExpr->get_result(), *this );
     460                acceptAllNewScope( typeExpr->get_results(), *this );
    464461                maybeAccept( typeExpr->get_type(), *this );
    465462        }
     
    472469
    473470        void Indexer::visit( UntypedValofExpr *valofExpr ) {
    474                 acceptNewScope( valofExpr->get_result(), *this );
     471                acceptAllNewScope( valofExpr->get_results(), *this );
    475472                maybeAccept( valofExpr->get_body(), *this );
    476473        }
  • src/SymTab/Indexer.h

    rb726084 r84118d8  
    6464                virtual void visit( ConditionalExpr *conditionalExpr );
    6565                virtual void visit( CommaExpr *commaExpr );
     66                virtual void visit( TupleExpr *tupleExpr );
     67                virtual void visit( SolvedTupleExpr *tupleExpr );
    6668                virtual void visit( TypeExpr *typeExpr );
    6769                virtual void visit( AsmExpr *asmExpr );
    6870                virtual void visit( UntypedValofExpr *valofExpr );
    69                 virtual void visit( TupleExpr *tupleExpr );
    70                 virtual void visit( TupleAssignExpr *tupleExpr );
    7171
    7272                virtual void visit( TraitInstType *contextInst );
  • src/SymTab/Mangler.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Mangler.cc --
     7// Mangler.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    3535                return mangler.get_mangleName();
    3636        }
    37 
     37       
    3838        Mangler::Mangler( bool mangleOverridable, bool typeMode )
    3939                : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ) {}
    40 
     40               
    4141        Mangler::Mangler( const Mangler &rhs ) : mangleName() {
    4242                varNums = rhs.varNums;
     
    115115                        "Ir",   // LongDoubleImaginary
    116116                };
    117 
     117 
    118118                printQualifiers( basicType );
    119119                mangleName << btLetter[ basicType->get_kind() ];
     
    253253                // skip if not including qualifiers
    254254                if ( typeMode ) return;
    255 
     255               
    256256                if ( ! type->get_forall().empty() ) {
    257257                        std::list< std::string > assertionNames;
    258258                        int tcount = 0, dcount = 0, fcount = 0;
    259259                        mangleName << "A";
    260                         for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     260                        for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    261261                                switch ( (*i)->get_kind() ) {
    262262                                  case TypeDecl::Any:
  • src/SymTab/Validate.cc

    rb726084 r84118d8  
    2323// - All enumeration constants have type EnumInstType.
    2424//
    25 // - The type "void" never occurs in lists of function parameter or return types.  A function
    26 //   taking no arguments has no argument types.
     25// - The type "void" never occurs in lists of function parameter or return types; neither do tuple types.  A function
     26//   taking no arguments has no argument types, and tuples are flattened.
    2727//
    2828// - No context instances exist; they are all replaced by the set of declarations signified by the context, instantiated
     
    243243                return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl );
    244244        }
    245         // xxx - shouldn't this be declsToAddBefore?
     245
    246246        template< typename AggDecl >
    247247        void HoistStruct::handleAggregate( AggDecl *aggregateDecl ) {
     
    431431        /// Fix up assertions
    432432        void forallFixer( Type *func ) {
    433                 for ( Type::ForallList::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
     433                for ( std::list< TypeDecl * >::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
    434434                        std::list< DeclarationWithType * > toBeDone, nextRound;
    435435                        toBeDone.splice( toBeDone.end(), (*type )->get_assertions() );
  • src/SynTree/AddressExpr.cc

    rb726084 r84118d8  
    1919
    2020AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) {
    21         if ( arg->has_result() ) {
    22                 set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) );
    23         }
     21        for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) {
     22                get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) );
     23        } // for
    2424}
    2525
     
    3535        if ( arg ) {
    3636                os << std::string( indent+2, ' ' );
    37                 arg->print( os, indent+2 );
     37    arg->print( os, indent+2 );
    3838        } // if
    3939}
  • src/SynTree/ApplicationExpr.cc

    rb726084 r84118d8  
    2121#include "TypeSubstitution.h"
    2222#include "Common/utility.h"
    23 #include "ResolvExpr/typeops.h"
     23
    2424
    2525ParamEntry::ParamEntry( const ParamEntry &other ) :
     
    4343
    4444ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) {
    45         PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    46         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     45        PointerType *pointer = dynamic_cast< PointerType* >( funcExpr->get_results().front() );
     46        assert( pointer );
     47        FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     48        assert( function );
    4749
    48         set_result( ResolvExpr::extractResultType( function ) );
    49 
    50         assert( has_result() );
     50        for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
     51                get_results().push_back( (*i)->get_type()->clone() );
     52        } // for
    5153}
    5254
  • src/SynTree/CommaExpr.cc

    rb726084 r84118d8  
    2323        // to false on all result types. Actually doing this causes some strange things
    2424        // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    25         set_result( maybeClone( arg2->get_result() ) );
    26         // get_type->set_isLvalue( false );
     25        cloneAll( arg2->get_results(), get_results() );
     26        // for ( Type *& type : get_results() ) {
     27        //      type->set_isLvalue( false );
     28        // }
    2729}
    2830
  • src/SynTree/CompoundStmt.cc

    rb726084 r84118d8  
    2020#include "Expression.h"
    2121#include "Declaration.h"
    22 #include "SynTree/VarExprReplacer.h"
    2322
    2423using std::string;
    2524using std::endl;
     25
     26class VarExprReplacer : public Visitor {
     27public:
     28  typedef std::map< DeclarationWithType *, DeclarationWithType * > DeclMap;
     29private:
     30  const DeclMap & declMap;
     31public:
     32  VarExprReplacer( const DeclMap & declMap ) : declMap( declMap ) {}
     33
     34  // replace variable with new node from decl map
     35  virtual void visit( VariableExpr * varExpr ) {
     36    if ( declMap.count( varExpr->get_var() ) ) {
     37      varExpr->set_var( declMap.at( varExpr->get_var() ) );
     38    }
     39  }
     40};
     41
    2642
    2743CompoundStmt::CompoundStmt( std::list<Label> labels ) : Statement( labels ) {
     
    3147        cloneAll( other.kids, kids );
    3248
    33         // when cloning a compound statement, we may end up cloning declarations which
    34         // are referred to by VariableExprs throughout the block. Cloning a VariableExpr
    35         // does a shallow copy, so the VariableExpr will end up pointing to the original
    36         // declaration. If the original declaration is deleted, e.g. because the original
    37         // CompoundStmt is deleted, then we have a dangling pointer. To avoid this case,
    38         // find all DeclarationWithType nodes (since a VariableExpr must point to a
    39         // DeclarationWithType) in the original CompoundStmt and map them to the cloned
    40         // node in the new CompoundStmt ('this'), then replace the Declarations referred to
    41         // by each VariableExpr according to the constructed map. Note that only the declarations
    42         // in the current level are collected into the map, because child CompoundStmts will
    43         // recursively execute this routine. There may be more efficient ways of doing
    44         // this.
    45         VarExprReplacer::DeclMap declMap;
    46         std::list< Statement * >::const_iterator origit = other.kids.begin();
    47         for ( Statement * s : kids ) {
    48                 assert( origit != other.kids.end() );
    49                 Statement * origStmt = *origit++;
    50                 if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) {
    51                         DeclStmt * origDeclStmt = dynamic_cast< DeclStmt * >( origStmt );
    52                         assert( origDeclStmt );
    53                         if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) {
    54                                 DeclarationWithType * origdwt = dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
    55                                 assert( origdwt );
    56                                 assert( dwt->get_name() == origdwt->get_name() );
    57                                 declMap[ origdwt ] = dwt;
    58                         }
    59                 }
    60         }
    61         if ( ! declMap.empty() ) {
    62                 VarExprReplacer replacer( declMap );
    63                 accept( replacer );
    64         }
     49  // when cloning a compound statement, we may end up cloning declarations which
     50  // are referred to by VariableExprs throughout the block. Cloning a VariableExpr
     51  // does a shallow copy, so the VariableExpr will end up pointing to the original
     52  // declaration. If the original declaration is deleted, e.g. because the original
     53  // CompoundStmt is deleted, then we have a dangling pointer. To avoid this case,
     54  // find all DeclarationWithType nodes (since a VariableExpr must point to a
     55  // DeclarationWithType) in the original CompoundStmt and map them to the cloned
     56  // node in the new CompoundStmt ('this'), then replace the Declarations referred to
     57  // by each VariableExpr according to the constructed map. Note that only the declarations
     58  // in the current level are collected into the map, because child CompoundStmts will
     59  // recursively execute this routine. There may be more efficient ways of doing
     60  // this.
     61  VarExprReplacer::DeclMap declMap;
     62  std::list< Statement * >::const_iterator origit = other.kids.begin();
     63  for ( Statement * s : kids ) {
     64    assert( origit != other.kids.end() );
     65    if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) {
     66      DeclStmt * origDeclStmt = dynamic_cast< DeclStmt * >( *origit );
     67      assert( origDeclStmt );
     68      if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) {
     69        DeclarationWithType * origdwt = dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
     70        assert( origdwt );
     71        declMap[ origdwt ] = dwt;
     72      }
     73    }
     74  }
     75  if ( ! declMap.empty() ) {
     76    VarExprReplacer replacer( declMap );
     77    accept( replacer );
     78  }
    6579}
    6680
  • src/SynTree/Expression.cc

    rb726084 r84118d8  
    3131
    3232
    33 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {}
    34 
    35 Expression::Expression( const Expression &other ) : result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
     33Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {}
     34
     35Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
     36        cloneAll( other.results, results );
    3637}
    3738
     
    3940        delete env;
    4041        delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix
    41         delete result;
     42        deleteAll( results );
     43}
     44
     45void Expression::add_result( Type *t ) {
     46        if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) {
     47                std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) );
     48        } else {
     49                results.push_back(t);
     50        } // if
    4251}
    4352
     
    5968
    6069ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) {
    61         set_result( constant.get_type()->clone() );
     70        add_result( constant.get_type()->clone() );
    6271}
    6372
     
    7685        assert( var );
    7786        assert( var->get_type() );
    78         Type * type = var->get_type()->clone();
    79         type->set_isLvalue( true );
    80         set_result( type );
     87        add_result( var->get_type()->clone() );
     88        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     89                (*i)->set_isLvalue( true );
     90        } // for
    8191}
    8292
     
    100110SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) :
    101111                Expression( _aname ), expr(expr_), type(0), isType(false) {
    102         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     112        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    103113}
    104114
    105115SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) :
    106116                Expression( _aname ), expr(0), type(type_), isType(true) {
    107         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     117        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    108118}
    109119
     
    131141AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) :
    132142                Expression( _aname ), expr(expr_), type(0), isType(false) {
    133         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     143        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    134144}
    135145
    136146AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) :
    137147                Expression( _aname ), expr(0), type(type_), isType(true) {
    138         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     148        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    139149}
    140150
     
    162172UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) :
    163173                Expression( _aname ), type(type_), member(member_) {
    164         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     174        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    165175}
    166176
     
    187197OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) :
    188198                Expression( _aname ), type(type_), member(member_) {
    189         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     199        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    190200}
    191201
     
    219229
    220230OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    221         set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
     231        add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    222232}
    223233
     
    274284
    275285CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) {
    276         set_result(toType);
     286        add_result(toType);
    277287}
    278288
    279289CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) {
    280         set_result( new VoidType( Type::Qualifiers() ) );
    281290}
    282291
     
    294303        arg->print(os, indent+2);
    295304        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
    296         os << std::string( indent+2, ' ' );
    297         if ( result->isVoid() ) {
    298                 os << "nothing";
     305        if ( results.empty() ) {
     306                os << std::string( indent+2, ' ' ) << "nothing" << std::endl;
    299307        } else {
    300                 result->print( os, indent+2 );
     308                printAll(results, os, indent+2);
    301309        } // if
    302         os << std::endl;
    303         Expression::print( os, indent );
    304 }
    305 
    306 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) :
     310        Expression::print( os, indent );
     311}
     312
     313UntypedMemberExpr::UntypedMemberExpr( std::string _member, Expression *_aggregate, Expression *_aname ) :
    307314                Expression( _aname ), member(_member), aggregate(_aggregate) {}
    308315
    309316UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
    310                 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
     317                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    311318}
    312319
    313320UntypedMemberExpr::~UntypedMemberExpr() {
    314321        delete aggregate;
    315         delete member;
    316322}
    317323
    318324void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    319         os << "Untyped Member Expression, with field: " << std::endl;
    320         os << std::string( indent+2, ' ' );
    321         get_member()->print(os, indent+4);
    322         os << std::string( indent+2, ' ' );
     325        os << "Untyped Member Expression, with field: " << get_member();
    323326
    324327        Expression *agg = get_aggregate();
    325         os << "from aggregate: " << std::endl;
     328        os << ", from aggregate: ";
    326329        if (agg != 0) {
    327                 os << std::string( indent + 4, ' ' );
    328                 agg->print(os, indent + 4);
     330                os << std::string( indent + 2, ' ' );
     331                agg->print(os, indent + 2);
    329332        }
    330333        os << std::string( indent+2, ' ' );
     
    335338MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) :
    336339                Expression( _aname ), member(_member), aggregate(_aggregate) {
    337         set_result( member->get_type()->clone() );
    338         get_result()->set_isLvalue( true );
     340        add_result( member->get_type()->clone() );
     341        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     342                (*i)->set_isLvalue( true );
     343        } // for
    339344}
    340345
     
    367372}
    368373
    369 UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) :
    370                 Expression( _aname ), function(_function), args(_args) {}
     374
     375UntypedExpr::UntypedExpr( Expression *_function, Expression *_aname ) : Expression( _aname ), function( _function ) {}
    371376
    372377UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
     
    375380}
    376381
     382UntypedExpr::UntypedExpr( Expression *_function, std::list<Expression *> &_args, Expression *_aname ) :
     383                Expression( _aname ), function(_function), args(_args) {}
     384
    377385UntypedExpr::~UntypedExpr() {
    378386        delete function;
    379387        deleteAll( args );
    380388}
    381 
    382 UntypedExpr * UntypedExpr::createDeref( Expression * expr ) {
    383         UntypedExpr * ret = new UntypedExpr( new NameExpr("*?"), std::list< Expression * >{ expr } );
    384         if ( Type * type = expr->get_result() ) {
    385                 Type * base = InitTweak::getPointerBase( type );
    386                 if ( ! base ) {
    387                         std::cerr << type << std::endl;
    388                 }
    389                 assertf( base, "expected pointer type in dereference\n" );
    390                 ret->set_result( maybeClone( base ) );
    391         }
    392         return ret;
    393 }
    394 
    395 UntypedExpr * UntypedExpr::createAssign( Expression * arg1, Expression * arg2 ) {
    396         assert( arg1 && arg2 );
    397         UntypedExpr * ret = new UntypedExpr( new NameExpr( "?=?" ), std::list< Expression * >{ arg1, arg2 } );
    398         if ( arg1->get_result() && arg2->get_result() ) {
    399                 // if both expressions are typed, assumes that this assignment is a C bitwise assignment,
    400                 // so the result is the type of the RHS
    401                 ret->set_result( arg2->get_result()->clone() );
    402         }
    403         return ret;
    404 }
    405 
    406389
    407390void UntypedExpr::print( std::ostream &os, int indent ) const {
     
    436419LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) :
    437420                Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    438         set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     421        add_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    439422}
    440423
     
    471454
    472455void ConditionalExpr::print( std::ostream &os, int indent ) const {
    473         os << "Conditional expression on: " << std::endl;
    474         os << std::string( indent+2, ' ' );
     456        os << std::string( indent, ' ' ) << "Conditional expression on: " << std::endl;
    475457        arg1->print( os, indent+2 );
    476458        os << std::string( indent, ' ' ) << "First alternative:" << std::endl;
    477         os << std::string( indent+2, ' ' );
    478459        arg2->print( os, indent+2 );
    479460        os << std::string( indent, ' ' ) << "Second alternative:" << std::endl;
    480         os << std::string( indent+2, ' ' );
    481461        arg3->print( os, indent+2 );
    482462        os << std::endl;
     
    497477ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
    498478        assert( callExpr );
    499         assert( callExpr->has_result() );
    500         set_result( callExpr->get_result()->clone() );
     479        cloneAll( callExpr->get_results(), results );
    501480}
    502481
     
    531510        Expression * arg = InitTweak::getCallArg( callExpr, 0 );
    532511        assert( arg );
    533         set_result( maybeClone( arg->get_result() ) );
     512        cloneAll( arg->get_results(), results );
    534513}
    535514
     
    551530
    552531CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {
    553         assert( type && initializer );
    554         set_result( type->clone() );
    555 }
    556 
    557 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( other.type->clone() ), initializer( other.initializer->clone() ) {}
     532        add_result( type->clone() );
     533}
     534
     535CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {}
    558536
    559537CompoundLiteralExpr::~CompoundLiteralExpr() {
     
    564542void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {
    565543        os << "Compound Literal Expression: " << std::endl;
    566         os << std::string( indent+2, ' ' );
    567         type->print( os, indent + 2 );
    568         os << std::string( indent+2, ' ' );
    569         initializer->print( os, indent + 2 );
     544        if ( type ) type->print( os, indent + 2 );
     545        if ( initializer ) initializer->print( os, indent + 2 );
    570546}
    571547
     
    581557
    582558RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    583 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
     559RangeExpr::RangeExpr( const RangeExpr &other ) : low( other.low->clone() ), high( other.high->clone() ) {}
    584560void RangeExpr::print( std::ostream &os, int indent ) const {
    585         os << "Range Expression: ";
     561        os << std::string( indent, ' ' ) << "Range Expression: ";
    586562        low->print( os, indent );
    587563        os << " ... ";
    588564        high->print( os, indent );
    589 }
    590 
    591 StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
    592         assert( statements );
    593         std::list< Statement * > & body = statements->get_kids();
    594         if ( ! body.empty() ) {
    595                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    596                         set_result( maybeClone( exprStmt->get_expr()->get_result() ) );
    597                 }
    598         }
    599 }
    600 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {}
    601 StmtExpr::~StmtExpr() {
    602         delete statements;
    603 }
    604 void StmtExpr::print( std::ostream &os, int indent ) const {
    605         os << "Statement Expression: " << std::endl << std::string( indent, ' ' );
    606         statements->print( os, indent+2 );
    607 }
    608 
    609 
    610 long long UniqueExpr::count = 0;
    611 UniqueExpr::UniqueExpr( Expression *expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
    612         assert( expr );
    613         assert( count != -1 );
    614         if ( id == -1 ) id = count++;
    615         if ( expr->get_result() ) {
    616                 set_result( expr->get_result()->clone() );
    617         }
    618 }
    619 UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
    620 }
    621 UniqueExpr::~UniqueExpr() {
    622         delete expr;
    623         delete object;
    624         delete var;
    625 }
    626 void UniqueExpr::print( std::ostream &os, int indent ) const {
    627         os << "Unique Expression with id:" << id << std::endl << std::string( indent+2, ' ' );
    628         get_expr()->print( os, indent+2 );
    629         if ( get_object() ) {
    630                 os << " with decl: ";
    631                 get_object()->printShort( os, indent+2 );
    632         }
    633565}
    634566
  • src/SynTree/Expression.h

    rb726084 r84118d8  
    3232        virtual ~Expression();
    3333
    34         Type *& get_result() { return result; }
    35         void set_result( Type *newValue ) { result = newValue; }
    36         bool has_result() const { return result != nullptr; }
     34        std::list<Type *>& get_results() { return results; }
     35        void add_result( Type *t );
    3736
    3837        TypeSubstitution *get_env() const { return env; }
     
    4847        virtual void print( std::ostream &os, int indent = 0 ) const;
    4948  protected:
    50         Type * result;
     49        std::list<Type *> results;
    5150        TypeSubstitution *env;
    5251        Expression* argName; // if expression is used as an argument, it can be "designated" by this name
     
    9998class UntypedExpr : public Expression {
    10099  public:
    101         UntypedExpr( Expression *function, const std::list<Expression *> &args = std::list< Expression * >(), Expression *_aname = nullptr );
     100        UntypedExpr( Expression *function, Expression *_aname = nullptr );
    102101        UntypedExpr( const UntypedExpr &other );
     102        UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = nullptr );
    103103        virtual ~UntypedExpr();
    104104
     
    111111        std::list<Expression*>& get_args() { return args; }
    112112
    113         static UntypedExpr * createDeref( Expression * arg );
    114         static UntypedExpr * createAssign( Expression * arg1, Expression * arg2 );
    115 
    116113        virtual UntypedExpr *clone() const { return new UntypedExpr( *this ); }
    117114        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    203200class UntypedMemberExpr : public Expression {
    204201  public:
    205         UntypedMemberExpr( Expression *member, Expression *aggregate, Expression *_aname = nullptr );
     202        UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = nullptr );
    206203        UntypedMemberExpr( const UntypedMemberExpr &other );
    207204        virtual ~UntypedMemberExpr();
    208205
    209         Expression * get_member() const { return member; }
    210         void set_member( Expression * newValue ) { member = newValue; }
     206        std::string get_member() const { return member; }
     207        void set_member( const std::string &newValue ) { member = newValue; }
    211208        Expression *get_aggregate() const { return aggregate; }
    212209        void set_aggregate( Expression *newValue ) { aggregate = newValue; }
     
    217214        virtual void print( std::ostream &os, int indent = 0 ) const;
    218215  private:
    219         Expression *member;
     216        std::string member;
    220217        Expression *aggregate;
    221218};
     
    486483};
    487484
     485/// TupleExpr represents a tuple expression ( [a, b, c] )
     486class TupleExpr : public Expression {
     487  public:
     488        TupleExpr( Expression *_aname = nullptr );
     489        TupleExpr( const TupleExpr &other );
     490        virtual ~TupleExpr();
     491
     492        void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
     493        std::list<Expression*>& get_exprs() { return exprs; }
     494
     495        virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
     496        virtual void accept( Visitor &v ) { v.visit( this ); }
     497        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     498        virtual void print( std::ostream &os, int indent = 0 ) const;
     499  private:
     500        std::list<Expression*> exprs;
     501};
     502
     503/// SolvedTupleExpr represents a TupleExpr whose components have been type-resolved. It is effectively a shell for the code generator to work on
     504class SolvedTupleExpr : public Expression {
     505  public:
     506        SolvedTupleExpr( Expression *_aname = nullptr ) : Expression( _aname ) {}
     507        SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = nullptr );
     508        SolvedTupleExpr( const SolvedTupleExpr &other );
     509        virtual ~SolvedTupleExpr() {}
     510
     511        std::list<Expression*> &get_exprs() { return exprs; }
     512
     513        virtual SolvedTupleExpr *clone() const { return new SolvedTupleExpr( *this ); }
     514        virtual void accept( Visitor &v ) { v.visit( this ); }
     515        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     516        virtual void print( std::ostream &os, int indent = 0 ) const;
     517  private:
     518        std::list<Expression*> exprs;
     519};
     520
    488521/// TypeExpr represents a type used in an expression (e.g. as a type generator parameter)
    489522class TypeExpr : public Expression {
     
    585618        CompoundLiteralExpr( Type * type, Initializer * initializer );
    586619        CompoundLiteralExpr( const CompoundLiteralExpr &other );
    587         virtual ~CompoundLiteralExpr();
     620        ~CompoundLiteralExpr();
    588621
    589622        Type * get_type() const { return type; }
     
    637670  private:
    638671        Expression *low, *high;
    639 };
    640 
    641 /// TupleExpr represents a tuple expression ( [a, b, c] )
    642 class TupleExpr : public Expression {
    643   public:
    644         TupleExpr( const std::list< Expression * > & exprs = std::list< Expression * >(), Expression *_aname = nullptr );
    645         TupleExpr( const TupleExpr &other );
    646         virtual ~TupleExpr();
    647 
    648         void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
    649         std::list<Expression*>& get_exprs() { return exprs; }
    650 
    651         virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
    652         virtual void accept( Visitor &v ) { v.visit( this ); }
    653         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    654         virtual void print( std::ostream &os, int indent = 0 ) const;
    655   private:
    656         std::list<Expression*> exprs;
    657 };
    658 
    659 /// TupleIndexExpr represents an element selection operation on a tuple value, e.g. t.3 after processing by the expression analyzer
    660 class TupleIndexExpr : public Expression {
    661   public:
    662         TupleIndexExpr( Expression * tuple, unsigned int index );
    663         TupleIndexExpr( const TupleIndexExpr &other );
    664         virtual ~TupleIndexExpr();
    665 
    666         Expression * get_tuple() const { return tuple; }
    667         int get_index() const { return index; }
    668         TupleIndexExpr * set_tuple( Expression *newValue ) { tuple = newValue; return this; }
    669         TupleIndexExpr * set_index( unsigned int newValue ) { index = newValue; return this; }
    670 
    671         virtual TupleIndexExpr *clone() const { return new TupleIndexExpr( *this ); }
    672         virtual void accept( Visitor &v ) { v.visit( this ); }
    673         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    674         virtual void print( std::ostream &os, int indent = 0 ) const;
    675   private:
    676         Expression * tuple;
    677         unsigned int index;
    678 };
    679 
    680 /// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer
    681 class MemberTupleExpr : public Expression {
    682   public:
    683         MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );
    684         MemberTupleExpr( const MemberTupleExpr &other );
    685         virtual ~MemberTupleExpr();
    686 
    687         Expression * get_member() const { return member; }
    688         Expression * get_aggregate() const { return aggregate; }
    689         MemberTupleExpr * set_member( Expression *newValue ) { member = newValue; return this; }
    690         MemberTupleExpr * set_aggregate( Expression *newValue ) { aggregate = newValue; return this; }
    691 
    692         virtual MemberTupleExpr *clone() const { return new MemberTupleExpr( *this ); }
    693         virtual void accept( Visitor &v ) { v.visit( this ); }
    694         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    695         virtual void print( std::ostream &os, int indent = 0 ) const;
    696   private:
    697         Expression * member;
    698         Expression * aggregate;
    699 };
    700 
    701 /// TupleAssignExpr represents a multiple assignment operation, where both sides of the assignment have tuple type, e.g. [a, b, c] = [d, e, f];, a mass assignment operation, where the left hand side has tuple type and the right hand side does not, e.g. [a, b, c] = 5.0;, or a tuple ctor/dtor expression
    702 class TupleAssignExpr : public Expression {
    703   public:
    704         TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
    705         TupleAssignExpr( const TupleAssignExpr &other );
    706         virtual ~TupleAssignExpr();
    707 
    708         std::list< Expression * > & get_assigns() { return assigns; }
    709         std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
    710 
    711         virtual TupleAssignExpr *clone() const { return new TupleAssignExpr( *this ); }
    712         virtual void accept( Visitor &v ) { v.visit( this ); }
    713         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    714         virtual void print( std::ostream &os, int indent = 0 ) const;
    715   private:
    716         std::list< Expression * > assigns; // assignment expressions that use tempDecls
    717         std::list< ObjectDecl * > tempDecls; // temporaries for address of lhs exprs
    718 };
    719 
    720 /// StmtExpr represents a GCC 'statement expression', e.g. ({ int x = 5; x; })
    721 class StmtExpr : public Expression {
    722 public:
    723         StmtExpr( CompoundStmt *statements );
    724         StmtExpr( const StmtExpr & other );
    725         virtual ~StmtExpr();
    726 
    727         CompoundStmt * get_statements() const { return statements; }
    728         StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
    729 
    730         virtual StmtExpr *clone() const { return new StmtExpr( *this ); }
    731         virtual void accept( Visitor &v ) { v.visit( this ); }
    732         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    733         virtual void print( std::ostream &os, int indent = 0 ) const;
    734 private:
    735         CompoundStmt * statements;
    736 };
    737 
    738 class UniqueExpr : public Expression {
    739 public:
    740         UniqueExpr( Expression * expr, long long idVal = -1 );
    741         UniqueExpr( const UniqueExpr & other );
    742         ~UniqueExpr();
    743 
    744         Expression * get_expr() const { return expr; }
    745         UniqueExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
    746 
    747         ObjectDecl * get_object() const { return object; }
    748         UniqueExpr * set_object( ObjectDecl * newValue ) { object = newValue; return this; }
    749 
    750         VariableExpr * get_var() const { return var; }
    751         UniqueExpr * set_var( VariableExpr * newValue ) { var = newValue; return this; }
    752 
    753         int get_id() const { return id; }
    754 
    755         virtual UniqueExpr *clone() const { return new UniqueExpr( *this ); }
    756         virtual void accept( Visitor &v ) { v.visit( this ); }
    757         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    758         virtual void print( std::ostream &os, int indent = 0 ) const;
    759 private:
    760         Expression * expr;
    761         ObjectDecl * object;
    762         VariableExpr * var;
    763         int id;
    764         static long long count;
    765672};
    766673
  • src/SynTree/Initializer.h

    rb726084 r84118d8  
    2323
    2424#include <cassert>
    25 
    26 const std::list<Expression*> noDesignators;
    2725
    2826// Initializer: base class for object initializers (provide default values)
  • src/SynTree/Mutator.cc

    rb726084 r84118d8  
    178178
    179179Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
    180         applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) );
     180        mutateAll( applicationExpr->get_results(), *this );
    181181        applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) );
    182182        mutateAll( applicationExpr->get_args(), *this );
     
    185185
    186186Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
    187         untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) );
     187        mutateAll( untypedExpr->get_results(), *this );
    188188        mutateAll( untypedExpr->get_args(), *this );
    189189        return untypedExpr;
     
    191191
    192192Expression *Mutator::mutate( NameExpr *nameExpr ) {
    193         nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) );
     193        mutateAll( nameExpr->get_results(), *this );
    194194        return nameExpr;
    195195}
    196196
    197197Expression *Mutator::mutate( AddressExpr *addressExpr ) {
    198         addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) );
     198        mutateAll( addressExpr->get_results(), *this );
    199199        addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) );
    200200        return addressExpr;
     
    202202
    203203Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
    204         labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) );
     204        mutateAll( labelAddressExpr->get_results(), *this );
    205205        labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) );
    206206        return labelAddressExpr;
     
    208208
    209209Expression *Mutator::mutate( CastExpr *castExpr ) {
    210         castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     210        mutateAll( castExpr->get_results(), *this );
    211211        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
    212212        return castExpr;
     
    214214
    215215Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    216         memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
    217         memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    218         memberExpr->set_member( maybeMutate( memberExpr->get_member(), *this ) );
    219         return memberExpr;
    220 }
    221 
    222 Expression *Mutator::mutate( MemberExpr *memberExpr ) {
    223         memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
     216        mutateAll( memberExpr->get_results(), *this );
    224217        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    225218        return memberExpr;
    226219}
    227220
     221Expression *Mutator::mutate( MemberExpr *memberExpr ) {
     222        mutateAll( memberExpr->get_results(), *this );
     223        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
     224        return memberExpr;
     225}
     226
    228227Expression *Mutator::mutate( VariableExpr *variableExpr ) {
    229         variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) );
     228        mutateAll( variableExpr->get_results(), *this );
    230229        return variableExpr;
    231230}
    232231
    233232Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
    234         constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) );
     233        mutateAll( constantExpr->get_results(), *this );
    235234//  maybeMutate( constantExpr->get_constant(), *this )
    236235        return constantExpr;
     
    238237
    239238Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
    240         sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) );
     239        mutateAll( sizeofExpr->get_results(), *this );
    241240        if ( sizeofExpr->get_isType() ) {
    242241                sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) );
     
    248247
    249248Expression *Mutator::mutate( AlignofExpr *alignofExpr ) {
    250         alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) );
     249        mutateAll( alignofExpr->get_results(), *this );
    251250        if ( alignofExpr->get_isType() ) {
    252251                alignofExpr->set_type( maybeMutate( alignofExpr->get_type(), *this ) );
     
    258257
    259258Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
    260         offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     259        mutateAll( offsetofExpr->get_results(), *this );
    261260        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    262261        return offsetofExpr;
     
    264263
    265264Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) {
    266         offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     265        mutateAll( offsetofExpr->get_results(), *this );
    267266        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    268267        offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) );
     
    271270
    272271Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
    273         offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) );
     272        mutateAll( offsetPackExpr->get_results(), *this );
    274273        offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) );
    275274        return offsetPackExpr;
     
    277276
    278277Expression *Mutator::mutate( AttrExpr *attrExpr ) {
    279         attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) );
     278        mutateAll( attrExpr->get_results(), *this );
    280279        if ( attrExpr->get_isType() ) {
    281280                attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) );
     
    287286
    288287Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
    289         logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) );
     288        mutateAll( logicalExpr->get_results(), *this );
    290289        logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) );
    291290        logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) );
     
    294293
    295294Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
    296         conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) );
     295        mutateAll( conditionalExpr->get_results(), *this );
    297296        conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) );
    298297        conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) );
     
    302301
    303302Expression *Mutator::mutate( CommaExpr *commaExpr ) {
    304         commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) );
     303        mutateAll( commaExpr->get_results(), *this );
    305304        commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
    306305        commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
     
    308307}
    309308
     309Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     310        mutateAll( tupleExpr->get_results(), *this );
     311        mutateAll( tupleExpr->get_exprs(), *this );
     312        return tupleExpr;
     313}
     314
     315Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) {
     316        mutateAll( tupleExpr->get_results(), *this );
     317        mutateAll( tupleExpr->get_exprs(), *this );
     318        return tupleExpr;
     319}
     320
    310321Expression *Mutator::mutate( TypeExpr *typeExpr ) {
    311         typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) );
     322        mutateAll( typeExpr->get_results(), *this );
    312323        typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) );
    313324        return typeExpr;
     
    329340
    330341Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) {
    331         ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ) );
     342        mutateAll( ctorExpr->get_results(), *this );
    332343        ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) );
    333344        return ctorExpr;
     
    335346
    336347Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
    337         compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) );
     348        mutateAll( compLitExpr->get_results(), *this );
    338349        compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) );
    339350        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
     
    342353
    343354Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
    344         valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );
     355        mutateAll( valofExpr->get_results(), *this );
    345356        return valofExpr;
    346357}
     
    350361        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
    351362        return rangeExpr;
    352 }
    353 
    354 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
    355         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    356         mutateAll( tupleExpr->get_exprs(), *this );
    357         return tupleExpr;
    358 }
    359 
    360 Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {
    361         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    362         tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) );
    363         return tupleExpr;
    364 }
    365 
    366 Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {
    367         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    368         tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );
    369         tupleExpr->set_aggregate( maybeMutate( tupleExpr->get_aggregate(), *this ) );
    370         return tupleExpr;
    371 }
    372 
    373 Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {
    374         assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );
    375         mutateAll( assignExpr->get_tempDecls(), *this );
    376         mutateAll( assignExpr->get_assigns(), *this );
    377         return assignExpr;
    378 }
    379 
    380 Expression *Mutator::mutate( StmtExpr *stmtExpr ) {
    381         stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );
    382         stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) );
    383         return stmtExpr;
    384 }
    385 
    386 Expression *Mutator::mutate( UniqueExpr *uniqueExpr ) {
    387         uniqueExpr->set_result( maybeMutate( uniqueExpr->get_result(), *this ) );
    388         uniqueExpr->set_expr( maybeMutate( uniqueExpr->get_expr(), *this ) );
    389         return uniqueExpr;
    390363}
    391364
  • src/SynTree/Mutator.h

    rb726084 r84118d8  
    7171        virtual Expression* mutate( ConditionalExpr *conditionalExpr );
    7272        virtual Expression* mutate( CommaExpr *commaExpr );
     73        virtual Expression* mutate( TupleExpr *tupleExpr );
     74        virtual Expression* mutate( SolvedTupleExpr *tupleExpr );
    7375        virtual Expression* mutate( TypeExpr *typeExpr );
    7476        virtual Expression* mutate( AsmExpr *asmExpr );
     
    7880        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7981        virtual Expression* mutate( RangeExpr *rangeExpr );
    80         virtual Expression* mutate( TupleExpr *tupleExpr );
    81         virtual Expression* mutate( TupleIndexExpr *tupleExpr );
    82         virtual Expression* mutate( MemberTupleExpr *tupleExpr );
    83         virtual Expression* mutate( TupleAssignExpr *assignExpr );
    84         virtual Expression* mutate( StmtExpr * stmtExpr );
    85         virtual Expression* mutate( UniqueExpr * uniqueExpr );
    8682
    8783        virtual Type* mutate( VoidType *basicType );
  • src/SynTree/ReferenceToType.cc

    rb726084 r84118d8  
    5656        }
    5757} // namespace
    58 
    59 StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct ) : Parent( tq, baseStruct->get_name() ), baseStruct( baseStruct ) {}
    6058
    6159std::string StructInstType::typeString() const { return "struct"; }
  • src/SynTree/SynTree.h

    rb726084 r84118d8  
    7676class ConditionalExpr;
    7777class CommaExpr;
     78class TupleExpr;
     79class SolvedTupleExpr;
    7880class TypeExpr;
    7981class AsmExpr;
     
    8385class UntypedValofExpr;
    8486class RangeExpr;
    85 class TupleExpr;
    86 class TupleIndexExpr;
    87 class MemberTupleExpr;
    88 class TupleAssignExpr;
    89 class StmtExpr;
    90 class UniqueExpr;
    9187
    9288class Type;
  • src/SynTree/TupleExpr.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleExpr.cc --
     7// TupleExpr.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1616#include "Expression.h"
    1717#include "Common/utility.h"
    18 #include "Type.h"
    19 #include "Declaration.h"
    20 #include "Tuples/Tuples.h"
    21 #include "VarExprReplacer.h"
    2218
    23 TupleExpr::TupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
    24         if ( ! exprs.empty() ) {
    25                 if ( std::all_of( exprs.begin(), exprs.end(), [](Expression * expr) { return expr->get_result(); } ) ) {
    26                         set_result( Tuples::makeTupleType( exprs ) );
    27                 }
    28         }
     19TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) {
    2920}
    3021
     
    3829
    3930void TupleExpr::print( std::ostream &os, int indent ) const {
    40         os << "Tuple:" << std::endl;
     31        os << std::string( indent, ' ' ) << "Tuple:" << std::endl;
    4132        printAll( exprs, os, indent+2 );
    4233        Expression::print( os, indent );
    4334}
    4435
    45 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
    46         TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
    47         assert( type->size() > index );
    48         set_result( (*std::next( type->get_types().begin(), index ))->clone() );
    49         get_result()->set_isLvalue( type->get_isLvalue() );
     36SolvedTupleExpr::SolvedTupleExpr( std::list<Expression *> &_exprs, Expression *_aname ) : Expression( _aname ) {
     37        std::copy(_exprs.begin(), _exprs.end(), back_inserter(exprs));
    5038}
    5139
    52 TupleIndexExpr::TupleIndexExpr( const TupleIndexExpr &other ) : Expression( other ), tuple( other.tuple->clone() ), index( other.index ) {
     40SolvedTupleExpr::SolvedTupleExpr( const SolvedTupleExpr &other ) : Expression( other ) {
     41        cloneAll( other.exprs, exprs );
    5342}
    5443
    55 TupleIndexExpr::~TupleIndexExpr() {
    56         delete tuple;
    57 }
    58 
    59 void TupleIndexExpr::print( std::ostream &os, int indent ) const {
    60         os << "Tuple Index Expression, with tuple:" << std::endl;
    61         os << std::string( indent+2, ' ' );
    62         tuple->print( os, indent+2 );
    63         os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl;
     44void SolvedTupleExpr::print( std::ostream &os, int indent ) const {
     45        os << std::string( indent, ' ' ) << "Solved Tuple:" << std::endl;
     46        printAll( exprs, os, indent+2 );
    6447        Expression::print( os, indent );
    6548}
    66 
    67 MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) {
    68         set_result( maybeClone( member->get_result() ) ); // xxx - ???
    69 }
    70 
    71 MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) {
    72 }
    73 
    74 MemberTupleExpr::~MemberTupleExpr() {
    75         delete member;
    76         delete aggregate;
    77 }
    78 
    79 void MemberTupleExpr::print( std::ostream &os, int indent ) const {
    80         os << "Member Tuple Expression, with aggregate:" << std::endl;
    81         os << std::string( indent+2, ' ' );
    82         aggregate->print( os, indent+2 );
    83         os << std::string( indent+2, ' ' ) << "with member: " << std::endl;
    84         os << std::string( indent+2, ' ' );
    85         member->print( os, indent+2 );
    86         Expression::print( os, indent );
    87 }
    88 
    89 
    90 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) {
    91         set_result( Tuples::makeTupleType( assigns ) );
    92 }
    93 
    94 TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ) {
    95         cloneAll( other.assigns, assigns );
    96         cloneAll( other.tempDecls, tempDecls );
    97 
    98         // clone needs to go into assigns and replace tempDecls
    99         VarExprReplacer::DeclMap declMap;
    100         std::list< ObjectDecl * >::const_iterator origit = other.tempDecls.begin();
    101         for ( ObjectDecl * temp : tempDecls ) {
    102                 assert( origit != other.tempDecls.end() );
    103                 ObjectDecl * origTemp = *origit++;
    104                 assert( origTemp );
    105                 assert( temp->get_name() == origTemp->get_name() );
    106                 declMap[ origTemp ] = temp;
    107         }
    108         if ( ! declMap.empty() ) {
    109                 VarExprReplacer replacer( declMap );
    110                 for ( Expression * assn : assigns ) {
    111                         assn->accept( replacer );
    112                 }
    113         }
    114 }
    115 
    116 TupleAssignExpr::~TupleAssignExpr() {
    117         deleteAll( assigns );
    118         // deleteAll( tempDecls );
    119 }
    120 
    121 void TupleAssignExpr::print( std::ostream &os, int indent ) const {
    122         os << "Tuple Assignment Expression, with temporaries:" << std::endl;
    123         printAll( tempDecls, os, indent+4 );
    124         os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl;
    125         printAll( assigns, os, indent+4 );
    126         Expression::print( os, indent );
    127 }
    128 
    129 
    13049
    13150// Local Variables: //
  • src/SynTree/TupleType.cc

    rb726084 r84118d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleType.cc --
     7// TupleType.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1717#include "Common/utility.h"
    1818
    19 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types ) : Type( tq ), types( types ) {
     19TupleType::TupleType( const Type::Qualifiers &tq ) : Type( tq ) {
    2020}
    2121
  • src/SynTree/Type.h

    rb726084 r84118d8  
    2020#include "Visitor.h"
    2121#include "Mutator.h"
    22 #include "Common/utility.h"
    2322
    2423class Type {
     
    2827                Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}
    2928
    30                 Qualifiers &operator&=( const Qualifiers &other );
    3129                Qualifiers &operator+=( const Qualifiers &other );
    3230                Qualifiers &operator-=( const Qualifiers &other );
     
    6563        void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; }
    6664        void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; }
    67 
    68         typedef std::list<TypeDecl *> ForallList;
    69         ForallList& get_forall() { return forall; }
    70 
    71         /// How many elemental types are represented by this type
    72         virtual unsigned size() const { return 1; };
    73         virtual bool isVoid() const { return size() == 0; }
     65        std::list<TypeDecl*>& get_forall() { return forall; }
    7466
    7567        virtual Type *clone() const = 0;
     
    7971  private:
    8072        Qualifiers tq;
    81         ForallList forall;
     73        std::list<TypeDecl*> forall;
    8274};
    8375
     
    8577  public:
    8678        VoidType( const Type::Qualifiers &tq );
    87 
    88         virtual unsigned size() const { return 0; };
    8979
    9080        virtual VoidType *clone() const { return new VoidType( *this ); }
     
    244234  public:
    245235        StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {}
    246         StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );
    247236        StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
    248237
     
    359348class TupleType : public Type {
    360349  public:
    361         TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() );
     350        TupleType( const Type::Qualifiers &tq );
    362351        TupleType( const TupleType& );
    363352        virtual ~TupleType();
    364353
    365         typedef std::list<Type*> value_type;
    366         typedef value_type::iterator iterator;
    367 
    368354        std::list<Type*>& get_types() { return types; }
    369         virtual unsigned size() const { return types.size(); };
    370 
    371         iterator begin() { return types.begin(); }
    372         iterator end() { return types.end(); }
    373355
    374356        virtual TupleType *clone() const { return new TupleType( *this ); }
     
    460442};
    461443
    462 inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
    463         isConst &= other.isConst;
    464         isVolatile &= other.isVolatile;
    465         isRestrict &= other.isRestrict;
    466         isLvalue &= other.isLvalue;
    467         isAtomic &= other.isAtomic;
    468         return *this;
    469 }
    470 
    471444inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) {
    472445        isConst |= other.isConst;
  • src/SynTree/TypeSubstitution.cc

    rb726084 r84118d8  
    7272Type *TypeSubstitution::lookup( std::string formalType ) const {
    7373        TypeEnvType::const_iterator i = typeEnv.find( formalType );
    74 
     74       
    7575        // break on not in substitution set
    7676        if ( i == typeEnv.end() ) return 0;
    77 
     77       
    7878        // attempt to transitively follow TypeInstType links.
    7979        while ( TypeInstType *actualType = dynamic_cast< TypeInstType* >( i->second ) ) {
    8080                const std::string& typeName = actualType->get_name();
    81 
     81               
    8282                // break cycles in the transitive follow
    8383                if ( formalType == typeName ) break;
    84 
     84               
    8585                // Look for the type this maps to, returning previous mapping if none-such
    8686                i = typeEnv.find( typeName );
    8787                if ( i == typeEnv.end() ) return actualType;
    8888        }
    89 
     89       
    9090        // return type from substitution set
    9191        return i->second;
    92 
     92       
    9393#if 0
    9494        if ( i == typeEnv.end() ) {
     
    149149        // bind type variables from forall-qualifiers
    150150        if ( freeOnly ) {
    151                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     151                for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    152152                        boundVars.insert( (*tyvar )->get_name() );
    153153                } // for
     
    163163        // bind type variables from forall-qualifiers
    164164        if ( freeOnly ) {
    165                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     165                for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    166166                        boundVars.insert( (*tyvar )->get_name() );
    167167                } // for
  • src/SynTree/Visitor.cc

    rb726084 r84118d8  
    150150
    151151void Visitor::visit( ApplicationExpr *applicationExpr ) {
    152         maybeAccept( applicationExpr->get_result(), *this );
     152        acceptAll( applicationExpr->get_results(), *this );
    153153        maybeAccept( applicationExpr->get_function(), *this );
    154154        acceptAll( applicationExpr->get_args(), *this );
     
    156156
    157157void Visitor::visit( UntypedExpr *untypedExpr ) {
    158         maybeAccept( untypedExpr->get_result(), *this );
     158        acceptAll( untypedExpr->get_results(), *this );
    159159        acceptAll( untypedExpr->get_args(), *this );
    160160}
    161161
    162162void Visitor::visit( NameExpr *nameExpr ) {
    163         maybeAccept( nameExpr->get_result(), *this );
     163        acceptAll( nameExpr->get_results(), *this );
    164164}
    165165
    166166void Visitor::visit( AddressExpr *addressExpr ) {
    167         maybeAccept( addressExpr->get_result(), *this );
     167        acceptAll( addressExpr->get_results(), *this );
    168168        maybeAccept( addressExpr->get_arg(), *this );
    169169}
    170170
    171171void Visitor::visit( LabelAddressExpr *labAddressExpr ) {
    172         maybeAccept( labAddressExpr->get_result(), *this );
     172        acceptAll( labAddressExpr->get_results(), *this );
    173173        maybeAccept( labAddressExpr->get_arg(), *this );
    174174}
    175175
    176176void Visitor::visit( CastExpr *castExpr ) {
    177         maybeAccept( castExpr->get_result(), *this );
     177        acceptAll( castExpr->get_results(), *this );
    178178        maybeAccept( castExpr->get_arg(), *this );
    179179}
    180180
    181181void Visitor::visit( UntypedMemberExpr *memberExpr ) {
    182         maybeAccept( memberExpr->get_result(), *this );
     182        acceptAll( memberExpr->get_results(), *this );
    183183        maybeAccept( memberExpr->get_aggregate(), *this );
    184         maybeAccept( memberExpr->get_member(), *this );
    185184}
    186185
    187186void Visitor::visit( MemberExpr *memberExpr ) {
    188         maybeAccept( memberExpr->get_result(), *this );
     187        acceptAll( memberExpr->get_results(), *this );
    189188        maybeAccept( memberExpr->get_aggregate(), *this );
    190189}
    191190
    192191void Visitor::visit( VariableExpr *variableExpr ) {
    193         maybeAccept( variableExpr->get_result(), *this );
     192        acceptAll( variableExpr->get_results(), *this );
    194193}
    195194
    196195void Visitor::visit( ConstantExpr *constantExpr ) {
    197         maybeAccept( constantExpr->get_result(), *this );
     196        acceptAll( constantExpr->get_results(), *this );
    198197        maybeAccept( constantExpr->get_constant(), *this );
    199198}
    200199
    201200void Visitor::visit( SizeofExpr *sizeofExpr ) {
    202         maybeAccept( sizeofExpr->get_result(), *this );
     201        acceptAll( sizeofExpr->get_results(), *this );
    203202        if ( sizeofExpr->get_isType() ) {
    204203                maybeAccept( sizeofExpr->get_type(), *this );
     
    209208
    210209void Visitor::visit( AlignofExpr *alignofExpr ) {
    211         maybeAccept( alignofExpr->get_result(), *this );
     210        acceptAll( alignofExpr->get_results(), *this );
    212211        if ( alignofExpr->get_isType() ) {
    213212                maybeAccept( alignofExpr->get_type(), *this );
     
    218217
    219218void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) {
    220         maybeAccept( offsetofExpr->get_result(), *this );
     219        acceptAll( offsetofExpr->get_results(), *this );
    221220        maybeAccept( offsetofExpr->get_type(), *this );
    222221}
    223222
    224223void Visitor::visit( OffsetofExpr *offsetofExpr ) {
    225         maybeAccept( offsetofExpr->get_result(), *this );
     224        acceptAll( offsetofExpr->get_results(), *this );
    226225        maybeAccept( offsetofExpr->get_type(), *this );
    227226        maybeAccept( offsetofExpr->get_member(), *this );
     
    229228
    230229void Visitor::visit( OffsetPackExpr *offsetPackExpr ) {
    231         maybeAccept( offsetPackExpr->get_result(), *this );
     230        acceptAll( offsetPackExpr->get_results(), *this );
    232231        maybeAccept( offsetPackExpr->get_type(), *this );
    233232}
    234233
    235234void Visitor::visit( AttrExpr *attrExpr ) {
    236         maybeAccept( attrExpr->get_result(), *this );
     235        acceptAll( attrExpr->get_results(), *this );
    237236        if ( attrExpr->get_isType() ) {
    238237                maybeAccept( attrExpr->get_type(), *this );
     
    243242
    244243void Visitor::visit( LogicalExpr *logicalExpr ) {
    245         maybeAccept( logicalExpr->get_result(), *this );
     244        acceptAll( logicalExpr->get_results(), *this );
    246245        maybeAccept( logicalExpr->get_arg1(), *this );
    247246        maybeAccept( logicalExpr->get_arg2(), *this );
     
    249248
    250249void Visitor::visit( ConditionalExpr *conditionalExpr ) {
    251         maybeAccept( conditionalExpr->get_result(), *this );
     250        acceptAll( conditionalExpr->get_results(), *this );
    252251        maybeAccept( conditionalExpr->get_arg1(), *this );
    253252        maybeAccept( conditionalExpr->get_arg2(), *this );
     
    256255
    257256void Visitor::visit( CommaExpr *commaExpr ) {
    258         maybeAccept( commaExpr->get_result(), *this );
     257        acceptAll( commaExpr->get_results(), *this );
    259258        maybeAccept( commaExpr->get_arg1(), *this );
    260259        maybeAccept( commaExpr->get_arg2(), *this );
    261260}
    262261
     262void Visitor::visit( TupleExpr *tupleExpr ) {
     263        acceptAll( tupleExpr->get_results(), *this );
     264        acceptAll( tupleExpr->get_exprs(), *this );
     265}
     266
     267void Visitor::visit( SolvedTupleExpr *tupleExpr ) {
     268        acceptAll( tupleExpr->get_results(), *this );
     269        acceptAll( tupleExpr->get_exprs(), *this );
     270}
     271
    263272void Visitor::visit( TypeExpr *typeExpr ) {
    264         maybeAccept( typeExpr->get_result(), *this );
     273        acceptAll( typeExpr->get_results(), *this );
    265274        maybeAccept( typeExpr->get_type(), *this );
    266275}
     
    279288
    280289void Visitor::visit( ConstructorExpr * ctorExpr ) {
    281         maybeAccept( ctorExpr->get_result(), *this );
     290        acceptAll( ctorExpr->get_results(), *this );
    282291        maybeAccept( ctorExpr->get_callExpr(), *this );
    283292}
    284293
    285294void Visitor::visit( CompoundLiteralExpr *compLitExpr ) {
    286         maybeAccept( compLitExpr->get_result(), *this );
     295        acceptAll( compLitExpr->get_results(), *this );
    287296        maybeAccept( compLitExpr->get_type(), *this );
    288297        maybeAccept( compLitExpr->get_initializer(), *this );
     
    290299
    291300void Visitor::visit( UntypedValofExpr *valofExpr ) {
    292         maybeAccept( valofExpr->get_result(), *this );
     301        acceptAll( valofExpr->get_results(), *this );
    293302        maybeAccept( valofExpr->get_body(), *this );
    294303}
     
    297306        maybeAccept( rangeExpr->get_low(), *this );
    298307        maybeAccept( rangeExpr->get_high(), *this );
    299 }
    300 
    301 void Visitor::visit( TupleExpr *tupleExpr ) {
    302         maybeAccept( tupleExpr->get_result(), *this );
    303         acceptAll( tupleExpr->get_exprs(), *this );
    304 }
    305 
    306 void Visitor::visit( TupleIndexExpr *tupleExpr ) {
    307         maybeAccept( tupleExpr->get_result(), *this );
    308         maybeAccept( tupleExpr->get_tuple(), *this );
    309 }
    310 
    311 void Visitor::visit( MemberTupleExpr *tupleExpr ) {
    312         maybeAccept( tupleExpr->get_result(), *this );
    313         maybeAccept( tupleExpr->get_member(), *this );
    314         maybeAccept( tupleExpr->get_aggregate(), *this );
    315 }
    316 
    317 void Visitor::visit( TupleAssignExpr *assignExpr ) {
    318         maybeAccept( assignExpr->get_result(), *this );
    319         acceptAll( assignExpr->get_tempDecls(), *this );
    320         acceptAll( assignExpr->get_assigns(), *this );
    321 }
    322 
    323 void Visitor::visit( StmtExpr *stmtExpr ) {
    324         maybeAccept( stmtExpr->get_result(), *this );
    325         maybeAccept( stmtExpr->get_statements(), *this );
    326 }
    327 
    328 void Visitor::visit( UniqueExpr *uniqueExpr ) {
    329         maybeAccept( uniqueExpr->get_result(), *this );
    330         maybeAccept( uniqueExpr->get_expr(), *this );
    331308}
    332309
  • src/SynTree/Visitor.h

    rb726084 r84118d8  
    7171        virtual void visit( ConditionalExpr *conditionalExpr );
    7272        virtual void visit( CommaExpr *commaExpr );
     73        virtual void visit( TupleExpr *tupleExpr );
     74        virtual void visit( SolvedTupleExpr *tupleExpr );
    7375        virtual void visit( TypeExpr *typeExpr );
    7476        virtual void visit( AsmExpr *asmExpr );
     
    7880        virtual void visit( UntypedValofExpr *valofExpr );
    7981        virtual void visit( RangeExpr *rangeExpr );
    80         virtual void visit( TupleExpr *tupleExpr );
    81         virtual void visit( TupleIndexExpr *tupleExpr );
    82         virtual void visit( MemberTupleExpr *tupleExpr );
    83         virtual void visit( TupleAssignExpr *assignExpr );
    84         virtual void visit( StmtExpr * stmtExpr );
    85         virtual void visit( UniqueExpr * uniqueExpr );
    8682
    8783        virtual void visit( VoidType *basicType );
  • src/SynTree/module.mk

    rb726084 r84118d8  
    4949       SynTree/AddStmtVisitor.cc \
    5050       SynTree/TypeSubstitution.cc \
    51        SynTree/Attribute.cc \
    52        SynTree/VarExprReplacer.cc
     51       SynTree/Attribute.cc
    5352
  • src/Tuples/TupleAssignment.cc

    rb726084 r84118d8  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Nov 9 13:48:42 2016
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon May 18 15:02:53 2015
    1313// Update Count     : 2
    1414//
     
    1818#include "ResolvExpr/typeops.h"
    1919#include "SynTree/Expression.h"
    20 #include "SynTree/Initializer.h"
    21 #include "Tuples.h"
    22 #include "Explode.h"
     20#include "TupleAssignment.h"
    2321#include "Common/SemanticError.h"
    24 #include "InitTweak/InitTweak.h"
    2522
    2623#include <functional>
     
    3027#include <cassert>
    3128#include <set>
    32 #include <unordered_set>
    3329
    3430namespace Tuples {
    35         class TupleAssignSpotter {
    36           public:
    37                 // dispatcher for Tuple (multiple and mass) assignment operations
    38                 TupleAssignSpotter( ResolvExpr::AlternativeFinder & );
    39                 void spot( UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities );
    40 
    41           private:
    42                 void match();
    43 
    44                 struct Matcher {
    45                   public:
    46                         Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts );
    47                         virtual ~Matcher() {}
    48                         virtual void match( std::list< Expression * > &out ) = 0;
    49                         ResolvExpr::AltList lhs, rhs;
    50                         TupleAssignSpotter &spotter;
    51                         std::list< ObjectDecl * > tmpDecls;
    52                 };
    53 
    54                 struct MassAssignMatcher : public Matcher {
    55                   public:
    56                         MassAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts );
    57                         virtual void match( std::list< Expression * > &out );
    58                 };
    59 
    60                 struct MultipleAssignMatcher : public Matcher {
    61                   public:
    62                         MultipleAssignMatcher( TupleAssignSpotter &spot, const ResolvExpr::AltList & alts );
    63                         virtual void match( std::list< Expression * > &out );
    64                 };
    65 
    66                 ResolvExpr::AlternativeFinder &currentFinder;
    67                 std::string fname;
    68                 std::unique_ptr< Matcher > matcher;
    69         };
    70 
    71         /// true if expr is an expression of tuple type, i.e. a tuple expression, tuple variable, or MRV (multiple-return-value) function
    72         bool isTuple( Expression *expr ) {
     31        TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder *f )
     32                : currentFinder(f), matcher(0), hasMatched( false ) {}
     33
     34        bool TupleAssignSpotter::pointsToTuple( Expression *expr ) {
     35                // also check for function returning tuple of reference types
     36                if (AddressExpr *addr = dynamic_cast<AddressExpr *>(expr) )
     37                        if ( isTuple(addr->get_arg() ) )
     38                                return true;
     39                return false;
     40        }
     41
     42        bool TupleAssignSpotter::isTupleVar( DeclarationWithType *decl ) {
     43                if ( dynamic_cast<TupleType *>(decl->get_type()) )
     44                        return true;
     45                return false;
     46        }
     47
     48        bool TupleAssignSpotter::isTuple( Expression *expr, bool isRight ) {
     49                // true if `expr' is an expression returning a tuple: tuple, tuple variable or MRV function
    7350                if ( ! expr ) return false;
    74                 assert( expr->has_result() );
    75                 return dynamic_cast<TupleExpr *>(expr) || expr->get_result()->size() > 1;
    76         }
    77 
    78         template< typename AltIter >
    79         bool isMultAssign( AltIter begin, AltIter end ) {
    80                 // multiple assignment if more than one alternative in the range or if
    81                 // the alternative is a tuple
    82                 if ( begin == end ) return false;
    83                 if ( isTuple( begin->expr ) ) return true;
    84                 return ++begin != end;
    85         }
    86 
    87         bool pointsToTuple( Expression *expr ) {
    88                 // also check for function returning tuple of reference types
    89                 if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    90                         return pointsToTuple( castExpr->get_arg() );
    91                 } else if ( AddressExpr *addr = dynamic_cast< AddressExpr * >( expr) ) {
    92                         return isTuple( addr->get_arg() );
    93                 }
    94                 return false;
    95         }
    96 
    97         void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities ) {
    98                 TupleAssignSpotter spotter( currentFinder );
    99                 spotter.spot( expr, possibilities );
    100         }
    101 
    102         TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder &f )
    103                 : currentFinder(f) {}
    104 
    105         void TupleAssignSpotter::spot( UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities ) {
    106                 if (  NameExpr *op = dynamic_cast< NameExpr * >(expr->get_function()) ) {
    107                         if ( InitTweak::isCtorDtorAssign( op->get_name() ) ) {
    108                                 fname = op->get_name();
    109                                 for ( std::list<ResolvExpr::AltList>::const_iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
    110                                         if ( ali->size() == 0 ) continue; // AlternativeFinder will natrually handle this case, if it's legal
    111                                         if ( ali->size() <= 1 && InitTweak::isAssignment( op->get_name() ) ) {
    112                                                 // what does it mean if an assignment takes 1 argument? maybe someone defined such a function, in which case AlternativeFinder will naturally handle it
    113                                                 continue;
    114                                         }
    115 
    116                                         assert( ! ali->empty() );
    117                                         // grab args 2-N and group into a TupleExpr
    118                                         const ResolvExpr::Alternative & alt1 = ali->front();
    119                                         auto begin = std::next(ali->begin(), 1), end = ali->end();
    120                                         if ( pointsToTuple(alt1.expr) ) {
    121                                                 if ( isMultAssign( begin, end ) ) {
    122                                                         matcher.reset( new MultipleAssignMatcher( *this, *ali ) );
    123                                                 } else {
     51
     52                if ( dynamic_cast<TupleExpr *>(expr) )
     53                        return true;
     54                else if ( VariableExpr *var = dynamic_cast<VariableExpr *>(expr) ) {
     55                        if ( isTupleVar(var->get_var()) )
     56                                return true;
     57                }
     58
     59                return false;
     60        }
     61
     62        bool TupleAssignSpotter::match() {
     63                assert ( matcher != 0 );
     64
     65                std::list< Expression * > new_assigns;
     66                if ( ! matcher->match(new_assigns) )
     67                        return false;
     68
     69                if ( new_assigns.empty() ) return false;
     70                /*return */matcher->solve( new_assigns );
     71                if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
     72                        // now resolve new assignments
     73                        std::list< Expression * > solved_assigns;
     74                        ResolvExpr::AltList solved_alts;
     75                        assert( currentFinder != 0 );
     76
     77                        ResolvExpr::AltList current;
     78                        for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     79                                //try {
     80                                ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     81                                finder.findWithAdjustment(*i);
     82                                // prune expressions that don't coincide with
     83                                ResolvExpr::AltList alts = finder.get_alternatives();
     84                                assert( alts.size() == 1 );
     85                                assert(alts.front().expr != 0 );
     86                                current.push_back( finder.get_alternatives().front() );
     87                                solved_assigns.push_back( alts.front().expr->clone() );
     88                                //solved_assigns.back()->print(std::cerr);
     89                                /*} catch( ... ) {
     90                                  continue; // no reasonable alternative found
     91                                  }*/
     92                        }
     93                        options.add_option( current );
     94
     95                        return true;
     96                } else { // mass assignment
     97                        //if ( new_assigns.empty() ) return false;
     98                        std::list< Expression * > solved_assigns;
     99                        ResolvExpr::AltList solved_alts;
     100                        assert( currentFinder != 0 );
     101
     102                        ResolvExpr::AltList current;
     103                        if ( optMass.empty() ) {
     104                                for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
     105                                        optMass.push_back( ResolvExpr::AltList() );
     106                        }
     107                        int cnt = 0;
     108                        for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
     109
     110                                ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     111                                finder.findWithAdjustment(*i);
     112                                ResolvExpr::AltList alts = finder.get_alternatives();
     113                                assert( alts.size() == 1 );
     114                                assert(alts.front().expr != 0 );
     115                                current.push_back( finder.get_alternatives().front() );
     116                                optMass[cnt].push_back( finder.get_alternatives().front() );
     117                                solved_assigns.push_back( alts.front().expr->clone() );
     118                        }
     119
     120                        return true;
     121                }
     122
     123                return false;
     124        }
     125
     126        bool TupleAssignSpotter::isMVR( Expression *expr ) {
     127                if ( expr->get_results().size() > 1 ) {
     128                        // MVR processing
     129                        return true;
     130                }
     131                return false;
     132        }
     133
     134        bool TupleAssignSpotter::isTupleAssignment( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) {
     135                if (  NameExpr *assgnop = dynamic_cast< NameExpr * >(expr->get_function()) ) {
     136
     137                        if ( assgnop->get_name() == std::string("?=?") ) {
     138
     139                                for ( std::list<ResolvExpr::AltList>::iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
     140                                        assert( ali->size() == 2 );
     141                                        ResolvExpr::AltList::iterator opit = ali->begin();
     142                                        ResolvExpr::Alternative op1 = *opit, op2 = *(++opit);
     143
     144                                        if ( pointsToTuple(op1.expr) ) { // also handles tuple vars
     145                                                if ( isTuple( op2.expr, true ) )
     146                                                        matcher = new MultipleAssignMatcher(op1.expr, op2.expr);
     147                                                else if ( isMVR( op2.expr ) ) {
     148                                                        // handle MVR differently
     149                                                } else
    124150                                                        // mass assignment
    125                                                         matcher.reset( new MassAssignMatcher( *this,  *ali ) );
     151                                                        matcher = new MassAssignMatcher(op1.expr, op2.expr);
     152
     153                                                std::list< ResolvExpr::AltList > options;
     154                                                if ( match() )
     155                                                        /*
     156                                                          if ( hasMatched ) {
     157                                                          // throw SemanticError("Ambiguous tuple assignment");
     158                                                          } else {*/
     159                                                        // Matched for the first time
     160                                                        hasMatched = true;
     161                                                /*} */
     162                                        } /* else if ( isTuple( op2 ) )
     163                                                 throw SemanticError("Inapplicable tuple assignment.");
     164                                          */
     165                                }
     166
     167                                if ( hasMatched ) {
     168                                        if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
     169                                                //options.print( std::cerr );
     170                                                std::list< ResolvExpr::AltList >best = options.get_best();
     171                                                if ( best.size() == 1 ) {
     172                                                        std::list<Expression *> solved_assigns;
     173                                                        for ( ResolvExpr::AltList::iterator i = best.front().begin(); i != best.front().end(); ++i ) {
     174                                                                solved_assigns.push_back( i->expr );
     175                                                        }
     176                                                        /* assigning cost zero? */
     177                                                        currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MULTIPLE*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
    126178                                                }
    127                                                 match();
     179                                        } else {
     180                                                assert( ! optMass.empty() );
     181                                                ResolvExpr::AltList winners;
     182                                                for ( std::vector< ResolvExpr::AltList >::iterator i = optMass.begin(); i != optMass.end(); ++i )
     183                                                        findMinCostAlt( i->begin(), i->end(), back_inserter(winners) );
     184
     185                                                std::list< Expression *> solved_assigns;
     186                                                for ( ResolvExpr::AltList::iterator i = winners.begin(); i != winners.end(); ++i )
     187                                                        solved_assigns.push_back( i->expr );
     188                                                currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MASS*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
    128189                                        }
    129190                                }
    130191                        }
    131192                }
    132         }
    133 
    134         void TupleAssignSpotter::match() {
    135                 assert ( matcher != 0 );
    136 
    137                 std::list< Expression * > new_assigns;
    138                 matcher->match( new_assigns );
    139 
    140                 if ( new_assigns.empty() ) return;
    141                 ResolvExpr::AltList current;
    142                 // now resolve new assignments
    143                 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
    144                         ResolvExpr::AlternativeFinder finder( currentFinder.get_indexer(), currentFinder.get_environ() );
    145                         try {
    146                                 finder.findWithAdjustment(*i);
    147                         } catch (...) {
    148                                 return; // xxx - no match should not mean failure, it just means this particular tuple assignment isn't valid
     193                return hasMatched;
     194        }
     195
     196        void TupleAssignSpotter::Matcher::init( Expression *_lhs, Expression *_rhs ) {
     197                lhs.clear();
     198                if (AddressExpr *addr = dynamic_cast<AddressExpr *>(_lhs) )
     199                        if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(addr->get_arg()) )
     200                                std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(lhs) );
     201
     202                rhs.clear();
     203        }
     204
     205        TupleAssignSpotter::Matcher::Matcher( /*TupleAssignSpotter &spot,*/ Expression *_lhs, Expression *_rhs ) /*: own_spotter(spot) */{
     206                init(_lhs,_rhs);
     207        }
     208
     209        TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( Expression *_lhs, Expression *_rhs )/* : own_spotter(spot) */{
     210                init(_lhs,_rhs);
     211
     212                if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(_rhs) )
     213                        std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(rhs) );
     214        }
     215
     216        UntypedExpr *TupleAssignSpotter::Matcher::createAssgn( Expression *left, Expression *right ) {
     217                if ( left && right ) {
     218                        std::list< Expression * > args;
     219                        args.push_back(new AddressExpr(left->clone()));  args.push_back(right->clone());
     220                        return new UntypedExpr(new NameExpr("?=?"), args);
     221                } else
     222                        throw 0; // xxx - diagnose the problem
     223        }
     224
     225        bool TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
     226                if ( lhs.empty() || (rhs.size() != 1) ) return false;
     227
     228                for ( std::list< Expression * >::iterator l = lhs.begin(); l != lhs.end(); l++ ) {
     229                        std::list< Expression * > args;
     230                        args.push_back( new AddressExpr(*l) );
     231                        args.push_back( rhs.front() );
     232                        out.push_back( new UntypedExpr(new NameExpr("?=?"), args) );
     233                }
     234
     235                return true;
     236        }
     237
     238        bool TupleAssignSpotter::MassAssignMatcher::solve( std::list< Expression * > &assigns ) {
     239                /*
     240                  std::list< Expression * > solved_assigns;
     241                  ResolvExpr::AltList solved_alts;
     242                  assert( currentFinder != 0 );
     243
     244                  ResolvExpr::AltList current;
     245                  if ( optMass.empty() ) {
     246                  for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
     247                  optMass.push_back( ResolvExpr::AltList() );
     248                  }
     249                  int cnt = 0;
     250                  for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
     251
     252                  ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     253                  finder.findWithAdjustment(*i);
     254                  ResolvExpr::AltList alts = finder.get_alternatives();
     255                  assert( alts.size() == 1 );
     256                  assert(alts.front().expr != 0 );
     257                  current.push_back( finder.get_alternatives().front() );
     258                  optMass[cnt].push_back( finder.get_alternatives().front() );
     259                  solved_assigns.push_back( alts.front().expr->clone() );
     260                  }
     261                */
     262                return true;
     263        }
     264
     265        bool TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
     266                // need more complicated matching
     267                if ( lhs.size() == rhs.size() ) {
     268                        zipWith( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), back_inserter(out), TupleAssignSpotter::Matcher::createAssgn );
     269                        return true;
     270                } //else
     271                //std::cerr << "The length of (left, right) is: (" << lhs.size() << "," << rhs.size() << ")" << std::endl;*/
     272                return false;
     273        }
     274
     275        bool TupleAssignSpotter::MultipleAssignMatcher::solve( std::list< Expression * > &assigns ) {
     276                /*
     277                  std::list< Expression * > solved_assigns;
     278                  ResolvExpr::AltList solved_alts;
     279                  assert( currentFinder != 0 );
     280
     281                  ResolvExpr::AltList current;
     282                  for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     283                  //try {
     284                  ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     285                  finder.findWithAdjustment(*i);
     286                  // prune expressions that don't coincide with
     287                  ResolvExpr::AltList alts = finder.get_alternatives();
     288                  assert( alts.size() == 1 );
     289                  assert(alts.front().expr != 0 );
     290                  current.push_back( finder.get_alternatives().front() );
     291                  solved_assigns.push_back( alts.front().expr->clone() );
     292                  //solved_assigns.back()->print(std::cerr);
     293                  //} catch( ... ) {
     294                  //continue; // no reasonable alternative found
     295                  //}
     296                  }
     297                  options.add_option( current );
     298                */
     299
     300                return true;
     301        }
     302
     303        void TupleAssignSpotter::Options::add_option( ResolvExpr::AltList &opt ) {
     304                using namespace std;
     305
     306                options.push_back( opt );
     307                /*
     308                  vector< Cost > costs;
     309                  costs.reserve( opt.size() );
     310                  transform( opt.begin(), opt.end(), back_inserter(costs), ptr_fun(extract_cost) );
     311                */
     312                // transpose matrix
     313                if ( costMatrix.empty() )
     314                        for ( unsigned int i = 0; i< opt.size(); ++i)
     315                                costMatrix.push_back( vector<ResolvExpr::Cost>() );
     316
     317                int cnt = 0;
     318                for ( ResolvExpr::AltList::iterator i = opt.begin(); i != opt.end(); ++i, cnt++ )
     319                        costMatrix[cnt].push_back( i->cost );
     320
     321                return;
     322        }
     323
     324        std::list< ResolvExpr::AltList > TupleAssignSpotter::Options::get_best() {
     325                using namespace std;
     326                using namespace ResolvExpr;
     327                list< ResolvExpr::AltList > ret;
     328                list< multiset<int> > solns;
     329                for ( vector< vector<Cost> >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
     330                        list<int> current;
     331                        findMinCost( i->begin(), i->end(), back_inserter(current) );
     332                        solns.push_back( multiset<int>(current.begin(), current.end()) );
     333                }
     334                // need to combine
     335                multiset<int> result;
     336                lift_intersection( solns.begin(), solns.end(), inserter( result, result.begin() ) );
     337                if ( result.size() != 1 )
     338                        throw SemanticError("Ambiguous tuple expression");
     339                ret.push_back(get_option( *(result.begin() )));
     340                return ret;
     341        }
     342
     343        void TupleAssignSpotter::Options::print( std::ostream &ostr ) {
     344                using namespace std;
     345
     346                for ( vector< vector < ResolvExpr::Cost > >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
     347                        for ( vector < ResolvExpr::Cost >::iterator j = i->begin(); j != i->end(); ++j )
     348                                ostr << *j << " " ;
     349                        ostr << std::endl;
     350                } // for
     351                return;
     352        }
     353
     354        ResolvExpr::Cost extract_cost( ResolvExpr::Alternative &alt ) {
     355                return alt.cost;
     356        }
     357
     358        template< typename InputIterator, typename OutputIterator >
     359        void TupleAssignSpotter::Options::findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
     360                using namespace ResolvExpr;
     361                std::list<int> alternatives;
     362
     363                // select the alternatives that have the minimum parameter cost
     364                Cost minCost = Cost::infinity;
     365                unsigned int index = 0;
     366                for ( InputIterator i = begin; i != end; ++i, index++ ) {
     367                        if ( *i < minCost ) {
     368                                minCost = *i;
     369                                alternatives.clear();
     370                                alternatives.push_back( index );
     371                        } else if ( *i == minCost ) {
     372                                alternatives.push_back( index );
    149373                        }
    150                         // prune expressions that don't coincide with
    151                         ResolvExpr::AltList alts = finder.get_alternatives();
    152                         assert( alts.size() == 1 );
    153                         assert( alts.front().expr != 0 );
    154                         current.push_back( alts.front() );
    155                 }
    156 
    157                 // extract expressions from the assignment alternatives to produce a list of assignments that
    158                 // together form a single alternative
    159                 std::list< Expression *> solved_assigns;
    160                 for ( ResolvExpr::Alternative & alt : current ) {
    161                         solved_assigns.push_back( alt.expr->clone() );
    162                 }
    163                 // xxx - need to do this??
    164                 ResolvExpr::TypeEnvironment compositeEnv;
    165                 simpleCombineEnvironments( current.begin(), current.end(), compositeEnv );
    166                 currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), compositeEnv, ResolvExpr::sumCost( current ) ) );
    167         }
    168 
    169         TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList &alts ) : spotter(spotter) {
    170                 assert( ! alts.empty() );
    171                 ResolvExpr::Alternative lhsAlt = alts.front();
    172                 // peel off the cast that exists on ctor/dtor expressions
    173                 bool isCast = false;
    174                 if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( lhsAlt.expr ) ) {
    175                         lhsAlt.expr = castExpr->get_arg();
    176                         castExpr->set_arg( nullptr );
    177                         delete castExpr;
    178                         isCast = true;
    179                 }
    180 
    181                 // explode the lhs so that each field of the tuple-valued-expr is assigned.
    182                 explode( lhsAlt, spotter.currentFinder.get_indexer(), back_inserter(lhs) );
    183 
    184                 // and finally, re-add the cast to each lhs expr, so that qualified tuple fields can be constructed
    185                 if ( isCast ) {
    186                         for ( ResolvExpr::Alternative & alt : lhs ) {
    187                                 Expression *& expr = alt.expr;
    188                                 Type * castType = expr->get_result()->clone();
    189                                 Type * type = InitTweak::getPointerBase( castType );
    190                                 assert( type );
    191                                 type->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true);
    192                                 type->set_isLvalue( true ); // xxx - might not need this
    193                                 expr = new CastExpr( expr, castType );
    194                         }
    195                 }
    196         }
    197 
    198         TupleAssignSpotter::MassAssignMatcher::MassAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts ) : Matcher( spotter, alts ) {
    199                 assert( alts.size() == 1 || alts.size() == 2 );
    200                 if ( alts.size() == 2 ) {
    201                         rhs.push_back( alts.back() );
    202                 }
    203         }
    204 
    205         TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts ) : Matcher( spotter, alts ) {
    206                 // explode the rhs so that each field of the tuple-valued-expr is assigned.
    207                 explode( std::next(alts.begin(), 1), alts.end(), spotter.currentFinder.get_indexer(), back_inserter(rhs) );
    208         }
    209 
    210         UntypedExpr * createFunc( const std::string &fname, ObjectDecl *left, ObjectDecl *right ) {
    211                 assert( left );
    212                 std::list< Expression * > args;
    213                 args.push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( left ) ) ) );
    214                 // args.push_back( new AddressExpr( new VariableExpr( left ) ) );
    215                 if ( right ) args.push_back( new VariableExpr( right ) );
    216                 return new UntypedExpr( new NameExpr( fname ), args );
    217         }
    218 
    219         ObjectDecl * newObject( UniqueName & namer, Expression * expr ) {
    220                 assert( expr->has_result() && ! expr->get_result()->isVoid() );
    221                 return new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    222         }
    223 
    224         void TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
    225                 static UniqueName lhsNamer( "__massassign_L" );
    226                 static UniqueName rhsNamer( "__massassign_R" );
    227                 assert ( ! lhs.empty() && rhs.size() <= 1);
    228 
    229                 ObjectDecl * rtmp = rhs.size() == 1 ? newObject( rhsNamer, rhs.front().expr ) : nullptr;
    230                 for ( ResolvExpr::Alternative & lhsAlt : lhs ) {
    231                         ObjectDecl * ltmp = newObject( lhsNamer, lhsAlt.expr );
    232                         out.push_back( createFunc( spotter.fname, ltmp, rtmp ) );
    233                         tmpDecls.push_back( ltmp );
    234                 }
    235                 if ( rtmp ) tmpDecls.push_back( rtmp );
    236         }
    237 
    238         void TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
    239                 static UniqueName lhsNamer( "__multassign_L" );
    240                 static UniqueName rhsNamer( "__multassign_R" );
    241 
    242                 // xxx - need more complicated matching?
    243                 if ( lhs.size() == rhs.size() ) {
    244                         std::list< ObjectDecl * > ltmp;
    245                         std::list< ObjectDecl * > rtmp;
    246                         std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), []( ResolvExpr::Alternative & alt ){
    247                                 return newObject( lhsNamer, alt.expr );
    248                         });
    249                         std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), []( ResolvExpr::Alternative & alt ){
    250                                 return newObject( rhsNamer, alt.expr );
    251                         });
    252                         zipWith( ltmp.begin(), ltmp.end(), rtmp.begin(), rtmp.end(), back_inserter(out), [&](ObjectDecl * obj1, ObjectDecl * obj2 ) { return createFunc(spotter.fname, obj1, obj2); } );
    253                         tmpDecls.splice( tmpDecls.end(), ltmp );
    254                         tmpDecls.splice( tmpDecls.end(), rtmp );
    255                 }
     374                }
     375                std::copy( alternatives.begin(), alternatives.end(), out );
     376        }
     377
     378        template< class InputIterator, class OutputIterator >
     379        void TupleAssignSpotter::Options::lift_intersection( InputIterator begin, InputIterator end, OutputIterator out ) {
     380                if ( begin == end ) return;
     381                InputIterator test = begin;
     382
     383                if (++test == end)
     384                        { copy(begin->begin(), begin->end(), out); return; }
     385
     386
     387                std::multiset<int> cur; // InputIterator::value_type::value_type
     388                copy( begin->begin(), begin->end(), inserter( cur, cur.begin() ) );
     389
     390                while ( test != end ) {
     391                        std::multiset<int> temp;
     392                        set_intersection( cur.begin(), cur.end(), test->begin(), test->end(), inserter(temp,temp.begin()) );
     393                        cur.clear();
     394                        copy( temp.begin(), temp.end(), inserter(cur,cur.begin()));
     395                        ++test;
     396                }
     397
     398                copy( cur.begin(), cur.end(), out );
     399                return;
     400        }
     401
     402        ResolvExpr::AltList TupleAssignSpotter::Options::get_option( std::list< ResolvExpr::AltList >::size_type index ) {
     403                if ( index >= options.size() )
     404                        throw 0; // XXX
     405                std::list< ResolvExpr::AltList >::iterator it = options.begin();
     406                for ( std::list< ResolvExpr::AltList >::size_type i = 0; i < index; ++i, ++it );
     407                return *it;
    256408        }
    257409} // namespace Tuples
  • src/Tuples/module.mk

    rb726084 r84118d8  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    1616
    1717SRC +=  Tuples/TupleAssignment.cc \
    18         Tuples/TupleExpansion.cc \
    19         Tuples/Explode.cc
     18        Tuples/NameMatcher.cc
  • src/main.cc

    rb726084 r84118d8  
    4343#include "Common/UnimplementedError.h"
    4444#include "../config.h"
    45 #include "Tuples/Tuples.h"
    4645
    4746using namespace std;
     
    237236                OPTPRINT( "tweakInit" )
    238237                InitTweak::genInit( translationUnit );
    239                 OPTPRINT( "expandMemberTuples" );
    240                 Tuples::expandMemberTuples( translationUnit );
     238
    241239                if ( libcfap ) {
    242240                        // generate the bodies of cfa library functions
     
    263261                        return 0;
    264262                } // if
    265 
    266                 OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    267                 Tuples::expandUniqueExpr( translationUnit );
    268263
    269264                OPTPRINT("instantiateGenerics")
     
    282277                OPTPRINT( "box" )
    283278                GenPoly::box( translationUnit );
    284                 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
    285                 Tuples::expandTuples( translationUnit );
    286279
    287280                // print tree right before code generation
Note: See TracChangeset for help on using the changeset viewer.