Index: driver/cc1.cc
===================================================================
--- driver/cc1.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ driver/cc1.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -8,20 +8,7 @@
 // Created On       : Fri Aug 26 14:23:51 2005
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun Dec  7 22:21:33 2014
-// Update Count     : 14
+// Last Modified On : Sat Jan 10 14:16:06 2015
+// Update Count     : 15
 //
-// This  library is free  software; you  can redistribute  it and/or  modify it
-// under the terms of the GNU Lesser General Public License as published by the
-// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
-// option) any later version.
-// 
-// This library is distributed in the  hope that it will be useful, but WITHOUT
-// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-// for more details.
-// 
-// You should  have received a  copy of the  GNU Lesser General  Public License
-// along  with this library.
-// 
 
 
Index: translator/CodeGen/CodeGenerator2.cc
===================================================================
--- translator/CodeGen/CodeGenerator2.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/CodeGen/CodeGenerator2.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -477,5 +477,5 @@
 
 	// horrible, horrible hack
-	if ( dynamic_cast<BranchStmt *>( stmts.back()) != 0 ) {
+	if ( dynamic_cast<BranchStmt *>( stmts.back() ) != 0 ) {
 	    lastBreak = true;
 	    stmts.pop_back();
@@ -485,5 +485,5 @@
 	    Statement *st = switchStmt->get_branches().back();
 	    before << CodeGenerator2::printLabels( st->get_labels());
-	    st->accept(*this );
+	    st->accept( *this );
 	} // if
       
@@ -524,5 +524,5 @@
 		if ( branchStmt->get_computedTarget() != 0 ) {
 		    before << "goto *";
-		    branchStmt->get_computedTarget()->accept(*this );
+		    branchStmt->get_computedTarget()->accept( *this );
 		} // if
 	    } // if
Index: translator/ControlStruct/LabelFixer.cc
===================================================================
--- translator/ControlStruct/LabelFixer.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/ControlStruct/LabelFixer.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -24,5 +24,5 @@
     }
 
-    void LabelFixer::visit(FunctionDecl *functionDecl) {
+    void LabelFixer::visit( FunctionDecl *functionDecl ) {
 	if ( functionDecl->get_statements() != 0 )
 	    functionDecl->get_statements()->accept( *this );
@@ -32,5 +32,5 @@
     }
 
-    void LabelFixer::visit(Statement *stmt ) {
+    void LabelFixer::visit( Statement *stmt ) {
 	std::list< Label > &labels = stmt->get_labels();
 
@@ -42,5 +42,5 @@
     }
 
-    void LabelFixer::visit(BranchStmt *branchStmt) {
+    void LabelFixer::visit( BranchStmt *branchStmt ) {
 	visit ( ( Statement * )branchStmt );  // the labels this statement might have
 
@@ -50,5 +50,4 @@
 	} //else       /* computed goto or normal exit-loop statements */
     }
-
 
     Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) {
@@ -61,6 +60,6 @@
 		{ used = true; labelTable[ *i ] = entry; } // undefined and unused
 	    else
-		if( labelTable[ *i ]->defined() )
-		    throw SemanticError("Duplicate definition of label: " + *i );
+		if ( labelTable[ *i ]->defined() )
+		    throw SemanticError( "Duplicate definition of label: " + *i );
 		else
 		    labelTable[ *i ]->set_definition( definition );
@@ -82,8 +81,8 @@
     }
 
-    std::map < Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticError ) {
-	std::map < Statement *, Entry * > def_us;
+    std::map<Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticError ) {
+	std::map< Statement *, Entry * > def_us;
 
-	for ( std::map < Label, Entry *>::iterator i = labelTable.begin(); i != labelTable.end(); i++ ) {
+	for ( std::map< Label, Entry *>::iterator i = labelTable.begin(); i != labelTable.end(); i++ ) {
 	    Entry *e = i->second;
 
@@ -91,12 +90,12 @@
 		def_us[ e->get_definition() ] = e;
 	    else
-		if(e->used())
+		if ( e->used() )
 		    def_us[ e->get_definition() ]->add_uses( e->get_uses() );
 	}
 
 	// get rid of labelTable
-	for ( std::map < Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) {
+	for ( std::map< Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) {
 	    Statement *to = (*i).first;
-	    std::list < Statement *> &from = (*i).second->get_uses();
+	    std::list< Statement *> &from = (*i).second->get_uses();
 	    Label finalLabel = generator->newLabel();
 	    (*i).second->set_label( finalLabel );
@@ -114,5 +113,5 @@
 
 	    for ( std::list< Statement *>::iterator j = from.begin(); j != from.end(); j++ ) {
-		BranchStmt *jumpTo = dynamic_cast < BranchStmt * > ( *j );
+		BranchStmt *jumpTo = dynamic_cast< BranchStmt * > ( *j );
 		assert( jumpTo != 0 );
 		jumpTo->set_target( finalLabel );
@@ -121,6 +120,6 @@
 
 	// reverse table
-	std::map < Label, Statement * > *ret = new std::map < Label, Statement * >();
-	for (std::map < Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) 
+	std::map< Label, Statement * > *ret = new std::map< Label, Statement * >();
+	for ( std::map< Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) 
 	    (*ret)[ (*i).second->get_label() ] = (*i).first;
 
Index: translator/ControlStruct/MLEMutator.cc
===================================================================
--- translator/ControlStruct/MLEMutator.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/ControlStruct/MLEMutator.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -12,5 +12,5 @@
     }
 
-    CompoundStmt* MLEMutator::mutate(CompoundStmt *cmpndStmt) {
+    CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) {
 	bool labeledBlock = false;
 	if ( !((cmpndStmt->get_labels()).empty()) ) {
@@ -27,5 +27,5 @@
 		if ( next == kids.end() ) {
 		    std::list<Label> ls; ls.push_back( get_breakLabel() );
-		    kids.push_back( new NullStmt(ls) );
+		    kids.push_back( new NullStmt( ls ) );
 		} else
 		    (*next)->get_labels().push_back( get_breakLabel() );
@@ -88,5 +88,5 @@
 	std::list< Entry >::iterator check;
 	if ( ( check = std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) ) == enclosingLoops.end() )
-	    // not in loop, checking if in switch/choose
+	    // not in loop, checking if in block
 	    if ( (check = std::find( enclosingBlocks.begin(), enclosingBlocks.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingBlocks.end() )
 		// neither in loop nor in block, checking if in switch/choose
@@ -95,5 +95,5 @@
 
 	if ( enclosingLoops.back() == (*check) )
-	    return branchStmt;                      // exit the innermost loop (labels not necessary)
+	    return branchStmt;				// exit the innermost loop (labels unnecessary)
 
 	Label newLabel;
@@ -102,21 +102,26 @@
 	    if ( check->get_breakExit() != "" )
 		newLabel = check->get_breakExit();
-	    else { newLabel = generator->newLabel(); check->set_breakExit( newLabel ); }
+	    else {
+		newLabel = generator->newLabel();
+		check->set_breakExit( newLabel );
+	    } // if
 	    break;
 	  case BranchStmt::Continue:
 	    if ( check->get_contExit() != "" )
 		newLabel = check->get_contExit();
-	    else { newLabel = generator->newLabel(); check->set_contExit( newLabel ); }
+	    else {
+		newLabel = generator->newLabel();
+		check->set_contExit( newLabel );
+	    } // if
 	    break;
 	  default:
-	    // shouldn't be here
-	    return 0;
+	    return 0;					// shouldn't be here
 	} // switch
 
-	return new BranchStmt(std::list<Label>(), newLabel, BranchStmt::Goto );
+	return new BranchStmt( std::list<Label>(), newLabel, BranchStmt::Goto );
     }
 
 
-    Statement *MLEMutator::mutate(SwitchStmt *switchStmt) {
+    Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
 	Label brkLabel = generator->newLabel();
 	enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) );
@@ -131,5 +136,5 @@
     }
 
-    Statement *MLEMutator::mutate(ChooseStmt *switchStmt) {
+    Statement *MLEMutator::mutate( ChooseStmt *switchStmt ) {
 	Label brkLabel = generator->newLabel();
 	enclosingSwitches.push_back( Entry(switchStmt,"", brkLabel) );
Index: translator/ControlStruct/MLEMutator.h
===================================================================
--- translator/ControlStruct/MLEMutator.h	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/ControlStruct/MLEMutator.h	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -15,5 +15,5 @@
 	class Entry;
       public:
-	MLEMutator( std::map <Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
+	MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
 	~MLEMutator();
 
@@ -56,6 +56,6 @@
 	};
 
-	std::map <Label, Statement *> *targetTable;
-	std::list < Entry > enclosingBlocks,enclosingLoops,enclosingSwitches;
+	std::map< Label, Statement * > *targetTable;
+	std::list< Entry > enclosingBlocks, enclosingLoops, enclosingSwitches;
 	Label breakLabel;
 	LabelGenerator *generator;
Index: translator/GenPoly/Box.cc
===================================================================
--- translator/GenPoly/Box.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/GenPoly/Box.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -33,444 +33,389 @@
 
 namespace GenPoly {
-
-namespace {
-
-const std::list<Label> noLabels;
-
-class Pass1 : public PolyMutator
-{
-public:
-  Pass1();
-  virtual Expression *mutate( ApplicationExpr *appExpr );
-  virtual Expression *mutate( AddressExpr *addrExpr );
-  virtual Expression *mutate( UntypedExpr *expr );
-  virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
-  virtual TypeDecl* mutate( TypeDecl *typeDecl );
-  virtual Expression *mutate( CommaExpr *commaExpr );
-  virtual Expression *mutate( ConditionalExpr *condExpr );
-  virtual Statement* mutate(ReturnStmt *catchStmt);
-  virtual Type* mutate( PointerType *pointerType );
-  virtual Type* mutate( FunctionType *pointerType );
-  
-  virtual void doEndScope();
-  
-private:
-  void passTypeVars( ApplicationExpr* appExpr, std::list< Expression* >::iterator &arg, const TyVarMap &exprTyVars );
-  Expression* addRetParam( ApplicationExpr* appExpr, FunctionType *function, Type *retType, std::list< Expression* >::iterator &arg );
-  Expression* addPolyRetParam( ApplicationExpr* appExpr, FunctionType *function, std::string typeName, std::list< Expression* >::iterator &arg );
-  Expression* applyAdapter( ApplicationExpr* appExpr, FunctionType *function, std::list< Expression* >::iterator &arg, const TyVarMap &exprTyVars );
-  void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars );
-  void boxParams( ApplicationExpr* appExpr, FunctionType *function, std::list< Expression* >::iterator &arg, const TyVarMap &exprTyVars );
-  void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression* >::iterator &arg, const TyVarMap &tyVars );
-  void findAssignOps( const std::list< TypeDecl* > &forall );
-  void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars );
-  FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars );
-  Expression *handleIntrinsics( ApplicationExpr *appExpr );
-  ObjectDecl *makeTemporary( Type *type );
-  
-  std::map< std::string, DeclarationWithType* > assignOps;
-  std::map< std::string, FunctionDecl* > adapters;
-  DeclarationWithType* retval;
-  bool useRetval;
-  UniqueName tempNamer;
-};
-
-class Pass2 : public PolyMutator
-{
-public:
-  Pass2();
-  template< typename DeclClass >
-  DeclClass* handleDecl( DeclClass *decl, Type *type );
-  virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
-  virtual ObjectDecl* mutate( ObjectDecl *objectDecl );
-  virtual TypeDecl* mutate( TypeDecl *typeDecl );
-  virtual TypedefDecl* mutate( TypedefDecl *typedefDecl );
-  virtual Type* mutate( PointerType *pointerType );
-  virtual Type* mutate( FunctionType *funcType );
-
-private:
-  void addAdapters( FunctionType *functionType );
-  
-  std::map< UniqueId, std::string > adapterName;
-};
-
-class Pass3 : public PolyMutator
-{
-public:
-  template< typename DeclClass >
-  DeclClass* handleDecl( DeclClass *decl, Type *type );
-  virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
-  virtual ObjectDecl* mutate( ObjectDecl *objectDecl );
-  virtual TypedefDecl* mutate( TypedefDecl *objectDecl );
-  virtual TypeDecl* mutate( TypeDecl *objectDecl );
-  virtual Statement* mutate( DeclStmt *declStmt );
-  virtual Type* mutate( PointerType *pointerType );
-  virtual Type* mutate( FunctionType *funcType );
-
-private:
-};
-
-} // anonymous namespace
-
-void
-printAllNotBuiltin( const std::list< Declaration* >& translationUnit, std::ostream &os )
-{
-  for( std::list< Declaration* >::const_iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
-    if( !LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) {
-      (*i)->print( os );
-      os << std::endl;
+    namespace {
+	const std::list<Label> noLabels;
+
+	class Pass1 : public PolyMutator {
+	  public:
+	    Pass1();
+	    virtual Expression *mutate( ApplicationExpr *appExpr );
+	    virtual Expression *mutate( AddressExpr *addrExpr );
+	    virtual Expression *mutate( UntypedExpr *expr );
+	    virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
+	    virtual TypeDecl *mutate( TypeDecl *typeDecl );
+	    virtual Expression *mutate( CommaExpr *commaExpr );
+	    virtual Expression *mutate( ConditionalExpr *condExpr );
+	    virtual Statement *mutate(ReturnStmt *catchStmt);
+	    virtual Type *mutate( PointerType *pointerType );
+	    virtual Type *mutate( FunctionType *pointerType );
+  
+	    virtual void doEndScope();
+	  private:
+	    void passTypeVars( ApplicationExpr *appExpr, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
+	    Expression *addRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *retType, std::list< Expression *>::iterator &arg );
+	    Expression *addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, std::string typeName, std::list< Expression *>::iterator &arg );
+	    Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
+	    void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars );
+	    void boxParams( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
+	    void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars );
+	    void findAssignOps( const std::list< TypeDecl *> &forall );
+	    void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars );
+	    FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars );
+	    Expression *handleIntrinsics( ApplicationExpr *appExpr );
+	    ObjectDecl *makeTemporary( Type *type );
+  
+	    std::map< std::string, DeclarationWithType *> assignOps;
+	    std::map< std::string, FunctionDecl *> adapters;
+	    DeclarationWithType *retval;
+	    bool useRetval;
+	    UniqueName tempNamer;
+	};
+
+	class Pass2 : public PolyMutator {
+	  public:
+	    Pass2();
+	    template< typename DeclClass >
+	    DeclClass *handleDecl( DeclClass *decl, Type *type );
+	    virtual DeclarationWithType *mutate( FunctionDecl *functionDecl );
+	    virtual ObjectDecl *mutate( ObjectDecl *objectDecl );
+	    virtual TypeDecl *mutate( TypeDecl *typeDecl );
+	    virtual TypedefDecl *mutate( TypedefDecl *typedefDecl );
+	    virtual Type *mutate( PointerType *pointerType );
+	    virtual Type *mutate( FunctionType *funcType );
+	  private:
+	    void addAdapters( FunctionType *functionType );
+  
+	    std::map< UniqueId, std::string > adapterName;
+	};
+
+	class Pass3 : public PolyMutator {
+	  public:
+	    template< typename DeclClass >
+	    DeclClass *handleDecl( DeclClass *decl, Type *type );
+	    virtual DeclarationWithType *mutate( FunctionDecl *functionDecl );
+	    virtual ObjectDecl *mutate( ObjectDecl *objectDecl );
+	    virtual TypedefDecl *mutate( TypedefDecl *objectDecl );
+	    virtual TypeDecl *mutate( TypeDecl *objectDecl );
+	    virtual Statement *mutate( DeclStmt *declStmt );
+	    virtual Type *mutate( PointerType *pointerType );
+	    virtual Type *mutate( FunctionType *funcType );
+	  private:
+	};
+
+    } // anonymous namespace
+
+    void printAllNotBuiltin( const std::list< Declaration *>& translationUnit, std::ostream &os ) {
+	for ( std::list< Declaration *>::const_iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
+	    if ( !LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) {
+		(*i)->print( os );
+		os << std::endl;
+	    } // if
+	} // for
     }
-  }
-}
-
-void
-box( std::list< Declaration* >& translationUnit )
-{
-  Pass1 pass1;
-  Pass2 pass2;
-  Pass3 pass3;
-  mutateAll( translationUnit, pass1 );
-  mutateAll( translationUnit, pass2 );
-  mutateAll( translationUnit, pass3 );
-}
+
+    void box( std::list< Declaration *>& translationUnit ) {
+	Pass1 pass1;
+	Pass2 pass2;
+	Pass3 pass3;
+	mutateAll( translationUnit, pass1 );
+	mutateAll( translationUnit, pass2 );
+	mutateAll( translationUnit, pass3 );
+    }
 
 ////////////////////////////////////////// Pass1 ////////////////////////////////////////////////////
 
-namespace {
-
-bool
-isPolyRet( FunctionType *function, std::string &name, const TyVarMap &otherTyVars )
-{
-  bool doTransform = false;
-  if( !function->get_returnVals().empty() ) {
-    if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( function->get_returnVals().front()->get_type() ) ) {
+    namespace {
+	bool isPolyRet( FunctionType *function, std::string &name, const TyVarMap &otherTyVars ) {
+	    bool doTransform = false;
+	    if ( !function->get_returnVals().empty() ) {
+		if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( function->get_returnVals().front()->get_type() ) ) {
     
-      // figure out if the return type is specified by a type parameter
-      for( std::list< TypeDecl* >::const_iterator tyVar = function->get_forall().begin(); tyVar != function->get_forall().end(); ++tyVar ) {
-        if( (*tyVar)->get_name() == typeInst->get_name() ) {
-          doTransform = true;
-          name = typeInst->get_name();
-          break;
-        }
-      }
-      if( !doTransform && otherTyVars.find( typeInst->get_name() ) != otherTyVars.end() ) {
-        doTransform = true;
-      }
-    }
-  }
-  return doTransform;
-}
-
-bool
-isPolyRet( FunctionType *function, std::string &name )
-{
-  TyVarMap dummyTyVars;
-  return isPolyRet( function, name, dummyTyVars );
-}
-
-Pass1::Pass1()
-  : useRetval( false ), tempNamer( "_temp" )
-{
-}
-
-bool
-checkAssignment( DeclarationWithType *decl, std::string &name )
-{
-  if( decl->get_name() == "?=?" ) {
-    if( PointerType *ptrType = dynamic_cast< PointerType* >( decl->get_type() ) ) {
-      if( FunctionType *funType = dynamic_cast< FunctionType* >( ptrType->get_base() ) ) {
-        if( funType->get_parameters().size() == 2 ) {
-          if( PointerType *pointer = dynamic_cast< PointerType* >( funType->get_parameters().front()->get_type() ) ) {
-            if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( pointer->get_base() ) ) {
-              name = typeInst->get_name();
-              return true;
-            }
-          }
-        }
-      }
-    }
-  }
-  return false;
-}
-
-void 
-Pass1::findAssignOps( const std::list< TypeDecl* > &forall )
-{
-  assignOps.clear();
-  for( std::list< TypeDecl* >::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
-    for( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
-      std::string typeName;
-      if( checkAssignment( *assert, typeName ) ) {
-        assignOps[ typeName ] = *assert;
-      }
-    }
-  }
-}
-
-DeclarationWithType* 
-Pass1::mutate( FunctionDecl *functionDecl )
-{
-  if( functionDecl->get_statements() ) {
-    TyVarMap oldtyVars = scopeTyVars;
-    DeclarationWithType *oldRetval = retval;
-    bool oldUseRetval = useRetval;
+		    // figure out if the return type is specified by a type parameter
+		    for ( std::list< TypeDecl *>::const_iterator tyVar = function->get_forall().begin(); tyVar != function->get_forall().end(); ++tyVar ) {
+			if ( (*tyVar)->get_name() == typeInst->get_name() ) {
+			    doTransform = true;
+			    name = typeInst->get_name();
+			    break;
+			} // if
+		    } // for
+		    if ( !doTransform && otherTyVars.find( typeInst->get_name() ) != otherTyVars.end() ) {
+			doTransform = true;
+		    } // if
+		} // if
+	    } // if
+	    return doTransform;
+	}
+
+	bool isPolyRet( FunctionType *function, std::string &name ) {
+	    TyVarMap dummyTyVars;
+	    return isPolyRet( function, name, dummyTyVars );
+	}
+
+	Pass1::Pass1()
+	    : useRetval( false ), tempNamer( "_temp" ) {
+	}
+
+	bool checkAssignment( DeclarationWithType *decl, std::string &name ) {
+	    if ( decl->get_name() == "?=?" ) {
+		if ( PointerType *ptrType = dynamic_cast< PointerType *>( decl->get_type() ) ) {
+		    if ( FunctionType *funType = dynamic_cast< FunctionType *>( ptrType->get_base() ) ) {
+			if ( funType->get_parameters().size() == 2 ) {
+			    if ( PointerType *pointer = dynamic_cast< PointerType *>( funType->get_parameters().front()->get_type() ) ) {
+				if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( pointer->get_base() ) ) {
+				    name = typeInst->get_name();
+				    return true;
+				} // if
+			    } // if
+			} // if
+		    } // if
+		} // if
+	    } // if
+	    return false;
+	}
+
+	void Pass1::findAssignOps( const std::list< TypeDecl *> &forall ) {
+	    assignOps.clear();
+	    for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
+		for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
+		    std::string typeName;
+		    if ( checkAssignment( *assert, typeName ) ) {
+			assignOps[ typeName ] = *assert;
+		    } // if
+		} // for
+	    } // for
+	}
+
+	DeclarationWithType *
+	Pass1::mutate( FunctionDecl *functionDecl ) {
+	    if ( functionDecl->get_statements() ) {
+		TyVarMap oldtyVars = scopeTyVars;
+		DeclarationWithType *oldRetval = retval;
+		bool oldUseRetval = useRetval;
     
-    retval = 0;
-    std::string typeName;
-    if( isPolyRet( functionDecl->get_functionType(), typeName ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
-      retval = functionDecl->get_functionType()->get_returnVals().front();
-  
-      // give names to unnamed return values
-      if( retval->get_name() == "" ) {
-        retval->set_name( "_retparm" );
-        retval->set_linkage( LinkageSpec::C );
-      }
-    }
+		retval = 0;
+		std::string typeName;
+		if ( isPolyRet( functionDecl->get_functionType(), typeName ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
+		    retval = functionDecl->get_functionType()->get_returnVals().front();
+  
+		    // give names to unnamed return values
+		    if ( retval->get_name() == "" ) {
+			retval->set_name( "_retparm" );
+			retval->set_linkage( LinkageSpec::C );
+		    } // if
+		} // if
     
-    scopeTyVars.clear();
+		scopeTyVars.clear();
 ///     std::cerr << "clear\n";
-    makeTyVarMap( functionDecl->get_functionType(), scopeTyVars );
-    findAssignOps( functionDecl->get_functionType()->get_forall() );
-    functionDecl->set_statements( functionDecl->get_statements()->acceptMutator( *this ) );
-  
-    scopeTyVars = oldtyVars;
+		makeTyVarMap( functionDecl->get_functionType(), scopeTyVars );
+		findAssignOps( functionDecl->get_functionType()->get_forall() );
+		functionDecl->set_statements( functionDecl->get_statements()->acceptMutator( *this ) );
+  
+		scopeTyVars = oldtyVars;
 ///     std::cerr << "end FunctionDecl: ";
-///     for( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
+///     for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
 ///       std::cerr << i->first << " ";
 ///     }
 ///     std::cerr << "\n";
-    retval = oldRetval;
-    useRetval = oldUseRetval;
-    doEndScope();
-  }
-  return functionDecl;
-}
-
-TypeDecl*
-Pass1::mutate( TypeDecl *typeDecl )
-{
+		retval = oldRetval;
+		useRetval = oldUseRetval;
+		doEndScope();
+	    } // if
+	    return functionDecl;
+	}
+
+	TypeDecl *Pass1::mutate( TypeDecl *typeDecl ) {
 ///     std::cerr << "add " << typeDecl->get_name() << "\n";
-  scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
-  return Mutator::mutate( typeDecl );
-}
-
-Expression *
-Pass1::mutate( CommaExpr *commaExpr )
-{
-  bool oldUseRetval = useRetval;
-  useRetval = false;
-  commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
-  useRetval = oldUseRetval;
-  commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
-  return commaExpr;
-}
-
-Expression *
-Pass1::mutate( ConditionalExpr *condExpr )
-{
-  bool oldUseRetval = useRetval;
-  useRetval = false;
-  condExpr->set_arg1( maybeMutate( condExpr->get_arg1(), *this ) );
-  useRetval = oldUseRetval;
-  condExpr->set_arg2( maybeMutate( condExpr->get_arg2(), *this ) );
-  condExpr->set_arg3( maybeMutate( condExpr->get_arg3(), *this ) );
-  return condExpr;
-
-}
-
-void
-Pass1::passTypeVars( ApplicationExpr* appExpr, std::list< Expression* >::iterator &arg, const TyVarMap &exprTyVars )
-{
-  for( TyVarMap::const_iterator tyParm = exprTyVars.begin(); tyParm != exprTyVars.end(); ++tyParm ) {
-    ResolvExpr::EqvClass eqvClass;
-    assert( env );
-    if( tyParm->second == TypeDecl::Any ) {
-      Type *concrete = env->lookup( tyParm->first );
-      if( concrete ) {
-        arg = appExpr->get_args().insert( arg, new SizeofExpr( concrete->clone() ) );
-        arg++;
-      } else {
-        throw SemanticError( "unbound type variable in application ", appExpr );
-      }
-    }
-  }
-}
-
-ObjectDecl*
-Pass1::makeTemporary( Type *type )
-{
-  ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Declaration::NoStorageClass, LinkageSpec::C, 0, type, 0 );
-  stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
-  return newObj;
-}
-
-TypeInstType *
-isPolyType( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars )
-{
-  if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
-    if( env ) {
-      if( Type *newType = env->lookup( typeInst->get_name() ) ) {
-        return isPolyType( newType, env, tyVars );
-      }
-    }
-    if( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
-      return typeInst;
-    } else {
-      return 0;
-    }
-  } else {
-    return 0;
-  }
-}
-
-Expression*
-Pass1::addRetParam( ApplicationExpr* appExpr, FunctionType *function, Type *retType, std::list< Expression* >::iterator &arg )
-{
-  if( useRetval ) {
-    assert( retval );
-    arg = appExpr->get_args().insert( arg, new VariableExpr( retval ) );
-    arg++;
-  } else {
-    ObjectDecl *newObj = makeTemporary( retType->clone() );
-    Expression *paramExpr = new VariableExpr( newObj );
-    if( !isPolyType( newObj->get_type(), env, scopeTyVars ) ) {
-      paramExpr = new AddressExpr( paramExpr );
-    }
-    arg = appExpr->get_args().insert( arg, paramExpr );
-    arg++;
+	    scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
+	    return Mutator::mutate( typeDecl );
+	}
+
+	Expression *Pass1::mutate( CommaExpr *commaExpr ) {
+	    bool oldUseRetval = useRetval;
+	    useRetval = false;
+	    commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
+	    useRetval = oldUseRetval;
+	    commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
+	    return commaExpr;
+	}
+
+	Expression *Pass1::mutate( ConditionalExpr *condExpr ) {
+	    bool oldUseRetval = useRetval;
+	    useRetval = false;
+	    condExpr->set_arg1( maybeMutate( condExpr->get_arg1(), *this ) );
+	    useRetval = oldUseRetval;
+	    condExpr->set_arg2( maybeMutate( condExpr->get_arg2(), *this ) );
+	    condExpr->set_arg3( maybeMutate( condExpr->get_arg3(), *this ) );
+	    return condExpr;
+
+	}
+
+	void Pass1::passTypeVars( ApplicationExpr *appExpr, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) {
+	    for ( TyVarMap::const_iterator tyParm = exprTyVars.begin(); tyParm != exprTyVars.end(); ++tyParm ) {
+		ResolvExpr::EqvClass eqvClass;
+		assert( env );
+		if ( tyParm->second == TypeDecl::Any ) {
+		    Type *concrete = env->lookup( tyParm->first );
+		    if ( concrete ) {
+			arg = appExpr->get_args().insert( arg, new SizeofExpr( concrete->clone() ) );
+			arg++;
+		    } else {
+			throw SemanticError( "unbound type variable in application ", appExpr );
+		    } // if
+		} // if
+	    } // for
+	}
+
+	ObjectDecl *Pass1::makeTemporary( Type *type ) {
+	    ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Declaration::NoStorageClass, LinkageSpec::C, 0, type, 0 );
+	    stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
+	    return newObj;
+	}
+
+	TypeInstType *isPolyType( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
+	    if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
+		if ( env ) {
+		    if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
+			return isPolyType( newType, env, tyVars );
+		    } // if
+		} // if
+		if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
+		    return typeInst;
+		} else {
+		    return 0;
+		} // if
+	    } else {
+		return 0;
+	    } // if
+	}
+
+	Expression *Pass1::addRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *retType, std::list< Expression *>::iterator &arg ) {
+	    if ( useRetval ) {
+		assert( retval );
+		arg = appExpr->get_args().insert( arg, new VariableExpr( retval ) );
+		arg++;
+	    } else {
+		ObjectDecl *newObj = makeTemporary( retType->clone() );
+		Expression *paramExpr = new VariableExpr( newObj );
+		if ( !isPolyType( newObj->get_type(), env, scopeTyVars ) ) {
+		    paramExpr = new AddressExpr( paramExpr );
+		} // if
+		arg = appExpr->get_args().insert( arg, paramExpr );
+		arg++;
 ///     stmtsToAdd.push_back( new ExprStmt( noLabels, appExpr ) );
-    CommaExpr *commaExpr = new CommaExpr( appExpr, new VariableExpr( newObj ) );
-    commaExpr->set_env( appExpr->get_env() );
-    appExpr->set_env( 0 );
-    return commaExpr;
-  }
-  return appExpr;
-}
-
-Expression*
-Pass1::addPolyRetParam( ApplicationExpr* appExpr, FunctionType *function, std::string typeName, std::list< Expression* >::iterator &arg )
-{
-  ResolvExpr::EqvClass eqvClass;
-  assert( env );
-  Type *concrete = env->lookup( typeName );
-  if( concrete == 0 ) {
-    throw SemanticError( "Unbound type variable " + typeName + " in", appExpr );
-  }
-  return addRetParam( appExpr, function, concrete, arg );
-}
-
-Expression*
-Pass1::applyAdapter( ApplicationExpr* appExpr, FunctionType *function, std::list< Expression* >::iterator &arg, const TyVarMap &tyVars )
-{
-  Expression *ret = appExpr;
-  if( !function->get_returnVals().empty() && isPolyVal( function->get_returnVals().front()->get_type(), tyVars ) ) {
-    ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg );
-  }
-  appExpr->get_args().push_front( appExpr->get_function() );
-  appExpr->set_function( new NameExpr( "_adapter" + SymTab::Mangler::mangle( function ) ) );
-  
-  return ret;
-}
-
-void
-Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars )
-{
-  assert( !arg->get_results().empty() );
-///   if( !dynamic_cast< PointerType* >( arg->get_results().front() ) ) {
-    TypeInstType *typeInst = dynamic_cast< TypeInstType* >( param );
-    if( typeInst && exprTyVars.find( typeInst->get_name() ) != exprTyVars.end() ) {
-      if( arg->get_results().front()->get_isLvalue() ) {
-        arg = new AddressExpr( arg );
-      } else {
-        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Declaration::NoStorageClass, LinkageSpec::C, 0, arg->get_results().front()->clone(), 0 );
-        newObj->get_type()->get_qualifiers() = Type::Qualifiers();
-        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
-        UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
-        assign->get_args().push_back( new VariableExpr( newObj ) );
-        assign->get_args().push_back( arg );
-        stmtsToAdd.push_back( new ExprStmt( noLabels, assign ) );
-        arg = new AddressExpr( new VariableExpr( newObj ) );
-      }
-    }
+		CommaExpr *commaExpr = new CommaExpr( appExpr, new VariableExpr( newObj ) );
+		commaExpr->set_env( appExpr->get_env() );
+		appExpr->set_env( 0 );
+		return commaExpr;
+	    } // if
+	    return appExpr;
+	}
+
+	Expression *Pass1::addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, std::string typeName, std::list< Expression *>::iterator &arg ) {
+	    ResolvExpr::EqvClass eqvClass;
+	    assert( env );
+	    Type *concrete = env->lookup( typeName );
+	    if ( concrete == 0 ) {
+		throw SemanticError( "Unbound type variable " + typeName + " in", appExpr );
+	    } // if
+	    return addRetParam( appExpr, function, concrete, arg );
+	}
+
+	Expression *Pass1::applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
+	    Expression *ret = appExpr;
+	    if ( !function->get_returnVals().empty() && isPolyVal( function->get_returnVals().front()->get_type(), tyVars ) ) {
+		ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg );
+	    } // if
+	    appExpr->get_args().push_front( appExpr->get_function() );
+	    appExpr->set_function( new NameExpr( "_adapter" + SymTab::Mangler::mangle( function ) ) );
+  
+	    return ret;
+	}
+
+	void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
+	    assert( !arg->get_results().empty() );
+///   if ( !dynamic_cast< PointerType *>( arg->get_results().front() ) ) {
+	    TypeInstType *typeInst = dynamic_cast< TypeInstType *>( param );
+	    if ( typeInst && exprTyVars.find( typeInst->get_name() ) != exprTyVars.end() ) {
+		if ( arg->get_results().front()->get_isLvalue() ) {
+		    arg = new AddressExpr( arg );
+		} else {
+		    ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Declaration::NoStorageClass, LinkageSpec::C, 0, arg->get_results().front()->clone(), 0 );
+		    newObj->get_type()->get_qualifiers() = Type::Qualifiers();
+		    stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
+		    UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
+		    assign->get_args().push_back( new VariableExpr( newObj ) );
+		    assign->get_args().push_back( arg );
+		    stmtsToAdd.push_back( new ExprStmt( noLabels, assign ) );
+		    arg = new AddressExpr( new VariableExpr( newObj ) );
+		} // if
+	    } // if
 ///   }
-}
-
-void
-addCast( Expression *&actual, Type *formal, const TyVarMap &tyVars )
-{
-  Type *newType = formal->clone();
-  std::list< FunctionType* > functions;
-  // instead of functions needing adapters, this really ought to look for
-  // any function mentioning a polymorphic type
-  findAndReplaceFunction( newType, functions, tyVars, needsAdapter );
-  if( !functions.empty() ) {
-    actual = new CastExpr( actual, newType );
-  } else {
-    delete newType;
-  }
-}
-
-void
-Pass1::boxParams( ApplicationExpr* appExpr, FunctionType *function, std::list< Expression* >::iterator &arg, const TyVarMap &exprTyVars )
-{
+	}
+
+	void addCast( Expression *&actual, Type *formal, const TyVarMap &tyVars ) {
+	    Type *newType = formal->clone();
+	    std::list< FunctionType *> functions;
+	    // instead of functions needing adapters, this really ought to look for
+	    // any function mentioning a polymorphic type
+	    findAndReplaceFunction( newType, functions, tyVars, needsAdapter );
+	    if ( !functions.empty() ) {
+		actual = new CastExpr( actual, newType );
+	    } else {
+		delete newType;
+	    } // if
+	}
+
+	void Pass1::boxParams( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) {
 ///   std::cout << "function is ";
 ///   function->print( std::cout );
-  for( std::list< DeclarationWithType* >::const_iterator param = function->get_parameters().begin(); param != function->get_parameters().end(); ++param, ++arg ) {
+	    for ( std::list< DeclarationWithType *>::const_iterator param = function->get_parameters().begin(); param != function->get_parameters().end(); ++param, ++arg ) {
 ///     std::cout << "parameter is ";
 ///     (*param)->print( std::cout );
 ///     std::cout << std::endl << "argument is ";
 ///     (*arg)->print( std::cout );
-    assert( arg != appExpr->get_args().end() );
-    addCast( *arg, (*param)->get_type(), exprTyVars );
-    boxParam( (*param)->get_type(), *arg, exprTyVars );
-  }
-}
-
-void
-Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression* >::iterator &arg, const TyVarMap &tyVars )
-{
-  std::list< Expression* >::iterator cur = arg;
-  for( std::list< TypeDecl* >::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
-    for( std::list< DeclarationWithType* >::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
-      InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
-      assert( inferParam != appExpr->get_inferParams().end() );
-      Expression *newExpr = inferParam->second.expr->clone();
-      addCast( newExpr, (*assert)->get_type(), tyVars );
-      boxParam( (*assert)->get_type(), newExpr, tyVars );
-      appExpr->get_args().insert( cur, newExpr );
-    }
-  }
-}
-
-void
-makeRetParm( FunctionType *funcType )
-{
-  DeclarationWithType *retParm = funcType->get_returnVals().front();
-
-  // make a new parameter that is a pointer to the type of the old return value
-  retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
-  funcType->get_parameters().push_front( retParm );
-
-  // we don't need the return value any more
-  funcType->get_returnVals().clear();
-}
-
-FunctionType *
-makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars )
-{
-  // actually make the adapter type
-  FunctionType *adapter = adaptee->clone();
-  if( !adapter->get_returnVals().empty() && isPolyVal( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
-    makeRetParm( adapter );
-  }
-  adapter->get_parameters().push_front( new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
-  return adapter;
-}
-
-Expression*
-makeAdapterArg( DeclarationWithType *param, DeclarationWithType *arg, DeclarationWithType *realParam, const TyVarMap &tyVars )
-{
-  assert( param );
-  assert( arg );
+		assert( arg != appExpr->get_args().end() );
+		addCast( *arg, (*param)->get_type(), exprTyVars );
+		boxParam( (*param)->get_type(), *arg, exprTyVars );
+	    } // for
+	}
+
+	void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
+	    std::list< Expression *>::iterator cur = arg;
+	    for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
+		for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
+		    InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
+		    assert( inferParam != appExpr->get_inferParams().end() );
+		    Expression *newExpr = inferParam->second.expr->clone();
+		    addCast( newExpr, (*assert)->get_type(), tyVars );
+		    boxParam( (*assert)->get_type(), newExpr, tyVars );
+		    appExpr->get_args().insert( cur, newExpr );
+		} // for
+	    } // for
+	}
+
+	void makeRetParm( FunctionType *funcType ) {
+	    DeclarationWithType *retParm = funcType->get_returnVals().front();
+
+	    // make a new parameter that is a pointer to the type of the old return value
+	    retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
+	    funcType->get_parameters().push_front( retParm );
+
+	    // we don't need the return value any more
+	    funcType->get_returnVals().clear();
+	}
+
+	FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars ) {
+	    // actually make the adapter type
+	    FunctionType *adapter = adaptee->clone();
+	    if ( !adapter->get_returnVals().empty() && isPolyVal( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
+		makeRetParm( adapter );
+	    } // if
+	    adapter->get_parameters().push_front( new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
+	    return adapter;
+	}
+
+	Expression *makeAdapterArg( DeclarationWithType *param, DeclarationWithType *arg, DeclarationWithType *realParam, const TyVarMap &tyVars ) {
+	    assert( param );
+	    assert( arg );
 ///   std::cout << "arg type is ";
 ///   arg->get_type()->print( std::cout );
@@ -479,665 +424,619 @@
 ///   std::cout << " tyVars are: ";
 ///   printTyVarMap( std::cout, tyVars );
-  if( isPolyVal( realParam->get_type(), tyVars ) ) {
-///     if( dynamic_cast< PointerType* >( arg->get_type() ) ) {
+	    if ( isPolyVal( realParam->get_type(), tyVars ) ) {
+///     if ( dynamic_cast< PointerType *>( arg->get_type() ) ) {
 ///       return new CastExpr( new VariableExpr( param ), arg->get_type()->clone() );
 ///     } else {
-      UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
-      deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
-      deref->get_results().push_back( arg->get_type()->clone() );
-      return deref;
+		UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
+		deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
+		deref->get_results().push_back( arg->get_type()->clone() );
+		return deref;
 ///     }
-  }
-  return new VariableExpr( param );
-}
-
-void
-addAdapterParams( ApplicationExpr *adapteeApp, std::list< DeclarationWithType* >::iterator arg, std::list< DeclarationWithType* >::iterator param, std::list< DeclarationWithType* >::iterator paramEnd, std::list< DeclarationWithType* >::iterator realParam, const TyVarMap &tyVars )
-{
-  UniqueName paramNamer( "_p" );
-  for( ; param != paramEnd; ++param, ++arg, ++realParam ) {
-    if( (*param)->get_name() == "" ) {
-      (*param)->set_name( paramNamer.newName() );
-      (*param)->set_linkage( LinkageSpec::C );
-    }
-    adapteeApp->get_args().push_back( makeAdapterArg( *param, *arg, *realParam, tyVars ) );
-  }
-}
-
-FunctionDecl *
-Pass1::makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars )
-{
-  FunctionType *adapterType = makeAdapterType( adaptee, tyVars );
-  adapterType = ScrubTyVars::scrub( adapterType, tyVars );
-  DeclarationWithType *adapteeDecl = adapterType->get_parameters().front();
-  adapteeDecl->set_name( "_adaptee" );
-  ApplicationExpr *adapteeApp = new ApplicationExpr( new CastExpr( new VariableExpr( adapteeDecl ), new PointerType( Type::Qualifiers(), realType ) ) );
-  Statement *bodyStmt;
-  
-  std::list< TypeDecl* >::iterator tyArg = realType->get_forall().begin();
-  std::list< TypeDecl* >::iterator tyParam = adapterType->get_forall().begin();
-  std::list< TypeDecl* >::iterator realTyParam = adaptee->get_forall().begin();
-  for( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
-    assert( tyArg != realType->get_forall().end() );
-    std::list< DeclarationWithType* >::iterator assertArg = (*tyArg)->get_assertions().begin();
-    std::list< DeclarationWithType* >::iterator assertParam = (*tyParam)->get_assertions().begin();
-    std::list< DeclarationWithType* >::iterator realAssertParam = (*realTyParam)->get_assertions().begin();
-    for( ; assertParam != (*tyParam)->get_assertions().end(); ++assertArg, ++assertParam, ++realAssertParam ) {
-      assert( assertArg != (*tyArg)->get_assertions().end() );
-      adapteeApp->get_args().push_back( makeAdapterArg( *assertParam, *assertArg, *realAssertParam, tyVars ) );
-    }
-  }
-  
-  std::list< DeclarationWithType* >::iterator arg = realType->get_parameters().begin();
-  std::list< DeclarationWithType* >::iterator param = adapterType->get_parameters().begin();
-  std::list< DeclarationWithType* >::iterator realParam = adaptee->get_parameters().begin();
-  param++;		// skip adaptee parameter
-  if( realType->get_returnVals().empty() ) {
-    addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
-    bodyStmt = new ExprStmt( noLabels, adapteeApp );
-  } else if( isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
-    if( (*param)->get_name() == "" ) {
-      (*param)->set_name( "_ret" );
-      (*param)->set_linkage( LinkageSpec::C );
-    }
-    UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
-    UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
-    deref->get_args().push_back( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) );
-    assign->get_args().push_back( deref );
-    addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
-    assign->get_args().push_back( adapteeApp );
-    bodyStmt = new ExprStmt( noLabels, assign );
-  } else {
-    // adapter for a function that returns a monomorphic value
-    addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
-    bodyStmt = new ReturnStmt( noLabels, adapteeApp );
-  }
-  CompoundStmt *adapterBody = new CompoundStmt( noLabels );
-  adapterBody->get_kids().push_back( bodyStmt );
-  return new FunctionDecl( "_adapter" + mangleName, Declaration::NoStorageClass, LinkageSpec::C, adapterType, adapterBody, false );
-}
-
-void
-Pass1::passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars )
-{
-  std::list< DeclarationWithType* > &paramList = functionType->get_parameters();
-  std::list< FunctionType* > functions;
-  for( std::list< TypeDecl* >::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
-    for( std::list< DeclarationWithType* >::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
-      findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
-    }
-  }
-  for( std::list< DeclarationWithType* >::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
-    findFunction( (*arg)->get_type(), functions, exprTyVars, needsAdapter );
-  }
-  std::set< std::string > adaptersDone;
-  for( std::list< FunctionType* >::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
-    FunctionType *realFunction = (*funType)->clone();
-    assert( env );
-    env->apply( realFunction );
-    std::string mangleName = SymTab::Mangler::mangle( realFunction );
-    if( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
-      std::map< std::string, FunctionDecl* >::iterator adapter = adapters.find( mangleName );
-      if( adapter == adapters.end() ) {
-        FunctionDecl *newAdapter = makeAdapter( *funType, realFunction, mangleName, exprTyVars );
-        adapter = adapters.insert( adapters.begin(), std::pair< std::string, FunctionDecl* >( mangleName, newAdapter ) );
-        stmtsToAdd.push_back( new DeclStmt( noLabels, newAdapter ) );
-      }
-      assert( adapter != adapters.end() );
-      appExpr->get_args().push_front( new VariableExpr( adapter->second ) );
-      adaptersDone.insert( adaptersDone.begin(), mangleName );
-    }
-  }
-}
-
-TypeInstType*
-isPolyPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars )
-{
-  if( PointerType *ptr = dynamic_cast< PointerType* >( type ) ) {
-    return isPolyType( ptr->get_base(), env, tyVars );
-  } else if( env ) {
-    if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
-      if( Type *newType = env->lookup( typeInst->get_name() ) ) {
-        return isPolyPtr( newType, env, tyVars );
-      }
-    }
-  }
-  return 0;
-}
-
-TypeInstType*
-isPolyPtrPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars )
-{
-  if( PointerType *ptr = dynamic_cast< PointerType* >( type ) ) {
-    return isPolyPtr( ptr->get_base(), env, tyVars );
-  } else if( env ) {
-    if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
-      if( Type *newType = env->lookup( typeInst->get_name() ) ) {
-        return isPolyPtrPtr( newType, env, tyVars );
-      }
-    }
-  }
-  return 0;
-}
-
-Expression *
-makeIncrDecrExpr( ApplicationExpr *appExpr, std::string polyName, bool isIncr )
-{
-  NameExpr *opExpr;
-  if( isIncr ) {
-    opExpr = new NameExpr( "?+=?" );
-  } else {
-    opExpr = new NameExpr( "?-=?" );
-  }
-  UntypedExpr *addAssign = new UntypedExpr( opExpr );
-  if( AddressExpr *address = dynamic_cast< AddressExpr* >( appExpr->get_args().front() ) ) {
-    addAssign->get_args().push_back( address->get_arg() );
-  } else {
-    addAssign->get_args().push_back( appExpr->get_args().front() );
-  }
-  addAssign->get_args().push_back( new NameExpr( polyName ) );
-  addAssign->get_results().front() = appExpr->get_results().front()->clone();
-  if( appExpr->get_env() ) {
-    addAssign->set_env( appExpr->get_env() );
-    appExpr->set_env( 0 );
-  }
-  appExpr->get_args().clear();
-  delete appExpr;
-  return addAssign;
-}
-
-Expression*
-Pass1::handleIntrinsics( ApplicationExpr *appExpr )
-{
-  if( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( appExpr->get_function() ) ) {
-    if( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
-      if( varExpr->get_var()->get_name() == "?[?]" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( appExpr->get_args().size() == 2 );
-        TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
-        TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
-        assert( !typeInst1 || !typeInst2 );
-        UntypedExpr *ret = 0;
-        if( typeInst1 || typeInst2 ) {
-          ret = new UntypedExpr( new NameExpr( "?+?" ) );
-        }
-        if( typeInst1 ) {
-          UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
-          multiply->get_args().push_back( appExpr->get_args().back() );
-          multiply->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
-          ret->get_args().push_back( appExpr->get_args().front() );
-          ret->get_args().push_back( multiply );
-        } else if( typeInst2 ) {
-          UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
-          multiply->get_args().push_back( appExpr->get_args().front() );
-          multiply->get_args().push_back( new NameExpr( typeInst2->get_name() ) );
-          ret->get_args().push_back( multiply );
-          ret->get_args().push_back( appExpr->get_args().back() );
-        }
-        if( typeInst1 || typeInst2 ) {
-          ret->get_results().push_front( appExpr->get_results().front()->clone() );
-          if( appExpr->get_env() ) {
-            ret->set_env( appExpr->get_env() );
-            appExpr->set_env( 0 );
-          }
-          appExpr->get_args().clear();
-          delete appExpr;
-          return ret;
-        }
-      } else if( varExpr->get_var()->get_name() == "*?" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( !appExpr->get_args().empty() );
-        if( isPolyType( appExpr->get_results().front(), env, scopeTyVars ) ) {
-          Expression *ret = appExpr->get_args().front();
-          delete ret->get_results().front();
-          ret->get_results().front() = appExpr->get_results().front()->clone();
-          if( appExpr->get_env() ) {
-            ret->set_env( appExpr->get_env() );
-            appExpr->set_env( 0 );
-          }
-          appExpr->get_args().clear();
-          delete appExpr;
-          return ret;
-        }
-      } else if( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( appExpr->get_args().size() == 1 );
-        if( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
-          Type *tempType = appExpr->get_results().front()->clone();
-          if( env ) {
-            env->apply( tempType );
-          }
-          ObjectDecl *newObj = makeTemporary( tempType );
-          VariableExpr *tempExpr = new VariableExpr( newObj );
-          UntypedExpr *assignExpr = new UntypedExpr( new NameExpr( "?=?" ) );
-          assignExpr->get_args().push_back( tempExpr->clone() );
-          if( AddressExpr *address = dynamic_cast< AddressExpr* >( appExpr->get_args().front() ) ) {
-            assignExpr->get_args().push_back( address->get_arg()->clone() );
-          } else {
-            assignExpr->get_args().push_back( appExpr->get_args().front()->clone() );
-          }
-          CommaExpr *firstComma = new CommaExpr( assignExpr, makeIncrDecrExpr( appExpr, typeInst->get_name(), varExpr->get_var()->get_name() == "?++" ) );
-          return new CommaExpr( firstComma, tempExpr );
-        }
-      } else if( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( appExpr->get_args().size() == 1 );
-        if( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
-           return makeIncrDecrExpr( appExpr, typeInst->get_name(), varExpr->get_var()->get_name() == "++?" );
-        }
-      } else if( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( appExpr->get_args().size() == 2 );
-        TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
-        TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
-        if( typeInst1 && typeInst2 ) {
-          UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
-          divide->get_args().push_back( appExpr );
-          divide->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
-          divide->get_results().push_front( appExpr->get_results().front()->clone() );
-          if( appExpr->get_env() ) {
-            divide->set_env( appExpr->get_env() );
-            appExpr->set_env( 0 );
-          }
-          return divide;
-        } else if( typeInst1 ) {
-          UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
-          multiply->get_args().push_back( appExpr->get_args().back() );
-          multiply->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
-          appExpr->get_args().back() = multiply;
-        } else if( typeInst2 ) {
-          UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
-          multiply->get_args().push_back( appExpr->get_args().front() );
-          multiply->get_args().push_back( new NameExpr( typeInst2->get_name() ) );
-          appExpr->get_args().front() = multiply;
-        }
-      } else if( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
-        assert( !appExpr->get_results().empty() );
-        assert( appExpr->get_args().size() == 2 );
-        TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars );
-        if( typeInst ) {
-          UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
-          multiply->get_args().push_back( appExpr->get_args().back() );
-          multiply->get_args().push_back( new NameExpr( typeInst->get_name() ) );
-          appExpr->get_args().back() = multiply;
-        }
-      }
-      return appExpr;
-    }
-  }
-  return 0;
-}
-
-Expression*
-Pass1::mutate( ApplicationExpr *appExpr )
-{
+	    } // if
+	    return new VariableExpr( param );
+	}
+
+	void addAdapterParams( ApplicationExpr *adapteeApp, std::list< DeclarationWithType *>::iterator arg, std::list< DeclarationWithType *>::iterator param, std::list< DeclarationWithType *>::iterator paramEnd, std::list< DeclarationWithType *>::iterator realParam, const TyVarMap &tyVars ) {
+	    UniqueName paramNamer( "_p" );
+	    for ( ; param != paramEnd; ++param, ++arg, ++realParam ) {
+		if ( (*param)->get_name() == "" ) {
+		    (*param)->set_name( paramNamer.newName() );
+		    (*param)->set_linkage( LinkageSpec::C );
+		} // if
+		adapteeApp->get_args().push_back( makeAdapterArg( *param, *arg, *realParam, tyVars ) );
+	    } // for
+	}
+
+	FunctionDecl *Pass1::makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars ) {
+	    FunctionType *adapterType = makeAdapterType( adaptee, tyVars );
+	    adapterType = ScrubTyVars::scrub( adapterType, tyVars );
+	    DeclarationWithType *adapteeDecl = adapterType->get_parameters().front();
+	    adapteeDecl->set_name( "_adaptee" );
+	    ApplicationExpr *adapteeApp = new ApplicationExpr( new CastExpr( new VariableExpr( adapteeDecl ), new PointerType( Type::Qualifiers(), realType ) ) );
+	    Statement *bodyStmt;
+  
+	    std::list< TypeDecl *>::iterator tyArg = realType->get_forall().begin();
+	    std::list< TypeDecl *>::iterator tyParam = adapterType->get_forall().begin();
+	    std::list< TypeDecl *>::iterator realTyParam = adaptee->get_forall().begin();
+	    for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
+		assert( tyArg != realType->get_forall().end() );
+		std::list< DeclarationWithType *>::iterator assertArg = (*tyArg)->get_assertions().begin();
+		std::list< DeclarationWithType *>::iterator assertParam = (*tyParam)->get_assertions().begin();
+		std::list< DeclarationWithType *>::iterator realAssertParam = (*realTyParam)->get_assertions().begin();
+		for ( ; assertParam != (*tyParam)->get_assertions().end(); ++assertArg, ++assertParam, ++realAssertParam ) {
+		    assert( assertArg != (*tyArg)->get_assertions().end() );
+		    adapteeApp->get_args().push_back( makeAdapterArg( *assertParam, *assertArg, *realAssertParam, tyVars ) );
+		} // for
+	    } // for
+  
+	    std::list< DeclarationWithType *>::iterator arg = realType->get_parameters().begin();
+	    std::list< DeclarationWithType *>::iterator param = adapterType->get_parameters().begin();
+	    std::list< DeclarationWithType *>::iterator realParam = adaptee->get_parameters().begin();
+	    param++;		// skip adaptee parameter
+	    if ( realType->get_returnVals().empty() ) {
+		addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
+		bodyStmt = new ExprStmt( noLabels, adapteeApp );
+	    } else if ( isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
+		if ( (*param)->get_name() == "" ) {
+		    (*param)->set_name( "_ret" );
+		    (*param)->set_linkage( LinkageSpec::C );
+		} // if
+		UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
+		UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
+		deref->get_args().push_back( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) );
+		assign->get_args().push_back( deref );
+		addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
+		assign->get_args().push_back( adapteeApp );
+		bodyStmt = new ExprStmt( noLabels, assign );
+	    } else {
+		// adapter for a function that returns a monomorphic value
+		addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
+		bodyStmt = new ReturnStmt( noLabels, adapteeApp );
+	    } // if
+	    CompoundStmt *adapterBody = new CompoundStmt( noLabels );
+	    adapterBody->get_kids().push_back( bodyStmt );
+	    return new FunctionDecl( "_adapter" + mangleName, Declaration::NoStorageClass, LinkageSpec::C, adapterType, adapterBody, false );
+	}
+
+	void Pass1::passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars ) {
+	    std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
+	    std::list< FunctionType *> functions;
+	    for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
+		for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
+		    findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
+		} // for
+	    } // for
+	    for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
+		findFunction( (*arg)->get_type(), functions, exprTyVars, needsAdapter );
+	    } // for
+	    std::set< std::string > adaptersDone;
+	    for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
+		FunctionType *realFunction = (*funType)->clone();
+		assert( env );
+		env->apply( realFunction );
+		std::string mangleName = SymTab::Mangler::mangle( realFunction );
+		if ( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
+		    std::map< std::string, FunctionDecl *>::iterator adapter = adapters.find( mangleName );
+		    if ( adapter == adapters.end() ) {
+			FunctionDecl *newAdapter = makeAdapter( *funType, realFunction, mangleName, exprTyVars );
+			adapter = adapters.insert( adapters.begin(), std::pair< std::string, FunctionDecl *>( mangleName, newAdapter ) );
+			stmtsToAdd.push_back( new DeclStmt( noLabels, newAdapter ) );
+		    } // if
+		    assert( adapter != adapters.end() );
+		    appExpr->get_args().push_front( new VariableExpr( adapter->second ) );
+		    adaptersDone.insert( adaptersDone.begin(), mangleName );
+		} // if
+	    } // for
+	}
+
+	TypeInstType *isPolyPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
+	    if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
+		return isPolyType( ptr->get_base(), env, tyVars );
+	    } else if ( env ) {
+		if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
+		    if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
+			return isPolyPtr( newType, env, tyVars );
+		    } // if
+		} // if
+	    } // if
+	    return 0;
+	}
+
+	TypeInstType *isPolyPtrPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
+	    if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
+		return isPolyPtr( ptr->get_base(), env, tyVars );
+	    } else if ( env ) {
+		if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
+		    if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
+			return isPolyPtrPtr( newType, env, tyVars );
+		    } // if
+		} // if
+	    } // if
+	    return 0;
+	}
+
+	Expression *makeIncrDecrExpr( ApplicationExpr *appExpr, std::string polyName, bool isIncr ) {
+	    NameExpr *opExpr;
+	    if ( isIncr ) {
+		opExpr = new NameExpr( "?+=?" );
+	    } else {
+		opExpr = new NameExpr( "?-=?" );
+	    } // if
+	    UntypedExpr *addAssign = new UntypedExpr( opExpr );
+	    if ( AddressExpr *address = dynamic_cast< AddressExpr *>( appExpr->get_args().front() ) ) {
+		addAssign->get_args().push_back( address->get_arg() );
+	    } else {
+		addAssign->get_args().push_back( appExpr->get_args().front() );
+	    } // if
+	    addAssign->get_args().push_back( new NameExpr( polyName ) );
+	    addAssign->get_results().front() = appExpr->get_results().front()->clone();
+	    if ( appExpr->get_env() ) {
+		addAssign->set_env( appExpr->get_env() );
+		appExpr->set_env( 0 );
+	    } // if
+	    appExpr->get_args().clear();
+	    delete appExpr;
+	    return addAssign;
+	}
+
+	Expression *Pass1::handleIntrinsics( ApplicationExpr *appExpr ) {
+	    if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->get_function() ) ) {
+		if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
+		    if ( varExpr->get_var()->get_name() == "?[?]" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( appExpr->get_args().size() == 2 );
+			TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
+			TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
+			assert( !typeInst1 || !typeInst2 );
+			UntypedExpr *ret = 0;
+			if ( typeInst1 || typeInst2 ) {
+			    ret = new UntypedExpr( new NameExpr( "?+?" ) );
+			} // if
+			if ( typeInst1 ) {
+			    UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
+			    multiply->get_args().push_back( appExpr->get_args().back() );
+			    multiply->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
+			    ret->get_args().push_back( appExpr->get_args().front() );
+			    ret->get_args().push_back( multiply );
+			} else if ( typeInst2 ) {
+			    UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
+			    multiply->get_args().push_back( appExpr->get_args().front() );
+			    multiply->get_args().push_back( new NameExpr( typeInst2->get_name() ) );
+			    ret->get_args().push_back( multiply );
+			    ret->get_args().push_back( appExpr->get_args().back() );
+			} // if
+			if ( typeInst1 || typeInst2 ) {
+			    ret->get_results().push_front( appExpr->get_results().front()->clone() );
+			    if ( appExpr->get_env() ) {
+				ret->set_env( appExpr->get_env() );
+				appExpr->set_env( 0 );
+			    } // if
+			    appExpr->get_args().clear();
+			    delete appExpr;
+			    return ret;
+			} // if
+		    } else if ( varExpr->get_var()->get_name() == "*?" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( !appExpr->get_args().empty() );
+			if ( isPolyType( appExpr->get_results().front(), env, scopeTyVars ) ) {
+			    Expression *ret = appExpr->get_args().front();
+			    delete ret->get_results().front();
+			    ret->get_results().front() = appExpr->get_results().front()->clone();
+			    if ( appExpr->get_env() ) {
+				ret->set_env( appExpr->get_env() );
+				appExpr->set_env( 0 );
+			    } // if
+			    appExpr->get_args().clear();
+			    delete appExpr;
+			    return ret;
+			} // if
+		    } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( appExpr->get_args().size() == 1 );
+			if ( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
+			    Type *tempType = appExpr->get_results().front()->clone();
+			    if ( env ) {
+				env->apply( tempType );
+			    } // if
+			    ObjectDecl *newObj = makeTemporary( tempType );
+			    VariableExpr *tempExpr = new VariableExpr( newObj );
+			    UntypedExpr *assignExpr = new UntypedExpr( new NameExpr( "?=?" ) );
+			    assignExpr->get_args().push_back( tempExpr->clone() );
+			    if ( AddressExpr *address = dynamic_cast< AddressExpr *>( appExpr->get_args().front() ) ) {
+				assignExpr->get_args().push_back( address->get_arg()->clone() );
+			    } else {
+				assignExpr->get_args().push_back( appExpr->get_args().front()->clone() );
+			    } // if
+			    CommaExpr *firstComma = new CommaExpr( assignExpr, makeIncrDecrExpr( appExpr, typeInst->get_name(), varExpr->get_var()->get_name() == "?++" ) );
+			    return new CommaExpr( firstComma, tempExpr );
+			} // if
+		    } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( appExpr->get_args().size() == 1 );
+			if ( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
+			    return makeIncrDecrExpr( appExpr, typeInst->get_name(), varExpr->get_var()->get_name() == "++?" );
+			} // if
+		    } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( appExpr->get_args().size() == 2 );
+			TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
+			TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
+			if ( typeInst1 && typeInst2 ) {
+			    UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
+			    divide->get_args().push_back( appExpr );
+			    divide->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
+			    divide->get_results().push_front( appExpr->get_results().front()->clone() );
+			    if ( appExpr->get_env() ) {
+				divide->set_env( appExpr->get_env() );
+				appExpr->set_env( 0 );
+			    } // if
+			    return divide;
+			} else if ( typeInst1 ) {
+			    UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
+			    multiply->get_args().push_back( appExpr->get_args().back() );
+			    multiply->get_args().push_back( new NameExpr( typeInst1->get_name() ) );
+			    appExpr->get_args().back() = multiply;
+			} else if ( typeInst2 ) {
+			    UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
+			    multiply->get_args().push_back( appExpr->get_args().front() );
+			    multiply->get_args().push_back( new NameExpr( typeInst2->get_name() ) );
+			    appExpr->get_args().front() = multiply;
+			} // if
+		    } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
+			assert( !appExpr->get_results().empty() );
+			assert( appExpr->get_args().size() == 2 );
+			TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars );
+			if ( typeInst ) {
+			    UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
+			    multiply->get_args().push_back( appExpr->get_args().back() );
+			    multiply->get_args().push_back( new NameExpr( typeInst->get_name() ) );
+			    appExpr->get_args().back() = multiply;
+			} // if
+		    } // if
+		    return appExpr;
+		} // if
+	    } // if
+	    return 0;
+	}
+
+	Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
 ///     std::cerr << "mutate appExpr: ";
-///     for( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
+///     for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
 ///       std::cerr << i->first << " ";
 ///     }
 ///     std::cerr << "\n";
-  bool oldUseRetval = useRetval;
-  useRetval = false;
-  appExpr->get_function()->acceptMutator( *this );
-  mutateAll( appExpr->get_args(), *this );
-  useRetval = oldUseRetval;
-  
-  assert( !appExpr->get_function()->get_results().empty() );
-  PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
-  assert( pointer );
-  FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
-  assert( function );
-  
-  if( Expression *newExpr = handleIntrinsics( appExpr ) ) {
-    return newExpr;
-  }
-  
-  Expression *ret = appExpr;
-  
-  std::list< Expression* >::iterator arg = appExpr->get_args().begin();
-  std::list< Expression* >::iterator paramBegin = appExpr->get_args().begin();
-  
-  std::string typeName;
-  if( isPolyRet( function, typeName ) ) {
-    ret = addPolyRetParam( appExpr, function, typeName, arg );
-  } else if( needsAdapter( function, scopeTyVars ) ) {
+	    bool oldUseRetval = useRetval;
+	    useRetval = false;
+	    appExpr->get_function()->acceptMutator( *this );
+	    mutateAll( appExpr->get_args(), *this );
+	    useRetval = oldUseRetval;
+  
+	    assert( !appExpr->get_function()->get_results().empty() );
+	    PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
+	    assert( pointer );
+	    FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
+	    assert( function );
+  
+	    if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
+		return newExpr;
+	    } // if
+  
+	    Expression *ret = appExpr;
+  
+	    std::list< Expression *>::iterator arg = appExpr->get_args().begin();
+	    std::list< Expression *>::iterator paramBegin = appExpr->get_args().begin();
+  
+	    std::string typeName;
+	    if ( isPolyRet( function, typeName ) ) {
+		ret = addPolyRetParam( appExpr, function, typeName, arg );
+	    } else if ( needsAdapter( function, scopeTyVars ) ) {
 ///     std::cerr << "needs adapter: ";
-///     for( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
+///     for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
 ///       std::cerr << i->first << " ";
 ///     }
 ///     std::cerr << "\n";
-    // change the application so it calls the adapter rather than the passed function
-    ret = applyAdapter( appExpr, function, arg, scopeTyVars );
-  }
-  arg = appExpr->get_args().begin();
-  
-  TyVarMap exprTyVars;
-  makeTyVarMap( function, exprTyVars );
-  
-  passTypeVars( appExpr, arg, exprTyVars );
-  addInferredParams( appExpr, function, arg, exprTyVars );
-
-  arg = paramBegin;
-  
-  boxParams( appExpr, function, arg, exprTyVars );
-
-  passAdapters( appExpr, function, exprTyVars );
-
-  return ret;
-}
-
-Expression *
-Pass1::mutate( UntypedExpr *expr )
-{
-  if( !expr->get_results().empty() && isPolyType( expr->get_results().front(), env, scopeTyVars ) ) {
-    if( NameExpr *name = dynamic_cast< NameExpr* >( expr->get_function() ) ) {
-      if( name->get_name() == "*?" ) {
-        Expression *ret = expr->get_args().front();
-        expr->get_args().clear();
-        delete expr;
-        return ret->acceptMutator( *this );
-      }
-    }
-  }
-  return PolyMutator::mutate( expr );
-}
-
-Expression *
-Pass1::mutate( AddressExpr *addrExpr )
-{
-  assert( !addrExpr->get_arg()->get_results().empty() );
-  mutateExpression( addrExpr->get_arg() );
-  if( isPolyType( addrExpr->get_arg()->get_results().front(), env, scopeTyVars ) ) {
-    Expression *ret = addrExpr->get_arg();
-    delete ret->get_results().front();
-    ret->get_results().front() = addrExpr->get_results().front()->clone();
-    addrExpr->set_arg( 0 );
-    delete addrExpr;
-    return ret;
-  } else {
-    return addrExpr;
-  }
-}
-
-Statement* 
-Pass1::mutate(ReturnStmt *retStmt)
-{
-  // a cast expr on a polymorphic return value is either redundant or invalid
-  while( CastExpr *castExpr = dynamic_cast< CastExpr* >( retStmt->get_expr() ) ) {
-    retStmt->set_expr( castExpr->get_arg() );
-    retStmt->get_expr()->set_env( castExpr->get_env() );
-    castExpr->set_env( 0 );
-    castExpr->set_arg( 0 );
-    delete castExpr;
-  }
-  if( retval && retStmt->get_expr() ) {
-    assert( !retStmt->get_expr()->get_results().empty() );
-    if( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
+		// change the application so it calls the adapter rather than the passed function
+		ret = applyAdapter( appExpr, function, arg, scopeTyVars );
+	    } // if
+	    arg = appExpr->get_args().begin();
+  
+	    TyVarMap exprTyVars;
+	    makeTyVarMap( function, exprTyVars );
+  
+	    passTypeVars( appExpr, arg, exprTyVars );
+	    addInferredParams( appExpr, function, arg, exprTyVars );
+
+	    arg = paramBegin;
+  
+	    boxParams( appExpr, function, arg, exprTyVars );
+
+	    passAdapters( appExpr, function, exprTyVars );
+
+	    return ret;
+	}
+
+	Expression *Pass1::mutate( UntypedExpr *expr ) {
+	    if ( !expr->get_results().empty() && isPolyType( expr->get_results().front(), env, scopeTyVars ) ) {
+		if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
+		    if ( name->get_name() == "*?" ) {
+			Expression *ret = expr->get_args().front();
+			expr->get_args().clear();
+			delete expr;
+			return ret->acceptMutator( *this );
+		    } // if
+		} // if
+	    } // if
+	    return PolyMutator::mutate( expr );
+	}
+
+	Expression *Pass1::mutate( AddressExpr *addrExpr ) {
+	    assert( !addrExpr->get_arg()->get_results().empty() );
+	    mutateExpression( addrExpr->get_arg() );
+	    if ( isPolyType( addrExpr->get_arg()->get_results().front(), env, scopeTyVars ) ) {
+		Expression *ret = addrExpr->get_arg();
+		delete ret->get_results().front();
+		ret->get_results().front() = addrExpr->get_results().front()->clone();
+		addrExpr->set_arg( 0 );
+		delete addrExpr;
+		return ret;
+	    } else {
+		return addrExpr;
+	    } // if
+	}
+
+	Statement *
+	Pass1::mutate(ReturnStmt *retStmt) {
+	    // a cast expr on a polymorphic return value is either redundant or invalid
+	    while ( CastExpr *castExpr = dynamic_cast< CastExpr *>( retStmt->get_expr() ) ) {
+		retStmt->set_expr( castExpr->get_arg() );
+		retStmt->get_expr()->set_env( castExpr->get_env() );
+		castExpr->set_env( 0 );
+		castExpr->set_arg( 0 );
+		delete castExpr;
+	    }
+	    if ( retval && retStmt->get_expr() ) {
+		assert( !retStmt->get_expr()->get_results().empty() );
+		if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
 ///       retStmt->set_expr( mutateExpression( retStmt->get_expr() ) );
-      TypeInstType *typeInst = dynamic_cast< TypeInstType* >( retval->get_type() );
-      assert( typeInst );
-      std::map< std::string, DeclarationWithType* >::const_iterator assignIter = assignOps.find( typeInst->get_name() );
-      if( assignIter == assignOps.end() ) {
-        throw SemanticError( "Attempt to return dtype or ftype object in ", retStmt->get_expr() );
-      }
-      ApplicationExpr *assignExpr = new ApplicationExpr( new VariableExpr( assignIter->second ) );
-      Expression *retParm = new NameExpr( retval->get_name() );
-      retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
-      assignExpr->get_args().push_back( retParm );
-      assignExpr->get_args().push_back( retStmt->get_expr() );
-      stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( assignExpr ) ) );
-    } else {
-      useRetval = true;
-      stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( retStmt->get_expr() ) ) );
-      useRetval = false;
-    }
-    retStmt->set_expr( 0 );
-  } else {
-    retStmt->set_expr( mutateExpression( retStmt->get_expr() ) );
-  }
-  return retStmt;
-}
-
-Type* 
-Pass1::mutate( PointerType *pointerType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( pointerType, scopeTyVars );
-  
-  Type* ret = Mutator::mutate( pointerType );
-  
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-Type* 
-Pass1::mutate( FunctionType *functionType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( functionType, scopeTyVars );
-  
-  Type* ret = Mutator::mutate( functionType );
-  
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-void
-Pass1::doEndScope()
-{
-  adapters.clear();
-}
+		    TypeInstType *typeInst = dynamic_cast< TypeInstType *>( retval->get_type() );
+		    assert( typeInst );
+		    std::map< std::string, DeclarationWithType *>::const_iterator assignIter = assignOps.find( typeInst->get_name() );
+		    if ( assignIter == assignOps.end() ) {
+			throw SemanticError( "Attempt to return dtype or ftype object in ", retStmt->get_expr() );
+		    } // if
+		    ApplicationExpr *assignExpr = new ApplicationExpr( new VariableExpr( assignIter->second ) );
+		    Expression *retParm = new NameExpr( retval->get_name() );
+		    retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
+		    assignExpr->get_args().push_back( retParm );
+		    assignExpr->get_args().push_back( retStmt->get_expr() );
+		    stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( assignExpr ) ) );
+		} else {
+		    useRetval = true;
+		    stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( retStmt->get_expr() ) ) );
+		    useRetval = false;
+		} // if
+		retStmt->set_expr( 0 );
+	    } else {
+		retStmt->set_expr( mutateExpression( retStmt->get_expr() ) );
+	    } // if
+	    return retStmt;
+	}
+
+	Type *
+	Pass1::mutate( PointerType *pointerType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( pointerType, scopeTyVars );
+  
+	    Type *ret = Mutator::mutate( pointerType );
+  
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	Type *
+	Pass1::mutate( FunctionType *functionType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( functionType, scopeTyVars );
+  
+	    Type *ret = Mutator::mutate( functionType );
+  
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	void Pass1::doEndScope() {
+	    adapters.clear();
+	}
 
 ////////////////////////////////////////// Pass2 ////////////////////////////////////////////////////
 
-Pass2::Pass2()
-{
-}
-
-void 
-Pass2::addAdapters( FunctionType *functionType )
-{
-  std::list< DeclarationWithType* > &paramList = functionType->get_parameters();
-  std::list< FunctionType* > functions;
-  for( std::list< DeclarationWithType* >::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
-    Type *orig = (*arg)->get_type();
-    findAndReplaceFunction( orig, functions, scopeTyVars, needsAdapter );
-    (*arg)->set_type( orig );
-  }
-  std::set< std::string > adaptersDone;
-  for( std::list< FunctionType* >::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
-    std::string mangleName = SymTab::Mangler::mangle( *funType );
-    if( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
-      paramList.push_front( new ObjectDecl( "_adapter" + mangleName, Declaration::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
-      adaptersDone.insert( adaptersDone.begin(), mangleName );
-    }
-  }
+	Pass2::Pass2() {}
+
+	void Pass2::addAdapters( FunctionType *functionType ) {
+	    std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
+	    std::list< FunctionType *> functions;
+	    for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
+		Type *orig = (*arg)->get_type();
+		findAndReplaceFunction( orig, functions, scopeTyVars, needsAdapter );
+		(*arg)->set_type( orig );
+	    }
+	    std::set< std::string > adaptersDone;
+	    for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
+		std::string mangleName = SymTab::Mangler::mangle( *funType );
+		if ( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
+		    paramList.push_front( new ObjectDecl( "_adapter" + mangleName, Declaration::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
+		    adaptersDone.insert( adaptersDone.begin(), mangleName );
+		}
+	    }
 ///  deleteAll( functions );
-}
-
-template< typename DeclClass >
-DeclClass* 
-Pass2::handleDecl( DeclClass *decl, Type *type )
-{
-  DeclClass *ret = static_cast< DeclClass* >( Mutator::mutate( decl ) );
-
-  return ret;
-}
-
-DeclarationWithType* 
-Pass2::mutate( FunctionDecl *functionDecl )
-{
-  return handleDecl( functionDecl, functionDecl->get_functionType() );
-}
-
-ObjectDecl* 
-Pass2::mutate( ObjectDecl *objectDecl )
-{
-  return handleDecl( objectDecl, objectDecl->get_type() );
-}
-
-TypeDecl* 
-Pass2::mutate( TypeDecl *typeDecl )
-{
-  scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
-  if( typeDecl->get_base() ) {
-    return handleDecl( typeDecl, typeDecl->get_base() );
-  } else {
-    return Mutator::mutate( typeDecl );
-  }
-}
-
-TypedefDecl* 
-Pass2::mutate( TypedefDecl *typedefDecl )
-{
-  return handleDecl( typedefDecl, typedefDecl->get_base() );
-}
-
-Type* 
-Pass2::mutate( PointerType *pointerType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( pointerType, scopeTyVars );
-  
-  Type* ret = Mutator::mutate( pointerType );
-  
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-Type *
-Pass2::mutate( FunctionType *funcType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( funcType, scopeTyVars );
-  
-  std::string typeName;
-  if( isPolyRet( funcType, typeName ) ) {
-    DeclarationWithType *ret = funcType->get_returnVals().front();
-    ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
-    funcType->get_parameters().push_front( ret );
-    funcType->get_returnVals().pop_front();
-  }
-  
-  std::list< DeclarationWithType* >::iterator last = funcType->get_parameters().begin();
-  std::list< DeclarationWithType* > inferredParams;
-  ObjectDecl *newObj = new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
+	}
+
+	template< typename DeclClass >
+	DeclClass *
+	Pass2::handleDecl( DeclClass *decl, Type *type ) {
+	    DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
+
+	    return ret;
+	}
+
+	DeclarationWithType *
+	Pass2::mutate( FunctionDecl *functionDecl ) {
+	    return handleDecl( functionDecl, functionDecl->get_functionType() );
+	}
+
+	ObjectDecl *
+	Pass2::mutate( ObjectDecl *objectDecl ) {
+	    return handleDecl( objectDecl, objectDecl->get_type() );
+	}
+
+	TypeDecl *
+	Pass2::mutate( TypeDecl *typeDecl ) {
+	    scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
+	    if ( typeDecl->get_base() ) {
+		return handleDecl( typeDecl, typeDecl->get_base() );
+	    } else {
+		return Mutator::mutate( typeDecl );
+	    }
+	}
+
+	TypedefDecl *
+	Pass2::mutate( TypedefDecl *typedefDecl ) {
+	    return handleDecl( typedefDecl, typedefDecl->get_base() );
+	}
+
+	Type *
+	Pass2::mutate( PointerType *pointerType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( pointerType, scopeTyVars );
+  
+	    Type *ret = Mutator::mutate( pointerType );
+  
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	Type *Pass2::mutate( FunctionType *funcType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( funcType, scopeTyVars );
+  
+	    std::string typeName;
+	    if ( isPolyRet( funcType, typeName ) ) {
+		DeclarationWithType *ret = funcType->get_returnVals().front();
+		ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
+		funcType->get_parameters().push_front( ret );
+		funcType->get_returnVals().pop_front();
+	    }
+  
+	    std::list< DeclarationWithType *>::iterator last = funcType->get_parameters().begin();
+	    std::list< DeclarationWithType *> inferredParams;
+	    ObjectDecl *newObj = new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
 ///   ObjectDecl *newFunPtr = new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );
-  for( std::list< TypeDecl* >::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
-    ObjectDecl *thisParm;
-    if( (*tyParm)->get_kind() == TypeDecl::Any ) {
-      thisParm = newObj->clone();
-      thisParm->set_name( (*tyParm)->get_name() );
-      last = funcType->get_parameters().insert( last, thisParm );
-      ++last;
-    }
-    for( std::list< DeclarationWithType* >::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
-///       *assert = (*assert)->acceptMutator( *this );
-      inferredParams.push_back( *assert );
-    }
-    (*tyParm)->get_assertions().clear();
-  }
-  delete newObj;
-  funcType->get_parameters().splice( last, inferredParams );
-  addAdapters( funcType );
-  mutateAll( funcType->get_returnVals(), *this );
-  mutateAll( funcType->get_parameters(), *this );
-  
-  scopeTyVars = oldtyVars;
-  return funcType;
-}
+	    for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
+		ObjectDecl *thisParm;
+		if ( (*tyParm)->get_kind() == TypeDecl::Any ) {
+		    thisParm = newObj->clone();
+		    thisParm->set_name( (*tyParm)->get_name() );
+		    last = funcType->get_parameters().insert( last, thisParm );
+		    ++last;
+		}
+		for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
+///      *assert = (*assert)->acceptMutator( *this );
+		    inferredParams.push_back( *assert );
+		}
+		(*tyParm)->get_assertions().clear();
+	    }
+	    delete newObj;
+	    funcType->get_parameters().splice( last, inferredParams );
+	    addAdapters( funcType );
+	    mutateAll( funcType->get_returnVals(), *this );
+	    mutateAll( funcType->get_parameters(), *this );
+  
+	    scopeTyVars = oldtyVars;
+	    return funcType;
+	}
 
 ////////////////////////////////////////// Pass3 ////////////////////////////////////////////////////
 
-template< typename DeclClass >
-DeclClass* 
-Pass3::handleDecl( DeclClass *decl, Type *type )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( type, scopeTyVars );
-  
-  DeclClass *ret = static_cast< DeclClass* >( Mutator::mutate( decl ) );
-  ScrubTyVars::scrub( decl, scopeTyVars );
-
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-ObjectDecl* 
-Pass3::mutate( ObjectDecl *objectDecl )
-{
-  return handleDecl( objectDecl, objectDecl->get_type() );
-}
-
-DeclarationWithType* 
-Pass3::mutate( FunctionDecl *functionDecl )
-{
-  return handleDecl( functionDecl, functionDecl->get_functionType() );
-}
-
-TypedefDecl* 
-Pass3::mutate( TypedefDecl *typedefDecl )
-{
-  return handleDecl( typedefDecl, typedefDecl->get_base() );
-}
-
-TypeDecl* 
-Pass3::mutate( TypeDecl *typeDecl )
-{
+	template< typename DeclClass >
+	DeclClass *
+	Pass3::handleDecl( DeclClass *decl, Type *type ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( type, scopeTyVars );
+  
+	    DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
+	    ScrubTyVars::scrub( decl, scopeTyVars );
+
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	ObjectDecl *
+	Pass3::mutate( ObjectDecl *objectDecl ) {
+	    return handleDecl( objectDecl, objectDecl->get_type() );
+	}
+
+	DeclarationWithType *
+	Pass3::mutate( FunctionDecl *functionDecl ) {
+	    return handleDecl( functionDecl, functionDecl->get_functionType() );
+	}
+
+	TypedefDecl *
+	Pass3::mutate( TypedefDecl *typedefDecl ) {
+	    return handleDecl( typedefDecl, typedefDecl->get_base() );
+	}
+
+	TypeDecl *
+	Pass3::mutate( TypeDecl *typeDecl ) {
 ///   Initializer *init = 0;
 ///   std::list< Expression *> designators;
 ///   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
-///   if( typeDecl->get_base() ) {
+///   if ( typeDecl->get_base() ) {
 ///     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
 ///   }
 ///   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
 
-  scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
-  return Mutator::mutate( typeDecl );
-}
-
-Type* 
-Pass3::mutate( PointerType *pointerType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( pointerType, scopeTyVars );
-  
-  Type* ret = Mutator::mutate( pointerType );
-  
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-Type* 
-Pass3::mutate( FunctionType *functionType )
-{
-  TyVarMap oldtyVars = scopeTyVars;
-  makeTyVarMap( functionType, scopeTyVars );
-  
-  Type* ret = Mutator::mutate( functionType );
-  
-  scopeTyVars = oldtyVars;
-  return ret;
-}
-
-Statement*
-Pass3::mutate( DeclStmt *declStmt )
-{
-  if( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl* >( declStmt->get_decl() ) ) {
-    if( isPolyVal( objectDecl->get_type(), scopeTyVars ) ) {
-      TypeInstType *typeInst = dynamic_cast< TypeInstType* >( objectDecl->get_type() );
-      assert( typeInst );
-      UntypedExpr *alloc = new UntypedExpr( new NameExpr( "alloca" ) );
-      alloc->get_args().push_back( new NameExpr( typeInst->get_name() ) );
-      UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
-      assign->get_args().push_back( new VariableExpr( objectDecl ) );
-      assign->get_args().push_back( alloc );
-      stmtsToAddAfter.push_back( new ExprStmt( noLabels, assign ) );
-    }
-  }
-  return Mutator::mutate( declStmt );
-}
+	    scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
+	    return Mutator::mutate( typeDecl );
+	}
+
+	Type *
+	Pass3::mutate( PointerType *pointerType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( pointerType, scopeTyVars );
+  
+	    Type *ret = Mutator::mutate( pointerType );
+  
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	Type *
+	Pass3::mutate( FunctionType *functionType ) {
+	    TyVarMap oldtyVars = scopeTyVars;
+	    makeTyVarMap( functionType, scopeTyVars );
+  
+	    Type *ret = Mutator::mutate( functionType );
+  
+	    scopeTyVars = oldtyVars;
+	    return ret;
+	}
+
+	Statement *Pass3::mutate( DeclStmt *declStmt ) {
+	    if ( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl *>( declStmt->get_decl() ) ) {
+		if ( isPolyVal( objectDecl->get_type(), scopeTyVars ) ) {
+		    TypeInstType *typeInst = dynamic_cast< TypeInstType *>( objectDecl->get_type() );
+		    assert( typeInst );
+		    UntypedExpr *alloc = new UntypedExpr( new NameExpr( "alloca" ) );
+		    alloc->get_args().push_back( new NameExpr( typeInst->get_name() ) );
+		    UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
+		    assign->get_args().push_back( new VariableExpr( objectDecl ) );
+		    assign->get_args().push_back( alloc );
+		    stmtsToAddAfter.push_back( new ExprStmt( noLabels, assign ) );
+		}
+	    }
+	    return Mutator::mutate( declStmt );
+	}
     
-} // anonymous namespace
+    } // anonymous namespace
 
 } // namespace GenPoly
Index: translator/Parser/TypeData.cc
===================================================================
--- translator/Parser/TypeData.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/Parser/TypeData.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -696,4 +696,10 @@
 	    } else {
 		switch ( ret ) {
+		  case BasicType::LongLongSignedInt:	// PAB
+		    ret = BasicType::LongLongUnsignedInt;
+		    break;
+		  case BasicType::LongSignedInt:
+		    ret = BasicType::LongUnsignedInt;
+		    break;
 		  case BasicType::SignedInt:
 		  case BasicType::ShortSignedInt:
@@ -715,4 +721,7 @@
 	    } else {
 		switch ( ret ) {
+		  case BasicType::LongLongSignedInt:	// PAB
+		    ret = BasicType::LongLongUnsignedInt;
+		    break;
 		  case BasicType::LongSignedInt:
 		    ret = BasicType::LongUnsignedInt;
Index: translator/Parser/cfa.y
===================================================================
--- translator/Parser/cfa.y	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/Parser/cfa.y	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -10,24 +10,24 @@
  * Created On       : Sat Sep  1 20:22:55 2001
  * Last Modified By : Peter A. Buhr
- * Last Modified On : Wed Jan  7 09:19:57 2015
- * Update Count     : 906
+ * Last Modified On : Sat Jan 17 09:23:45 2015
+ * Update Count     : 908
  */
 
-/* This grammar is based on the ANSI99 C grammar, specifically parts of EXPRESSION and STATEMENTS, and on the
-   C grammar by James A. Roskind, specifically parts of DECLARATIONS and EXTERNAL DEFINITIONS.  While parts
-   have been copied, important changes have been made in all sections; these changes are sufficient to
+/* This grammar is based on the ANSI99/11 C grammar, specifically parts of EXPRESSION and STATEMENTS, and on
+   the C grammar by James A. Roskind, specifically parts of DECLARATIONS and EXTERNAL DEFINITIONS.  While
+   parts have been copied, important changes have been made in all sections; these changes are sufficient to
    constitute a new grammar.  In particular, this grammar attempts to be more syntactically precise, i.e., it
    parses less incorrect language syntax that must be subsequently rejected by semantic checks.  Nevertheless,
-   there are still several semantic checks required and many are noted in the grammar. Finally, the grammar
-   is extended with GCC and CFA language extensions. */
+   there are still several semantic checks required and many are noted in the grammar. Finally, the grammar is
+   extended with GCC and CFA language extensions. */
 
 /* Acknowledgments to Richard Bilson, Glen Ditchfield, and Rodolfo Gabriel Esteves who all helped when I got
    stuck with the grammar. */
 
-/* The root language for this grammar is ANSI99 C. All of ANSI99 is parsed, except for:
+/* The root language for this grammar is ANSI99/11 C. All of ANSI99/11 is parsed, except for:
 
    1. designation with '=' (use ':' instead)
 
-   Most of the syntactic extensions from ANSI90 to ANSI99 C are marked with the comment "ANSI99". This grammar
+   Most of the syntactic extensions from ANSI90 to ANSI11 C are marked with the comment "C99/C11". This grammar
    also has two levels of extensions. The first extensions cover most of the GCC C extensions, except for:
 
@@ -40,5 +40,5 @@
    Cforall (CFA), which fixes several of C's outstanding problems and extends C with many modern language
    concepts. All of the syntactic extensions for CFA C are marked with the comment "CFA". As noted above,
-   there is one unreconcileable parsing problem between ANSI99 and CFA with respect to designators; this is
+   there is one unreconcileable parsing problem between C99 and CFA with respect to designators; this is
    discussed in detail before the "designation" grammar rule. */
 
@@ -67,19 +67,20 @@
 %token TYPEDEF
 %token AUTO EXTERN REGISTER STATIC
-%token INLINE						/* ANSI99 */
-%token FORTRAN						/* ANSI99, extension ISO/IEC 9899:1999 Section J.5.9(1) */
+%token INLINE						/* C99 */
+%token FORTRAN						/* C99, extension ISO/IEC 9899:1999 Section J.5.9(1) */
 %token CONST VOLATILE
-%token RESTRICT						/* ANSI99 */
+%token RESTRICT						/* C99 */
 %token FORALL LVALUE					/* CFA */
 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
-%token BOOL COMPLEX IMAGINARY				/* ANSI99 */
+%token BOOL COMPLEX IMAGINARY				/* C99 */
 %token TYPEOF LABEL					/* GCC */
 %token ENUM STRUCT UNION
 %token TYPE FTYPE DTYPE CONTEXT				/* CFA */
 %token SIZEOF
-%token ALIGNOF ATTRIBUTE EXTENSION			/* GCC */
+%token ATTRIBUTE EXTENSION				/* GCC */
 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
 %token CHOOSE FALLTHRU TRY CATCH FINALLY THROW		/* CFA */
-%token ASM						/* ANSI99, extension ISO/IEC 9899:1999 Section J.5.10(1) */
+%token ASM						/* C99, extension ISO/IEC 9899:1999 Section J.5.10(1) */
+%token ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATICASSERT THREADLOCAL /* C11 */
 
 /* names and constants: lexer differentiates between identifier and typedef names */
@@ -362,5 +363,5 @@
 		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::DecrPost), $1); }
 		/* GCC has priority: cast_expression */
-	| '(' type_name_no_function ')' '{' initializer_list comma_opt '}' /* ANSI99 */
+	| '(' type_name_no_function ')' '{' initializer_list comma_opt '}' /* C99 */
 		{ $$ = 0; }
 	;
@@ -642,9 +643,9 @@
 	  push push
 	  label_declaration_opt				/* GCC, local labels */
-	  block_item_list pop '}'			/* ANSI99, intermix declarations and statements */
+	  block_item_list pop '}'			/* C99, intermix declarations and statements */
 		{ $$ = new CompoundStmtNode( $5 ); }
 	;
 
-block_item_list:					/* ANSI99 */
+block_item_list:					/* C99 */
 	block_item
 	| block_item_list push block_item
@@ -773,5 +774,5 @@
 	comma_expression_opt pop ';' comma_expression_opt ';' comma_expression_opt
 						{ $$ = new ForCtlExprNode($1, $4, $6); }
-	| declaration comma_expression_opt ';' comma_expression_opt /* ANSI99 */
+	| declaration comma_expression_opt ';' comma_expression_opt /* C99 */
 		/* Like C++, the loop index can be declared local to the loop. */
 						{ $$ = new ForCtlExprNode($1, $2, $4); }
@@ -1244,8 +1245,8 @@
 	| STATIC
 		{ $$ = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
-	| INLINE					/* ANSI99 */
+	| INLINE					/* C99 */
 		/* INLINE is essentially a storage class specifier for functions, and hence, belongs here. */
 		{ $$ = DeclarationNode::newStorageClass( DeclarationNode::Inline ); }
-	| FORTRAN					/* ANSI99 */
+	| FORTRAN					/* C99 */
 		{ $$ = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
 	;
@@ -1270,9 +1271,9 @@
 	| VOID
 		{ $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
-	| BOOL						/* ANSI99 */
+	| BOOL						/* C99 */
 		{ $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
-	| COMPLEX					/* ANSI99 */
+	| COMPLEX					/* C99 */
 		{ $$ = DeclarationNode::newBasicType( DeclarationNode::Complex ); }
-	| IMAGINARY					/* ANSI99 */
+	| IMAGINARY					/* C99 */
 		{ $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
 	;
@@ -1642,5 +1643,5 @@
 	;
 
-/* There is an unreconcileable parsing problem between ANSI99 and CFA with respect to designators. The problem
+/* There is an unreconcileable parsing problem between C99 and CFA with respect to designators. The problem
    is use of '=' to separator the designator from the initializer value, as in:
 
@@ -1653,10 +1654,10 @@
 
 designation:
-	designator_list ':'				/* ANSI99, CFA uses ":" instead of "=" */
+	designator_list ':'				/* C99, CFA uses ":" instead of "=" */
 	| no_attr_identifier_or_typedef_name ':'	/* GCC, field name */
 							{ $$ = new VarRefNode( $1 ); }
 	;
 
-designator_list:					/* ANSI99 */
+designator_list:					/* C99 */
 	designator
 	| designator_list designator			{ $$ = (ExpressionNode *)($1->set_link( $2 )); }
@@ -1664,7 +1665,7 @@
 
 designator:
-	'.' no_attr_identifier_or_typedef_name		/* ANSI99, field name */
+	'.' no_attr_identifier_or_typedef_name		/* C99, field name */
 							{ $$ = new VarRefNode( $2 ); }
-	| '[' push assignment_expression pop ']'	/* ANSI99, single array element */
+	| '[' push assignment_expression pop ']'	/* C99, single array element */
 		/* assignment_expression used instead of constant_expression because of shift/reduce conflicts
 		   with tuple. */
@@ -2257,5 +2258,5 @@
 
 /* This pattern parses a declaration for a parameter variable or function prototype that is not redefining a
-   typedef name and allows the ANSI99 array options, which can only appear in a parameter list.  The pattern
+   typedef name and allows the C99 array options, which can only appear in a parameter list.  The pattern
    precludes declaring an array of functions versus a pointer to an array of functions, and returning arrays
    and functions versus pointers to arrays and functions. */
@@ -2303,5 +2304,5 @@
 	int f( int foo ); // redefine typedef name in new scope
 
-   and allows the ANSI99 array options, which can only appear in a parameter list.  In addition, the pattern
+   and allows the C99 array options, which can only appear in a parameter list.  In addition, the pattern
    handles the special meaning of parenthesis around a typedef name:
 
@@ -2420,9 +2421,9 @@
 	'[' push assignment_expression pop ']'
 		{ $$ = DeclarationNode::newArray( $3, 0, false ); }
-	| '[' push '*' pop ']'				/* ANSI99 */
+	| '[' push '*' pop ']'				/* C99 */
 		{ $$ = DeclarationNode::newVarArray( 0 ); }
 	| multi_array_dimension '[' push assignment_expression pop ']'
 		{ $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }
-	| multi_array_dimension '[' push '*' pop ']'	/* ANSI99 */
+	| multi_array_dimension '[' push '*' pop ']'	/* C99 */
 		{ $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); }
 	;
@@ -2493,5 +2494,5 @@
 		{ $$ = DeclarationNode::newArray( 0, 0, false ); }
 	// multi_array_dimension handles the '[' '*' ']' case
-	| '[' push type_qualifier_list '*' pop ']'	/* remaining ANSI99 */
+	| '[' push type_qualifier_list '*' pop ']'	/* remaining C99 */
 		{ $$ = DeclarationNode::newVarArray( $3 ); }
 	| '[' push type_qualifier_list pop ']'
@@ -2551,5 +2552,5 @@
 
 /* This pattern parses a new-style declaration for a parameter variable or function prototype that is either
-   an identifier or typedef name and allows the ANSI99 array options, which can only appear in a parameter
+   an identifier or typedef name and allows the C99 array options, which can only appear in a parameter
    list. */
 
@@ -2607,5 +2608,5 @@
 
 new_array_parameter_1st_dimension:
-	'[' push type_qualifier_list '*' pop ']'	/* remaining ANSI99 */
+	'[' push type_qualifier_list '*' pop ']'	/* remaining C99 */
 		{ $$ = DeclarationNode::newVarArray( $3 ); }
 	| '[' push type_qualifier_list assignment_expression pop ']'
Index: translator/Parser/lex.l
===================================================================
--- translator/Parser/lex.l	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/Parser/lex.l	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -10,6 +10,6 @@
  * Created On       : Sat Sep 22 08:58:10 2001
  * Last Modified By : Peter A. Buhr
- * Last Modified On : Wed Dec  3 13:37:52 2014
- * Update Count     : 317
+ * Last Modified On : Sat Jan 17 09:15:03 2015
+ * Update Count     : 318
  */
 
@@ -180,4 +180,6 @@
 
 	/* keywords */
+_Alignas		{ KEYWORD_RETURN(ALIGNAS); }	// C11
+_Alignof		{ KEYWORD_RETURN(ALIGNOF); }	// C11
 __alignof		{ KEYWORD_RETURN(ALIGNOF); }	// GCC
 __alignof__		{ KEYWORD_RETURN(ALIGNOF); }	// GCC
@@ -185,4 +187,5 @@
 __asm			{ KEYWORD_RETURN(ASM); }	// GCC
 __asm__			{ KEYWORD_RETURN(ASM); }	// GCC
+_Atomic			{ KEYWORD_RETURN(ATOMIC); }	// C11
 __attribute		{ KEYWORD_RETURN(ATTRIBUTE); }	// GCC
 __attribute__		{ KEYWORD_RETURN(ATTRIBUTE); }	// GCC
@@ -217,4 +220,5 @@
 fortran			{ KEYWORD_RETURN(FORTRAN); }
 ftype			{ KEYWORD_RETURN(FTYPE); }	// CFA
+_Generic		{ KEYWORD_RETURN(GENERIC); }	// C11
 goto			{ KEYWORD_RETURN(GOTO); }
 if			{ KEYWORD_RETURN(IF); }
@@ -229,4 +233,5 @@
 long			{ KEYWORD_RETURN(LONG); }
 lvalue			{ KEYWORD_RETURN(LVALUE); }	// CFA
+_Noreturn		{ KEYWORD_RETURN(NORETURN); }	// C11
 register		{ KEYWORD_RETURN(REGISTER); }
 restrict		{ KEYWORD_RETURN(RESTRICT); }	// C99
@@ -240,6 +245,8 @@
 sizeof			{ KEYWORD_RETURN(SIZEOF); }
 static			{ KEYWORD_RETURN(STATIC); }
+_Static_assert		{ KEYWORD_RETURN(STATICASSERT); } // C11
 struct			{ KEYWORD_RETURN(STRUCT); }
 switch			{ KEYWORD_RETURN(SWITCH); }
+_Thread_local		{ KEYWORD_RETURN(THREADLOCAL); } // C11
 throw			{ KEYWORD_RETURN(THROW); }	// CFA
 try			{ KEYWORD_RETURN(TRY); }	// CFA
Index: translator/ResolvExpr/Resolver.cc
===================================================================
--- translator/ResolvExpr/Resolver.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/ResolvExpr/Resolver.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -246,9 +246,25 @@
 	    singleInit->set_value( newExpr );
 	} // if
-	singleInit->get_value()->accept( *this );
+//	singleInit->get_value()->accept( *this );
     }
 
     void Resolver::visit( ListInit *listInit ) {
-	// no cast necessary
+	if ( ArrayType *at = dynamic_cast<ArrayType*>(initContext) ) {
+	    initContext = at->get_base();
+	    Visitor::visit( listInit );
+	} else if ( StructInstType *st = dynamic_cast<StructInstType*>(initContext) ) {
+	    StructDecl *baseStruct = st->get_baseStruct();
+	    std::list<Declaration *>::iterator iter1( baseStruct->get_members().begin() );
+	    std::list<Initializer *>::iterator iter2( listInit->begin_initializers() );
+	    for ( ; iter1 != baseStruct->get_members().end() && iter2 != listInit->end_initializers() ; ++iter1, ++iter2 ) {
+		DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *iter1 );
+		initContext = dt->get_type();
+		(*iter2)->accept( *this );
+	    }
+	} else if ( UnionInstType *st = dynamic_cast<UnionInstType*>(initContext) ) {
+	    DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *st->get_baseUnion()->get_members().begin() );
+	    initContext = dt->get_type();
+	    (*listInit->begin_initializers())->accept( *this );
+	} // if
     }
 } // namespace ResolvExpr
Index: translator/SymTab/Validate.cc
===================================================================
--- translator/SymTab/Validate.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/SymTab/Validate.cc	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -468,5 +468,6 @@
     template< typename OutputIterator >
     void makeScalarAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, DeclarationWithType *member, OutputIterator out ) {
-	ObjectDecl *obj = dynamic_cast<ObjectDecl *>( member ); // PAB: unnamed bit fields are not copied
+	ObjectDecl *obj = dynamic_cast<ObjectDecl *>( member );
+	// unnamed bit fields are not copied as they cannot be accessed
 	if ( obj != NULL && obj->get_name() == "" && obj->get_bitfieldWidth() != NULL ) return;
 
Index: translator/SynTree/Makefile
===================================================================
--- translator/SynTree/Makefile	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/SynTree/Makefile	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -2,5 +2,5 @@
 CXXFLAGS=-g -Wall #-Wno-unused
 
-SRCS:=Type.cc Constant.cc Expression.cc Statement.cc CodeGenVisitor.cc translate.cc
+SRCS:=Type.cc Constant.cc Expression.cc Statement.cc CodeGenVisitor.cc
 OBJECTS:=$(SRCS:.cc=.o)
 DEPS:=$(SRCS:.cc=.d)
Index: anslator/SynTree/translate.cc
===================================================================
--- translator/SynTree/translate.cc	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ 	(revision )
@@ -1,158 +1,0 @@
-#include "translate.h"
-#include "../Parser/ParseNode.h"
-
-
-#include "Statement.h"
-#include "Expression.h"
-#include "Constant.h"
-#include "Type.h"
-
-int translate_driver(ParseNode *pn){
-    // in effect, this function is a visitor of sorts
-
-    if (pn == 0)
-	exit(1);
-
-    /* Type switching considered harmful */
-
-    switch(pn->what_kind()){
-    case ParseNode::Statement:
-	translate((StatementNode *)pn);
-	break;
-    case ParseNode::Expression:
-	translate((ExpressionNode *)pn);
-	break;
-    default:
-	translate(pn);
-	break;
-    }
-
-    return 0;
-}
-
-Expression *translate(ExpressionNode *en){
-    Expression *expr;
-
-    switch(en->what_kind()){
-    case ParseNode::CompositeExpression:
-	break;
-    case ParseNode::Constant:
-	expr = translate((ConstantNode *)en);
-	break;
-    case ParseNode::VarRef:
-	cout << "It's a varref" << endl;
-	break;
-    case ParseNode::Operator:
-	cout << "It's an operator" << endl;
-	break;
-    default:
-	break;
-    }
-
-    return expr;
-}
-
-Statement *translate(StatementNode *sn){
-    Statement *stmt = 0;
-
-    switch(sn->get_type()){
-    case StatementNode::Exp:
-	translate(sn->get_control());
-	break;
-    case StatementNode::If:
-	cout << "if" << endl;
-	translate(sn->get_control());
-	break;
-    case StatementNode::Switch:
-	cout << "switch" << endl;
-	break;
-    case StatementNode::Case:
-	cout << "case" << endl;
-	break;
-    case StatementNode::Default:
-	cout << "default" << endl;
-	break;
-    case StatementNode::Choose:
-	cout << "choose" << endl;
-	break;
-    case StatementNode::Fallthru:
-	cout << "fallthru" << endl;
-	break;
-    case StatementNode::While:
-	cout << "while" << endl;
-	break;
-    case StatementNode::Do:
-	cout << "do" << endl;
-	break;
-    case StatementNode::For:
-	cout << "for" << endl;
-	break;
-    case StatementNode::Goto:
-	cout << "goto" << endl;
-	break;
-    case StatementNode::Continue:
-	cout << "continue" << endl;
-	break;
-    case StatementNode::Break:
-	cout << "break" << endl;
-	break;
-    case StatementNode::Return:
-	cout << "return" << endl;
-	break;
-    case StatementNode::Throw:
-	cout << "throw" << endl;
-	break;
-    case StatementNode::Try:
-	cout << "try" << endl;
-	break;
-    case StatementNode::Catch:
-	cout << "catch" << endl;
-	break;
-    case StatementNode::Asm:
-	cout << "asm" << endl;
-	break;
-    default:
-	break;
-    }
-
-    return stmt;
-}
-
-ConstantExpr *translate(ConstantNode *cn){
-    ConstantExpr *cnst;
-    BasicType::Kind knd;
-
-    struct Type::Qualifiers tq = {0,0,0};
-    struct BasicType::Modifiers tm = {0,0,0,0};
-
-    switch(cn->get_type()){
-    case ConstantNode::Integer:
-	knd = BasicType::Int;
-	break;
-    case ConstantNode::Float:
-	knd = BasicType::Float;
-	break;
-    case ConstantNode::Character:
-	knd = BasicType::Char;
-	break;
-    case ConstantNode::String:
-	break;
-    default:
-	break;
-    }
-
-    Constant *c = new Constant(new BasicType(tq,tm,knd), cn->get_name());
-    cnst = new ConstantExpr(*c);
-
-    return cnst;
-}
-
-Expression *translate(CompositeExprNode *ce){
-    return 0;
-}
-
-int translate(ParseNode *pn){
-    cout << "In translate - parsenode" << endl;
-
-    return 0;
-}
Index: anslator/SynTree/translate.h
===================================================================
--- translator/SynTree/translate.h	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#ifndef __TRANSLATE_H_
-#define __TRANSLATE_H_
-
-#include "SynTree.h"
-#include "../Parser/ParseNode.h"
-
-int translate_driver(ParseNode *);
-int translate(ParseNode *);
-Expression *translate(ExpressionNode *);
-Expression *translate(CompositeExprNode *);
-ConstantExpr *translate(ConstantNode *);
-Statement *translate(StatementNode *);
-
-#endif	/* #define __TRANSLATE_H_ */
Index: translator/examples/includes.c
===================================================================
--- translator/examples/includes.c	(revision 0b8cd7227c65b28513877765de7302e28eefbb6f)
+++ translator/examples/includes.c	(revision 6c3744ea42a3b5b7c0caad3216f7a909daf8e9ed)
@@ -1,7 +1,14 @@
-#if 0
+#if 1
+//#include <aio.h>		// FAILS -- includes locale.h
+#include <aliases.h>
 #include <alloca.h>
+#include <ansidecl.h>
+#include <ar.h>
+//#include <argp.h>		// FAILS -- includes locale.h
+//#include <argz.h>		// FAILS -- includes locale.h
 #include <assert.h>
+#include <bfd.h>		// contains structure field "type"
 #include <complex.h>
-//#include <ctype.h>        // FAILS -- includes locale.h
+//#include <ctype.h>		// FAILS -- includes locale.h
 #include <errno.h>
 #include <fenv.h>
@@ -10,6 +17,6 @@
 #include <iso646.h>
 #include <limits.h>
-//#include <locale.h>       // FAILS -- "no reasonable alternatives for applying ... Name: ?+? ..."
-#include <math.h>
+//#include <locale.h>		// FAILS -- "no reasonable alternatives for applying ... Name: ?+? ..."
+#include <math.h>		// contains structure field "type"
 #include <setjmp.h>
 #include <signal.h>
@@ -19,13 +26,12 @@
 #include <stdlib.h>
 #include <stdio.h>
-//#include <string.h>       // FAILS -- includes locale.h
+//#include <string.h>		// FAILS -- includes locale.h
 #include <tgmath.h>
-//#include <time.h>         // FAILS -- includes locale.h
+//#include <time.h>		// FAILS -- includes locale.h
 #include <unistd.h>
-//#include <wchar.h>        // FAILS -- includes locale.h
-//#include <wctype.h>       // FAILS -- includes locale.h
+//#include <wchar.h>		// FAILS -- includes locale.h
+//#include <wctype.h>		// FAILS -- includes locale.h
 #include <curses.h>
 #else
-#include <aio.h>
 #endif // 0
 
