Index: .gitignore
===================================================================
--- .gitignore	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ .gitignore	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -31,5 +31,6 @@
 
 src/prelude/builtins.cf
-src/prelude/builtins.c
+src/prelude/gcc-builtins.cf
+src/prelude/gcc-builtins.c
 src/prelude/extras.cf
 src/prelude/bootloader.c
Index: doc/proposals/associated_types.md
===================================================================
--- doc/proposals/associated_types.md	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ doc/proposals/associated_types.md	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,58 @@
+## Associated Types ##
+
+In Cforall today, traits can denote the relationship between two types, e.g:
+
+	trait points_to(otype pointer, dtype element) {
+		element& *?(pointer);
+	}
+
+In many such cases, some subset of the trait parameters will (almost-)always uniquely determine the others (for instance, the iterator type of a generic collection is typically determined by the combination of the collection and element types). In this case, it may be excessively verbose to list the constrained types as type parameters, as well as introducing new type variables (and possibly further resolution overhead). This proposal introduces _associated types_ to address this issue.
+
+An associated type would be a new sort of type assertion, indicating that a unique best type exists to satisfy the remainder of the trait, given the remaining trait parameters, as in the following example:
+
+	trait pointer_like(otype pointer) {
+		dtype element;  // associated type, inferred from *? below
+
+		element& *?(pointer);
+	};
+
+To resolve an assertion like `pointer_like(P)`, the Cforall compiler would find all interpretations of `E& *?(P)`, binding `element` to the `E` from the lowest-cost alternative (no alternative means a resolution failure, multiple min-cost alternatives is an ambiguous result, as usual). If there was more than one trait assertion involving `element`, the cost would be summed over interpretations of all relevant traits. The associated type could be named as `pointer_like(P).element` (similarly to nested types in structs).
+
+Information about associated types would be passed to polymorphic functions the same way information about existing type parameters is passed.
+
+Note that associated types could interact quite cleanly with fully-explicit traits, as in this equivalent formulation of `pointer_like`:
+
+	trait pointer_like(otype pointer) {
+		dtype element | points_to(pointer, element);
+	};
+
+### Disambiguation ###
+
+If there is no unique best interpretation of an associated type, or if the programmer wants to specify an alternate interpretation in a local scope, the following syntax can be used to explicitly bind an associated type:
+
+	struct list_node {
+		int val;
+		list_node* next;
+	};
+	
+	int& *?(list_node* n) { return n->val; }
+
+	trait pointer_like(list_node*) {
+		dtype element = int;
+	};
+
+These explicit specializations could likely be placed under a `forall` clause to be more general:
+
+	forall(otype T) trait forward_iterator(vector_iter(T)) {
+		otype element = T;
+	};
+
+### Nominal Inheritance ###
+
+This trait specialization syntax could also be used, with a new annotation on the traits, to provide nominal inheritance of traits, e.g:
+
+	extern trait random_access_iterator(otype I | forward_iterator(I)) {};
+
+	forall(otype T) random_access_iterator(vector_iter(T)) {};
+
+I used `extern` here to not add a new keyword, I think it fits the idea of "the definition is somewhere else" of the existing meaning of `extern`. Other options include a zero-arg pseudo-trait `nominal()` that could go in the trait's constraint list.
Index: doc/proposals/tagged-struct.txt
===================================================================
--- doc/proposals/tagged-struct.txt	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ doc/proposals/tagged-struct.txt	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -14,4 +14,6 @@
 say which of the possible values is currently stored in the union. The idea
 here is similar, however the possibilities are more open ended.
+
+Alternate names include virtual structure and abstract structure.
 
 
@@ -36,26 +38,36 @@
 their parent's fields to their field list so they can be upcast.
 
+The type field may be public, if it is then it can be accessed through a
+simple field access "instance.type". The type field would then be able to be
+used to access the type object, which contains the information for the type.
+It may just be a pointer to the type object "*instance.type", although a
+lookup function could also be used.
+
+
+Usage:
+
+The central feature for tagged structs is a checked cast between pointer types
+to the structures. A cast is successful if the true type of the pointed object
+is of the type being cast to or any of its children, otherwise the cast
+returns null.
+
+The type field should also allow for equality comparison of types.
+
+Currently, with only these operations (and similar features) the type field
+could be hidden and the operations given through helper functions. However
+if the type object has more complex (or even open ended) information in it
+than providing direct access becomes very valuable.
+
 
 Implemenation:
 
-Adding to the field list is a simple matter, should be doable during
-translation. The type field is just a pointer to a type object. With proper
-linking we can create a single unique instance of the type object for each
-declared tagged struct. The instance's address is used as an id for the type.
-It also holds data about the type, such as its parent's id/a pointer to the
-parent type object.
+Adding to the field list would have to be handled during translation. The
+simple act of adding declarations should not be difficult, althought it might
+take a bit of work to find the parent's declarations.
 
-The type field could be hidden (as best as C can hide it) or it could be
-visible to the user with easy access to allow the user to examine the type
-object directly.
-
-Direct access is more useful if the data on the type-objects can change, other
-wise the build in function could handle all cases. Perhaps each root object
-can specify a type object to use or the type objects are themselves tagged,
-although there may not be a base case with the latter.
-
-In the simplest case the type object is a pointer to the parent type object.
-Additional data could be added, such as a name, or a function pointer to the
-destructor.
+Type objects are also simple in to generate, they should just be global
+(program lifetime) structures. Getting there to be exactly one instance of
+each allows the pointer to the structure to be used as the type id, and that
+should be possible to do during linking.
 
 
@@ -94,2 +106,17 @@
 If unions are declared tagged instead of creating a new tagged type, all
 possible values of the union must be of that tagged type or a child type.
+
+
+Custom Type Objects (Extention):
+
+Some method to define type objects used within a tree of types. One option is
+to allow the tree's type object to be specified by the tree root. It would
+then have to be filled in for each type in the tree, including the root.
+
+The only required field is the parent field, a pointer to the type object's
+type. (This is also the only required field on the tagged structure itself.)
+
+A further extention could allow expanding type objects, so child types could
+append fields to their parent's feild list. They might need their own type
+objects at that point, or maybe static checks will be enough to see the
+minimum field list.
Index: doc/working/exception/translate.c
===================================================================
--- doc/working/exception/translate.c	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ doc/working/exception/translate.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -1,7 +1,9 @@
 /* Translation rules for exception handling code, from Cforall to C.
  *
- * Note that these are not final. Names, syntax and the exact translation
- * will be updated. The first section is the shared definitions, not generated
- * by the local translations but used by the translated code.
+ * Reminder: This is not final. Besides names and things it is also going very
+ * much for correctness and simplisity over efficiency.
+ *
+ * The first section is the shared definitions, not generated by the local
+ * translations but used by the translated code.
  *
  * Most of these exist only after translation (in C code). The first (the
@@ -16,4 +18,8 @@
 typedef int exception;
 
+// Will have to be availibe to user. Consider new name. Requires tagged types.
+forall(dtype parent | tagged(parent), dtype child | tagged(child))
+parent *dynamic_cast(child *);
+
 void __throw_terminate(exception except) __attribute__((noreturn));
 void __rethrow_terminate() __attribute__((noreturn));
@@ -116,13 +122,17 @@
 		}
 		int match1(exception except) {
-			OtherException inner_except;
-			if (dynamic_cast__SomeException(except)) {
-				return 1;
-			}
-			else if ( (inner_except = dynamic_cast__OtherException(except)) &&
-					inner_except.priority > 3) {
-				return 2;
-			}
-			else return 0;
+			{
+				if (dynamic_cast__SomeException(except)) {
+					return 1;
+				}
+			}
+			{
+				OtherException err;
+				if ( (err = dynamic_cast__OtherException(except)) &&
+						err.priority > 3) {
+					return 2;
+				}
+			}
+			return 0;
 		}
 		__try_terminate(try1, catch1, match1);
@@ -151,15 +161,19 @@
 	{
 		bool handle1(exception except) {
-			OtherException inner_except;
-			if (dynamic_cast__SomeException(except)) {
-				fiddleThing();
-				return true;
-			} else if (dynamic_cast__OtherException(except) &&
-					inner_except.priority > 3) {
-				twiddleWidget();
-				return true;
-			} else {
-				return false;
-			}
+			{
+				if (dynamic_cast__SomeException(except)) {
+					fiddleThing();
+					return true;
+				}
+			}
+			{
+				OtherException err;
+ 				if ( ( err = dynamic_cast__OtherException(except) ) &&
+						err.priority > 3) {
+					twiddleWidget();
+					return true;
+				}
+			}
+			return false;
 		}
 		struct __try_resume_node data =
@@ -230,10 +244,11 @@
 		}
 		bool handle1(exception except) {
-			if (dynamic_cast__SomeException(except)) {
-				fiddleThing();
-				return true;
-			} else {
-				return false;
-			}
+			{
+				if (dynamic_cast__SomeException(except)) {
+					fiddleThing();
+					return true;
+				}
+			}
+			return false;
 		}
 		struct __cleanup_hook generated_name
@@ -273,7 +288,9 @@
 	{
 		bool handle1() {
-			if (dynamic_cast__OtherException(except)) {
-				twiddleWidget();
-				return true;
+			{
+				if (dynamic_cast__OtherException(except)) {
+					twiddleWidget();
+					return true;
+				}
 			}
 			return false;
@@ -297,6 +314,8 @@
 		}
 		int match1(exception except) {
-			if (dynamic_cast__SomeException(except)) {
-				return 1;
+			{
+				if (dynamic_cast__SomeException(except)) {
+					return 1;
+				}
 			}
 			return 0;
Index: src/Common/PassVisitor.h
===================================================================
--- src/Common/PassVisitor.h	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/Common/PassVisitor.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -25,5 +25,5 @@
 // | WithStmtsToAdd       - provides the ability to insert statements before or after the current statement by adding new statements into
 //                          stmtsToAddBefore or stmtsToAddAfter respectively.
-// | WithShortCircuiting  - provides the ability to skip visiting child nodes; set skip_children to true if pre{visit,mutate} to skip visiting children
+// | WithShortCircuiting  - provides the ability to skip visiting child nodes; set visit_children to false in pre{visit,mutate} to skip visiting children
 // | WithScopes           - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable
 //                          will automatically be restored to its previous value after the corresponding postvisit/postmutate teminates.
@@ -37,5 +37,11 @@
 	PassVisitor(Args &&... args)
 		: pass( std::forward<Args>( args )... )
-	{}
+	{
+		typedef PassVisitor<pass_type> this_t;
+		this_t * const * visitor = visitor_impl(pass, 0);
+		if(visitor) {
+			*const_cast<this_t **>( visitor ) = this;
+		}
+	}
 
 	virtual ~PassVisitor() = default;
@@ -214,4 +220,7 @@
 
 private:
+	template<typename pass_t> friend void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
+	template<typename pass_t> friend void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
+
 	template<typename node_type> void call_previsit ( node_type * node ) { previsit_impl ( pass, node, 0 ); }
 	template<typename node_type> void call_postvisit( node_type * node ) { postvisit_impl( pass, node, 0 ); }
@@ -225,11 +234,17 @@
 	void set_env( TypeSubstitution * env ) { set_env_impl( pass, env, 0); }
 
-	void visitStatementList( std::list< Statement* > &statements );
+	template< typename func_t >
+	void handleStatementList( std::list< Statement * > & statements, func_t func );
+	void visitStatementList ( std::list< Statement* > &statements );
 	void mutateStatementList( std::list< Statement* > &statements );
 
-	Statement * visitStatement( Statement * stmt );
+	template< typename func_t >
+	Statement * handleStatement( Statement * stmt, func_t func );
+	Statement * visitStatement ( Statement * stmt );
 	Statement * mutateStatement( Statement * stmt );
 
-	void visitExpression( Expression * expr );
+	template< typename func_t >
+	Expression * handleExpression( Expression * expr, func_t func );
+	Expression * visitExpression ( Expression * expr );
 	Expression * mutateExpression( Expression * expr );
 
@@ -238,6 +253,8 @@
 	std::list< Statement* > * 	get_beforeStmts() { return stmtsToAddBefore_impl( pass, 0); }
 	std::list< Statement* > * 	get_afterStmts () { return stmtsToAddAfter_impl ( pass, 0); }
-	bool visit_children() { bool* skip = skip_children_impl(pass, 0); return ! (skip && *skip); }
-	void reset_visit() { bool* skip = skip_children_impl(pass, 0); if(skip) *skip = false; }
+	std::list< Declaration* > * 	get_beforeDecls() { return declsToAddBefore_impl( pass, 0); }
+	std::list< Declaration* > * 	get_afterDecls () { return declsToAddAfter_impl ( pass, 0); }
+
+	void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
 
 	guard_value_impl init_guard() {
@@ -278,5 +295,4 @@
 	std::list< Statement* > stmtsToAddAfter;
 };
-
 class WithShortCircuiting {
 protected:
@@ -285,5 +301,5 @@
 
 public:
-	bool skip_children;
+	bool_ref visit_children;
 };
 
@@ -304,4 +320,13 @@
 };
 
+template<typename pass_type>
+class WithVisitorRef {
+protected:
+	WithVisitorRef() = default;
+	~WithVisitorRef() = default;
+
+public:
+	PassVisitor<pass_type> * const visitor;
+};
 
 #include "PassVisitor.impl.h"
Index: src/Common/PassVisitor.impl.h
===================================================================
--- src/Common/PassVisitor.impl.h	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/Common/PassVisitor.impl.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -4,10 +4,11 @@
 	__attribute__((unused))                   \
 	const auto & guard = init_guard();        \
+	bool visit_children = true;               \
+	set_visit_children( visit_children );	\
 	call_previsit( node );                    \
-	if( visit_children() ) {                  \
+	if( visit_children ) {                    \
 
 #define VISIT_END( node )                       \
 	}                                         \
-	reset_visit();                            \
 	call_postvisit( node );                   \
 
@@ -15,10 +16,11 @@
 	__attribute__((unused))                   \
 	const auto & guard = init_guard();        \
+	bool visit_children = true;               \
+	set_visit_children( visit_children );	\
 	call_premutate( node );                   \
-	if( visit_children() ) {                  \
+	if( visit_children ) {                    \
 
 #define MUTATE_END( type, node )                \
 	}                                         \
-	reset_visit();                            \
 	return call_postmutate< type * >( node ); \
 
@@ -42,23 +44,89 @@
 }
 
-typedef std::list< Statement * > StmtList_t;
-
-template< typename pass_type >
-void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
+typedef std::list< Statement   * > StmtList_t;
+typedef std::list< Declaration * > DeclList_t;
+
+template<typename iterator_t>
+static inline void splice( iterator_t it, DeclList_t * decls ) {
+	std::transform(
+		decls->begin(),
+		decls->end(),
+		it,
+		[](Declaration * decl) -> auto {
+			return new DeclStmt( noLabels, decl );
+		}
+	);
+	decls->clear();
+}
+
+template< typename pass_type >
+static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
+
+	DeclList_t* beforeDecls = visitor.get_beforeDecls();
+	DeclList_t* afterDecls  = visitor.get_afterDecls();
+
+	for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
+		// splice in new declarations after previous decl
+		if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }	
+
+		if ( i == decls.end() ) break;
+
+		// run mutator on declaration
+		maybeAccept( *i, visitor );
+
+		// splice in new declarations before current decl
+		if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
+	}
+}
+
+template< typename pass_type >
+static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
+
+	DeclList_t* beforeDecls = mutator.get_beforeDecls();
+	DeclList_t* afterDecls  = mutator.get_afterDecls();
+
+	for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
+		// splice in new declarations after previous decl
+		if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }	
+
+		if ( i == decls.end() ) break;
+
+		// run mutator on declaration
+		*i = maybeMutate( *i, mutator );
+
+		// splice in new declarations before current decl
+		if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
+	}
+}
+
+template< typename pass_type >
+template< typename func_t >
+void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
 	SemanticError errors;
 
 	StmtList_t* beforeStmts = get_beforeStmts();
 	StmtList_t* afterStmts  = get_afterStmts();
+	DeclList_t* beforeDecls = get_beforeDecls();
+	DeclList_t* afterDecls  = get_afterDecls();
 
 	for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
+
+		if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
 		if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
+
 		try {
-			(*i)->accept( *this );
+			func( *i );
+			assert(( empty( beforeStmts ) && empty( afterStmts ))
+			    || ( empty( beforeDecls ) && empty( afterDecls )) );
+
 		} catch ( SemanticError &e ) {
 			errors.append( e );
 		}
+
+		if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
 		if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
 	}
 
+	if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
 	if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
 	if ( !errors.isEmpty() ) { throw errors; }
@@ -66,41 +134,44 @@
 
 template< typename pass_type >
+void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
+	handleStatementList( statements, [this]( Statement * stmt) {
+		stmt->accept( *this );
+	});
+}
+
+template< typename pass_type >
 void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
-	SemanticError errors;
+	handleStatementList( statements, [this]( Statement *& stmt) {
+		stmt = stmt->acceptMutator( *this );
+	});
+}
+
+
+template< typename pass_type >
+template< typename func_t >
+Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
+	// don't want statements from outer CompoundStmts to be added to this CompoundStmt
+	ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
+	ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
+	ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
+	ValueGuardPtr< StmtList_t >          oldBeforeStmts( get_beforeStmts() );
+	ValueGuardPtr< StmtList_t >          oldAfterStmts ( get_afterStmts () );
+
+	Statement *newStmt = func( stmt );
 
 	StmtList_t* beforeStmts = get_beforeStmts();
 	StmtList_t* afterStmts  = get_afterStmts();
-
-	for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
-		if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
-		try {
-			*i = (*i)->acceptMutator( *this );
-		} catch ( SemanticError &e ) {
-			errors.append( e );
-		}
-		if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
-	}
-
-	if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
-	if ( !errors.isEmpty() ) { throw errors; }
-}
-
-template< typename pass_type >
-Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
-	// don't want statements from outer CompoundStmts to be added to this CompoundStmt
-	ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
-	ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
-	ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
-
-	maybeAccept( stmt, *this );
-
-	StmtList_t* beforeStmts = get_beforeStmts();
-	StmtList_t* afterStmts  = get_afterStmts();
-
-	if( empty(beforeStmts) && empty(afterStmts) ) { return stmt; }
+	DeclList_t* beforeDecls = get_beforeDecls();
+	DeclList_t* afterDecls  = get_afterDecls();
+
+	if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; }
+	assert(( empty( beforeStmts ) && empty( afterStmts ))
+	    || ( empty( beforeDecls ) && empty( afterDecls )) );
 
 	CompoundStmt *compound = new CompoundStmt( noLabels );
+	if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
 	if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
-	compound->get_kids().push_back( stmt );
+	compound->get_kids().push_back( newStmt );
+	if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
 	if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
 	return compound;
@@ -108,29 +179,22 @@
 
 template< typename pass_type >
+Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
+	return handleStatement( stmt, [this]( Statement * stmt ) {
+		maybeAccept( stmt, *this ); 
+		return stmt;
+	});
+}
+
+template< typename pass_type >
 Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
-	// don't want statements from outer CompoundStmts to be added to this CompoundStmt
-	ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
-	ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
-	ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
-
-	Statement *newStmt = maybeMutate( stmt, *this );
-
-	StmtList_t* beforeStmts = get_beforeStmts();
-	StmtList_t* afterStmts  = get_afterStmts();
-
-	if( empty(beforeStmts) && empty(afterStmts) ) { return newStmt; }
-
-	CompoundStmt *compound = new CompoundStmt( noLabels );
-	if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
-	compound->get_kids().push_back( newStmt );
-	if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
-	return compound;
-}
-
-
-
-template< typename pass_type >
-void PassVisitor< pass_type >::visitExpression( Expression * expr ) {
-	if( !expr ) return;
+	return handleStatement( stmt, [this]( Statement * stmt ) {
+	 	return maybeMutate( stmt, *this );
+	});
+}
+
+template< typename pass_type >
+template< typename func_t >
+Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
+	if( !expr ) return nullptr;
 
 	auto env_ptr = get_env_ptr();
@@ -138,20 +202,23 @@
 		*env_ptr = expr->get_env();
 	}
-	// xxx - should env be cloned (or moved) onto the result of the mutate?
-	expr->accept( *this );
+
+	// should env be cloned (or moved) onto the result of the mutate?
+	return func( expr );
+}
+
+template< typename pass_type >
+Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
+	return handleExpression(expr, [this]( Expression * expr ) {
+		expr->accept( *this );
+		return expr;
+	});		
 }
 
 template< typename pass_type >
 Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
-	if( !expr ) return nullptr;
-
-	auto env_ptr = get_env_ptr();
-	if ( env_ptr && expr->get_env() ) {
-		*env_ptr = expr->get_env();
-	}
-	// xxx - should env be cloned (or moved) onto the result of the mutate?
-	return expr->acceptMutator( *this );
-}
-
+	return handleExpression(expr, [this]( Expression * expr ) {
+		return expr->acceptMutator( *this );
+	});
+}
 
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -231,9 +298,7 @@
 void PassVisitor< pass_type >::visit( ExprStmt * node ) {
 	VISIT_START( node );
-	call_beginScope();
 
 	visitExpression( node->get_expr() );
 
-	call_endScope();
 	VISIT_END( node );
 }
@@ -248,7 +313,14 @@
 }
 
+//--------------------------------------------------------------------------
+// AsmStmt
 template< typename pass_type >
 void PassVisitor< pass_type >::visit( AsmStmt * node ) {
 	VISIT_BODY( node );
+}
+
+template< typename pass_type >
+Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
+	MUTATE_BODY( Statement, node );
 }
 
@@ -300,5 +372,5 @@
 
 //--------------------------------------------------------------------------
-// WhileStmt
+// ForStmt
 template< typename pass_type >
 void PassVisitor< pass_type >::visit( ForStmt * node ) {
@@ -348,5 +420,5 @@
 
 //--------------------------------------------------------------------------
-// SwitchStmt
+// CaseStmt
 template< typename pass_type >
 void PassVisitor< pass_type >::visit( CaseStmt * node ) {
@@ -369,7 +441,14 @@
 }
 
+//--------------------------------------------------------------------------
+// BranchStmt
 template< typename pass_type >
 void PassVisitor< pass_type >::visit( BranchStmt * node ) {
 	VISIT_BODY( node );
+}
+
+template< typename pass_type >
+Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
+	MUTATE_BODY( Statement, node );
 }
 
@@ -415,4 +494,5 @@
 	maybeAccept( node->get_block(), *this );
 	acceptAll( node->get_catchers(), *this );
+	maybeAccept( node->get_finally(), *this );
 
 	VISIT_END( node );
@@ -425,4 +505,5 @@
 	node->set_block(  maybeMutate( node->get_block(), *this ) );
 	mutateAll( node->get_catchers(), *this );
+	node->set_finally( maybeMutate( node->get_finally(), *this ) );
 
 	MUTATE_END( Statement, node );
@@ -435,6 +516,7 @@
 	VISIT_START( node );
 
+	maybeAccept( node->get_decl(), *this );
+	node->set_cond( visitExpression( node->get_cond() ) );
 	node->set_body( visitStatement( node->get_body() ) );
-	maybeAccept( node->get_decl(), *this );
 
 	VISIT_END( node );
@@ -445,6 +527,7 @@
 	MUTATE_START( node );
 
-	node->set_body(  mutateStatement( node->get_body() ) );
-	node->set_decl(  maybeMutate( node->get_decl(), *this ) );
+	node->set_decl( maybeMutate( node->get_decl(), *this ) );
+	node->set_cond( mutateExpression( node->get_cond() ) );
+	node->set_body( mutateStatement( node->get_body() ) );
 
 	MUTATE_END( Statement, node );
@@ -838,14 +921,4 @@
 
 template< typename pass_type >
-Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
-	MUTATE_BODY( Statement, node );
-}
-
-template< typename pass_type >
-Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
-	MUTATE_BODY( Statement, node );
-}
-
-template< typename pass_type >
 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
 	MUTATE_BODY( Statement, node );
Index: src/Common/PassVisitor.proto.h
===================================================================
--- src/Common/PassVisitor.proto.h	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/Common/PassVisitor.proto.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -1,3 +1,6 @@
 #pragma once
+
+template<typename pass_type>
+class PassVisitor;
 
 typedef std::function<void( void * )> cleanup_func_t;
@@ -31,4 +34,22 @@
 
 typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
+
+class bool_ref {
+public:
+	bool_ref() = default;
+	~bool_ref() = default;
+
+	operator bool() { return *m_ref; }
+	bool operator=( bool val ) { return *m_ref = val; }
+
+private:
+
+	template<typename pass>
+	friend class PassVisitor;
+
+	void set( bool & val ) { m_ref = &val; };
+
+	bool * m_ref;
+};
 
 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -112,4 +133,7 @@
 FIELD_PTR( std::list< Statement* >, stmtsToAddBefore )
 FIELD_PTR( std::list< Statement* >, stmtsToAddAfter  )
-FIELD_PTR( bool, skip_children )
+FIELD_PTR( std::list< Declaration* >, declsToAddBefore )
+FIELD_PTR( std::list< Declaration* >, declsToAddAfter  )
+FIELD_PTR( bool_ref, visit_children )
 FIELD_PTR( at_cleanup_t, at_cleanup )
+FIELD_PTR( PassVisitor<pass_type> * const, visitor )
Index: src/ControlStruct/ExceptTranslate.cc
===================================================================
--- src/ControlStruct/ExceptTranslate.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/ControlStruct/ExceptTranslate.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,485 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ExceptVisitor.cc --
+//
+// Author           : Andrew Beach
+// Created On       : Wed Jun 14 16:49:00 2017
+// Last Modified By : Andrew Beach
+// Last Modified On : Thr Jun 22 15:57:00 2017
+// Update Count     : 0
+//
+
+#include "ExceptTranslate.h"
+#include "Common/PassVisitor.h"
+
+namespace ControlFlow {
+
+	// This (large) section could probably be moved out of the class
+	// and be static helpers instead.
+
+	// Type(Qualifiers &, false, std::list<Attribute *> &)
+
+	// void (*function)()
+	static FunctionType void_func_t(Type::Qualifiers(), false);
+	// void (*function)(int, exception);
+	static FunctionType catch_func_t(Type::Qualifiers(), false);
+	// int (*function)(exception);
+	static FunctionType match_func_t(Type::Qualifiers(), false);
+	// bool (*function)(exception);
+	static FunctionType handle_func_t(Type::Qualifiers(), false);
+
+	static void init_func_types() {
+		static init_complete = false;
+		if (init_complete) {
+			return;
+		}
+		ObjectDecl index_obj(
+			"index_t",
+			Type::StorageClasses(),
+			LinkageSpec::Cforall,
+			/*bitfieldWidth*/ NULL,
+			new BasicType(emptyQualifiers, BasicType::UnsignedInt),
+			/*init*/ NULL
+		);
+		ObjectDecl exception_obj(
+			"exception_t",
+			Type::StorageClasses(),
+			LinkageSpec::Cforall,
+			/*bitfieldWidth*/ NULL,
+			new BasicType(emptyQualifiers, BasicType::UnsignedInt),
+			/*init*/ NULL
+		);
+		ObjectDecl bool_obj(
+			"bool_t",
+			Type::StorageClasses(),
+			LinkageSpec::Cforall,
+			/*bitfieldWidth*/ NULL,
+			new BasicType(emptyQualifiers, BasicType::Bool),
+			/*init*/ NULL
+		);
+
+		catch_func_t.get_parameters().push_back(index_obj.clone());
+		catch_func_t.get_parameters().push_back(exception_obj.clone());
+		match_func_t.get_returnVals().push_back(index_obj.clone());
+		match_func_t.get_parameters().push_back(exception_obj.clone());
+		handle_func_t.get_returnVals().push_back(bool_obj.clone());
+		handle_func_t.get_parameters().push_back(exception_obj.clone());
+
+		init_complete = true;
+	}
+
+	// Buricratic Helpers (Not having to do with the paritular operation.)
+
+	typedef std::list<CatchStmt*> CatchList;
+
+	void split( CatchList& allHandlers, CatchList& terHandlers,
+	            CatchList& resHandlers ) {
+		while ( !allHandlers.empty() ) {
+			Statement * stmt = allHandlers.front();
+			allHandlers.pop_front();
+			if (CaseStmt::Terminate == stmt->get_kind()) {
+				terHandlers.push_back(stmt);
+			} else {
+				resHandlers.push_back(stmt);
+			}
+		}
+	}
+
+	template<typename T>
+	void free_all( std::list<T *> &list ) {
+		std::list<T *>::iterator it;
+		for ( it = list.begin() ; it != list.end() ; ++it ) {
+			delete *it;
+		}
+		list.clear();
+	}
+
+	void appendDeclStmt( CompoundStmt * block, Declaration * item ) {
+		block->push_back(new DeclStmt(no_labels, item));
+	}
+
+	Expression * nameOf( FunctionDecl * function ) {
+		return new VariableExpr( function );
+	}
+
+	// ThrowStmt Mutation Helpers
+
+	Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
+		// __throw_terminate( EXPR );
+		ApplicationExpr * call = new ApplicationExpr( /* ... */ );
+		call->get_args.push_back( throwStmt->get_expr() );
+		Statement * result = new ExprStmt( throwStmt->get_labels(), call );
+		throwStmt->set_expr( nullptr );
+		delete throwStmt;
+		return result;
+	}
+	Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) {
+		// __rethrow_terminate();
+		Statement * result = new ExprStmt(
+			throwStmt->get_labels(),
+			new ApplicationExpr( /* ... */ );
+			);
+		delete throwStmt;
+		return result;
+	}
+	Statement * create_resume_throw( ThrowStmt *throwStmt ) {
+		// __throw_resume( EXPR );
+		ApplicationExpr * call = new ApplicationExpr( /* ... */ );
+		call->get_args.push_back( throwStmt->get_expr() );
+		Statement * result = new ExprStmt( throwStmt->get_labels(), call );
+		throwStmt->set_expr( nullptr );
+		delete throwStmt;
+		return result;
+	}
+	Statement * create_resume_rethrow( ThrowStmt *throwStmt ) {
+		// return false;
+		Statement * result = new ReturnStmt(
+			throwStmt->get_labels(),
+			new ConstantExpr(
+				Constant(
+					new BasicType(
+						Type::Qualifiers(),
+						BasicType::Bool
+						),
+					"0")
+				)
+			);
+		delete throwStmt;
+		return result;
+	}
+
+	// TryStmt Mutation Helpers
+
+	CompoundStmt * take_try_block( TryStmt *tryStmt ) {
+		CompoundStmt * block = tryStmt->get_block();
+		tryStmt->set_block( nullptr );
+		return block;
+	}
+	FunctionDecl * create_try_wrapper( TryStmt *tryStmt ) {
+		CompoundStmt * body = base_try->get_block();
+		base_try->set_block(nullptr);
+
+		return new FunctionDecl("try", Type::StorageClasses(),
+			LinkageSpec::Cforall, void_func_t, body);
+	}
+
+	FunctionDecl * create_terminate_catch( CatchList &handlers ) {
+		std::list<CaseStmt *> handler_wrappers;
+
+		// Index 1..{number of handlers}
+		int index = 0;
+		CatchList::iterator it = handlers.begin();
+		for ( ; it != handlers.end() ; ++it ) {
+			++index;
+			CatchStmt * handler = *it;
+
+			std::list<Statement *> core;
+			if ( /*the exception is named*/ ) {
+				ObjectDecl * local_except = /* Dynamic case, same */;
+				core->push_back( new DeclStmt( noLabel, local_except ) );
+			}
+			// Append the provided statement to the handler.
+			core->push_back( cur_handler->get_body() );
+			// Append return onto the inner block? case stmt list?
+			CaseStmt * wrapper = new CaseStmt(
+				noLabels,
+				new ConstantExpr( Constant::from_int( index ) ),
+				core
+				);
+			handler_wrappers.push_back(wrapper);
+		}
+		// TODO: Some sort of meaningful error on default perhaps?
+
+		SwitchStmt * handler_lookup = new SwitchStmt(
+			noLabels,
+			/*parameter 0: index*/,
+			handler_wrappers,
+			false
+			);
+		CompoundStmt * body = new CompoundStmt( noLabels );
+		body->push_back( handler_lookup );
+
+		return new FunctionDecl("catch", Type::StorageClasses(),
+			LinkageSpec::Cforall, catch_func_t, body);
+	}
+
+	// Create a single check from a moddified handler.
+	CompoundStmt *create_single_matcher( CatchStmt * modded_handler ) {
+		CompoundStmt * block = new CompoundStmt( noLables );
+
+		appendDeclStmt( block, modded_handler->get_decl() );
+
+		// TODO: This is not the actual check.
+		LogicalExpr * cond = new ConstantExpr( Constant::from_bool( false ) );
+
+		if ( modded_handler->get_cond() ) {
+			cond = new LogicalExpr( cond, modded_handler->get_cond() )q
+		}
+		block->push_back( new IfStmt( noLabels,
+			cond, modded_handler->get_body() );
+
+		modded_handler->set_decl( nullptr );
+		modded_handler->set_cond( nullptr );
+		modded_handler->set_body( nullptr );
+		delete modded_handler;
+		return block;
+	}
+
+	FunctionDecl * create_terminate_match( CatchList &handlers ) {
+		CompoundStmt * body = new CompoundStmt( noLabels );
+
+		// Index 1..{number of handlers}
+		int index = 0;
+		CatchList::iterator it;
+		for ( it = handlers.begin() ; it != handlers.end() ; ++it ) {
+			++index;
+			CatchStmt * handler = *it;
+
+			// body should have been taken by create_terminate_catch.
+			// assert( nullptr == handler->get_body() );
+			handler->set_body( new ReturnStmt( noLabels,
+				new ConstantExpr( Constant::from_int( index ) ) ) );
+
+			body->push_back( create_single_matcher( handler ) );
+		}
+
+		return new FunctionDecl("match", Type::StorageClasses(),
+			LinkageSpec::Cforall, match_func_t, body);
+	}
+
+	Statement * create_terminate_caller(
+			FunctionDecl * try_wrapper,
+			FunctionDecl * terminate_catch,
+			FunctionDecl * terminate_match) {
+
+		ApplicationExpr * caller = new ApplicationExpr( /* ... */ );
+		std::list<Expression *>& args = caller.get_args();
+		args.push_back( nameOf( try_wrapper ) );
+		args.push_back( nameOf( terminate_catch ) );
+		args.push_back( nameOf( terminate_match ) );
+
+		return new ExprStmt( noLabels, caller );
+	}
+
+	FunctionDecl * create_resume_handler( CatchList &handlers ) {
+		CompoundStmt * body = new CompountStmt( noLabels );
+
+		CatchList::iterator it;
+		for ( it = handlers.begin() ; it != handlers.end() ; ++it ) {
+			CatchStmt * handler = *it;
+
+			// Modifiy body.
+			CompoundStmt * handling_code =
+				dynamic_cast<CompoundStmt*>( handler->get_body() );
+			if ( ! handling_code ) {
+				handling_code = new CompoundStmt( noLabels );
+				handling_code->push_back( handler->get_body() );
+			}
+			handling_code->push_back( new ReturnStmt( noLabel,
+				new ConstantExpr( Constant::from_bool( false ) ) ) );
+			handler->set_body( handling_code );
+
+			// Create the handler.
+			body->push_back( create_single_matcher( handler ) );
+		}
+
+		return new FunctionDecl("handle", Type::StorageClasses(),
+			LinkageSpec::Cforall, handle_func_t, body);
+	}
+
+	Statement * create_resume_wrapper(
+			Statement * wraps,
+			FunctionDecl * resume_handler ) {
+		CompoundStmt * body = new CompoundStmt( noLabels );
+
+		// struct node = {current top resume handler, call to resume_handler};
+		// __attribute__((cleanup( ... )));
+		// set top resume handler to node.
+		// The wrapped statement.
+
+		ListInit * node_init;
+		{
+			std::list<Initializer*> field_inits;
+			field_inits.push_back( new SingleInit( /* ... */ ) );
+			field_inits.push_back( new SingleInit( nameOf( resume_handler ) ) );
+			node_init = new ListInit( field_inits );
+		}
+
+		std::list< Attribute * > attributes;
+		{
+			std::list< Expression * > attr_params;
+			attr_params.push_back( nameOf( /* ... deconstructor ... */ ) );
+			attrributes.push_back( new Attribute( "cleanup", attr_params ) );
+		}
+
+		appendDeclStmt( body,
+		/**/ ObjectDecl(
+			"resume_node",
+			Type::StorageClasses(),
+			LinkageSpec::Cforall,
+			nullptr,
+			/* Type* = resume_node */,
+			node_init,
+			attributes
+			)
+		);
+		body->push_back( wraps );
+		return body;
+	}
+
+	FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ) {
+		CompoundStmt * body = tryStmt->get_finally();
+		tryStmt->set_finally( nullptr );
+
+		return new FunctionDecl("finally", Type::StorageClasses(),
+			LinkageSpec::Cforall, void_func_t, body);
+	}
+
+	ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ) {
+		// struct _cleanup_hook NAME __attribute__((cleanup( ... )));
+
+		// Make Cleanup Attribute.
+		std::list< Attribute * > attributes;
+		{
+			std::list< Expression * > attr_params;
+			attr_params.push_back( nameOf( finally_wrapper ) );
+			attrributes.push_back( new Attribute( "cleanup", attr_params ) );
+		}
+
+		return ObjectDecl( /* ... */
+			const std::string &name "finally_hook",
+			Type::StorageClasses(),
+			LinkageSpec::Cforall,
+			nullptr,
+			/* ... Type * ... */,
+			nullptr,
+			attributes
+			);
+	}
+
+
+	class ExceptionMutatorCore : public WithScoping {
+		enum Context { NoHandler, TerHandler, ResHandler };
+
+		// Also need to handle goto, break & continue.
+		// They need to be cut off in a ResHandler, until we enter another
+		// loop, switch or the goto stays within the function.
+
+		Context curContext;
+
+		// We might not need this, but a unique base for each try block's
+		// generated functions might be nice.
+		//std::string curFunctionName;
+		//unsigned int try_count = 0;
+
+
+	public:
+		ExceptionMutatorCore() :
+			curContext(NoHandler)
+		{}
+
+		void premutate( CatchStmt *tryStmt );
+		Statement * postmutate( ThrowStmt *throwStmt );
+		Statement * postmutate( TryStmt *tryStmt );
+	};
+
+	Statement * ExceptionMutatorCore::postmutate( ThrowStmt *throwStmt ) {
+		// Ignoring throwStmt->get_target() for now.
+		if ( ThrowStmt::Terminate == throwStmt->get_kind() ) {
+			if ( throwStmt->get_expr() ) {
+				return create_terminate_throw( throwStmt );
+			} else if ( TerHandler == curContext ) {
+				return create_terminate_rethrow( throwStmt );
+			} else {
+				assertf(false, "Invalid throw in %s at %i\n",
+					throwStmt->location.filename,
+					throwStmt->location.linenumber);
+				return nullptr;
+			}
+		} else {
+			if ( throwStmt->get_expr() ) {
+				return create_resume_throw( throwStmt );
+			} else if ( ResHandler == curContext ) {
+				return create_resume_rethrow( throwStmt );
+			} else {
+				assertf(false, "Invalid throwResume in %s at %i\n",
+					throwStmt->location.filename,
+					throwStmt->location.linenumber);
+				return nullptr;
+			}
+		}
+	}
+
+	Statement * ExceptionMutatorCore::postmutate( TryStmt *tryStmt ) {
+		// Generate a prefix for the function names?
+
+		CompoundStmt * block = new CompoundStmt();
+		Statement * inner = take_try_block( tryStmt );
+
+		if ( tryStmt->get_finally() ) {
+			// Define the helper function.
+			FunctionDecl * finally_block =
+				create_finally_wrapper( tryStmt );
+			appendDeclStmt( block, finally_block );
+			// Create and add the finally cleanup hook.
+			appendDeclStmt( block, create_finally_hook( finally_block ) );
+		}
+
+		StatementList termination_handlers;
+		StatementList resumption_handlers;
+		split( tryStmt->get_handlers(),
+		       termination_handlers, resumption_handlers );
+
+		if ( resumeption_handlers.size() ) {
+			// Define the helper function.
+			FunctionDecl * resume_handler =
+				create_resume_handler( resumption_handlers );
+			appendDeclStmt( block, resume_handler );
+			// Prepare hooks
+			inner = create_resume_wrapper( inner, resume_handler );
+		}
+
+		if ( termination_handlers.size() ) {
+			// Define the three helper functions.
+			FunctionDecl * try_wrapper = create_try_wrapper( inner );
+			appendDeclStmt( block, try_wrapper );
+			FunctionDecl * terminate_catch =
+				create_terminate_catch( termination_handlers );
+			appendDeclStmt( block, terminate_catch );
+			FunctionDecl * terminate_match =
+				create_terminate_match( termination_handlers );
+			appendDeclStmt( block, terminate_match );
+			// Build the call to the try wrapper.
+			inner = create_terminate_caller(
+				try_wrapper, terminate_catch, terminate_match );
+		}
+
+		// Embed the try block.
+		block->push_back( inner );
+
+		free_all( termination_handlers );
+		free_all( resumption_handlers );
+
+		return block;
+	}
+
+	void ExceptionMutatorCore::premutate( CatchStmt *catchStmt ) {
+		GuardValue( curContext );
+		if ( CatchStmt::Termination == catchStmt->get_kind() ) {
+			curContext = TerHandler;
+		} else {
+			curContext = ResHandler;
+		}
+	}
+
+    void translateEHM( std::list< Declaration *> & translationUnit ) {
+		PassVisitor<ExceptionMutatorCore> translator;
+		for ( Declaration * decl : translationUnit ) {
+			decl->mutate( translator );
+		}
+	}
+}
Index: src/ControlStruct/ExceptTranslate.h
===================================================================
--- src/ControlStruct/ExceptTranslate.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/ControlStruct/ExceptTranslate.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,27 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ExceptTranslate.h --
+//
+// Author           : Andrew Beach
+// Created On       : Tus Jun 06 10:13:00 2017
+// Last Modified By : Andrew Beach
+// Last Modified On : Thr Jun 22 15:57:00 2017
+// Update Count     : 0
+//
+
+#ifndef EXCEPT_TRANSLATE_H
+#define EXCEPT_TRANSLATE_H
+
+namespace ControlFlow {
+	void translateEHM( std::list< Declaration *> & translationUnit );
+	/* Converts exception handling structures into their underlying C code.
+	 * Translation does use the exception handling header, make sure it is
+	 * visible wherever translation occurs.
+	 */
+}
+
+#endif // EXCEPT_TRANSLATE_H
Index: src/GenPoly/DeclMutator.cc
===================================================================
--- src/GenPoly/DeclMutator.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/GenPoly/DeclMutator.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -9,7 +9,7 @@
 // Author           : Aaron B. Moss
 // Created On       : Fri Nov 27 14:44:00 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug  4 11:16:43 2016
-// Update Count     : 3
+// Last Modified By : Andrew Beach
+// Last Modified On : Thu Jun 22 13:49:00 2017
+// Update Count     : 4
 //
 
@@ -178,4 +178,5 @@
 	Statement* DeclMutator::mutate(CatchStmt *catchStmt) {
 		catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
+		catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) );
 		catchStmt->set_body( mutateStatement( catchStmt->get_body() ) );
 		return catchStmt;
Index: src/GenPoly/PolyMutator.cc
===================================================================
--- src/GenPoly/PolyMutator.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/GenPoly/PolyMutator.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug  4 11:26:22 2016
-// Update Count     : 16
+// Last Modified By : Andrew Beach
+// Last Modified On : Thu Jun 22 13:47:00 2017
+// Update Count     : 17
 //
 
@@ -123,12 +123,14 @@
 
 	Statement * PolyMutator::mutate(TryStmt *tryStmt) {
-		tryStmt->set_block(  maybeMutate( tryStmt->get_block(), *this ) );
+		tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
 		mutateAll( tryStmt->get_catchers(), *this );
+		tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) );
 		return tryStmt;
 	}
 
 	Statement * PolyMutator::mutate(CatchStmt *cathStmt) {
-		cathStmt->set_body(  mutateStatement( cathStmt->get_body() ) );
-		cathStmt->set_decl(  maybeMutate( cathStmt->get_decl(), *this ) );
+		cathStmt->set_body( mutateStatement( cathStmt->get_body() ) );
+		cathStmt->set_cond( maybeMutate( cathStmt->get_cond(), *this ) );
+		cathStmt->set_decl( maybeMutate( cathStmt->get_decl(), *this ) );
 		return cathStmt;
 	}
Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/GenPoly/Specialize.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -99,4 +99,6 @@
 		if ( FunctionType * fftype = getFunctionType( formalType ) ) {
 			if ( fftype->isTtype() ) return true;
+			// conversion of 0 (null) to function type does not require tuple specialization
+			if ( dynamic_cast< ZeroType * >( actualType ) ) return false;
 			FunctionType * aftype = getFunctionType( actualType );
 			assertf( aftype, "formal type is a function type, but actual type is not." );
Index: src/InitTweak/InitTweak.cc
===================================================================
--- src/InitTweak/InitTweak.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/InitTweak/InitTweak.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -474,4 +474,6 @@
 	public:
 		ConstExprChecker() : isConstExpr( true ) {}
+
+		using Visitor::visit;
 
 		virtual void visit( __attribute((unused)) ApplicationExpr *applicationExpr ) { isConstExpr = false; }
Index: src/Parser/StatementNode.cc
===================================================================
--- src/Parser/StatementNode.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/Parser/StatementNode.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -168,8 +168,7 @@
 
 Statement *build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) {
-	std::list< Expression * > exps;
-	buildMoveList( ctl, exps );
-	assertf( exps.size() < 2, "This means we are leaking memory");
-	return new ThrowStmt( noLabels, ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
+	(void)ctl;
+	(void)target;
+	assertf( false, "resume at (non-local throw) is not yet supported," );
 }
 
Index: src/SynTree/Constant.cc
===================================================================
--- src/SynTree/Constant.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/SynTree/Constant.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 21 16:44:48 2017
-// Update Count     : 27
+// Last Modified By : Andrew Beach
+// Last Modified On : Thr Jun 22 10:11:00 2017
+// Update Count     : 28
 //
 
@@ -29,4 +29,8 @@
 
 Constant::~Constant() { delete type; }
+
+Constant Constant::from_bool( bool b ) {
+	return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b );
+}
 
 Constant Constant::from_int( int i ) {
Index: src/SynTree/Constant.h
===================================================================
--- src/SynTree/Constant.h	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/SynTree/Constant.h	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 21 16:44:48 2017
-// Update Count     : 14
+// Last Modified By : Andrew Beach
+// Last Modified On : Thr Jun 22 10:13:00 2017
+// Update Count     : 15
 //
 
@@ -33,4 +33,6 @@
 	void set_value( std::string newValue ) { rep = newValue; }
 
+	/// generates a boolean constant of the given bool
+	static Constant from_bool( bool b );
 	/// generates an integer constant of the given int
 	static Constant from_int( int i );
Index: src/SynTree/Mutator.cc
===================================================================
--- src/SynTree/Mutator.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/SynTree/Mutator.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Thu Mar  8 16:36:00 2017
-// Update Count     : 23
+// Last Modified On : Thu Jun 22 13:43:00 2017
+// Update Count     : 24
 //
 
@@ -162,4 +162,5 @@
 	tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
 	mutateAll( tryStmt->get_catchers(), *this );
+	tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) );
 	return tryStmt;
 }
@@ -167,4 +168,5 @@
 Statement *Mutator::mutate( CatchStmt *catchStmt ) {
 	catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
+	catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) );
 	catchStmt->set_body( maybeMutate( catchStmt->get_body(), *this ) );
 	return catchStmt;
Index: src/SynTree/Visitor.cc
===================================================================
--- src/SynTree/Visitor.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/SynTree/Visitor.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Thu Jun  8 16:31:00 2017
-// Update Count     : 25
+// Last Modified On : Thu Jun 22 13:41:00 2017
+// Update Count     : 26
 //
 
@@ -137,8 +137,10 @@
 	maybeAccept( tryStmt->get_block(), *this );
 	acceptAll( tryStmt->get_catchers(), *this );
+	maybeAccept( tryStmt->get_finally(), *this );
 }
 
 void Visitor::visit( CatchStmt *catchStmt ) {
 	maybeAccept( catchStmt->get_decl(), *this );
+	maybeAccept( catchStmt->get_cond(), *this );
 	maybeAccept( catchStmt->get_body(), *this );
 }
Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/libcfa/Makefile.am	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -72,5 +72,5 @@
 libcfa_a_CFLAGS = -nodebug -O2
 libcfa_d_a_SOURCES = ${libsrc}
-libcfa_d_a_CFLAGS = -debug -O0
+libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
 
 stdhdr = ${shell echo stdhdr/*}
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/libcfa/Makefile.in	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -332,5 +332,5 @@
 libcfa_a_CFLAGS = -nodebug -O2
 libcfa_d_a_SOURCES = ${libsrc}
-libcfa_d_a_CFLAGS = -debug -O0
+libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
 stdhdr = ${shell echo stdhdr/*}
 cfa_includedir = $(CFA_INCDIR)
Index: src/main.cc
===================================================================
--- src/main.cc	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/main.cc	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -186,7 +186,13 @@
 		if ( ! nopreludep ) {							// include gcc builtins
 			// -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
+			// Read to cfa builtins, if not generating the cfa library
 			FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
 			assertf( builtins, "cannot open builtins.cf\n" );
 			parse( builtins, LinkageSpec::Compiler );
+
+			// Read to gcc builtins, if not generating the cfa library
+			FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" );
+			assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
+			parse( gcc_builtins, LinkageSpec::Compiler );
 
 			// read the extra prelude in, if not generating the cfa library
Index: src/prelude/Makefile.am
===================================================================
--- src/prelude/Makefile.am	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/prelude/Makefile.am	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -20,5 +20,5 @@
 # put into lib for now
 cfalibdir = ${CFA_LIBDIR}
-cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
+cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
 noinst_DATA = ../libcfa/libcfa-prelude.c
 
@@ -28,8 +28,8 @@
 
 # create forward declarations for gcc builtins
-builtins.cf : builtins.c prototypes.sed
+gcc-builtins.cf : gcc-builtins.c prototypes.sed
 	${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
 
-builtins.c : builtins.def prototypes.awk
+gcc-builtins.c : builtins.def prototypes.awk
 	${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
 
@@ -38,9 +38,13 @@
 prototypes.awk :
 
-../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
+# create forward declarations for cfa builtins
+builtins.cf : builtins.c
+	${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
+
+../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
 	${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
 
-bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
+bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
 	${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
 
-MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
+MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
Index: src/prelude/Makefile.in
===================================================================
--- src/prelude/Makefile.in	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/prelude/Makefile.in	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -211,7 +211,7 @@
 # put into lib for now
 cfalibdir = ${CFA_LIBDIR}
-cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
+cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
 noinst_DATA = ../libcfa/libcfa-prelude.c
-MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
+MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
 all: all-am
 
@@ -425,8 +425,8 @@
 
 # create forward declarations for gcc builtins
-builtins.cf : builtins.c prototypes.sed
+gcc-builtins.cf : gcc-builtins.c prototypes.sed
 	${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
 
-builtins.c : builtins.def prototypes.awk
+gcc-builtins.c : builtins.def prototypes.awk
 	${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
 
@@ -435,8 +435,12 @@
 prototypes.awk :
 
-../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
+# create forward declarations for cfa builtins
+builtins.cf : builtins.c
+	${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
+
+../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
 	${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
 
-bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
+bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
 	${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
 
Index: src/prelude/builtins.c
===================================================================
--- src/prelude/builtins.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/prelude/builtins.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,1 @@
+typedef unsigned long long __cfaabi_exception_type_t;
Index: src/tests/preempt_longrun/Makefile.am
===================================================================
--- src/tests/preempt_longrun/Makefile.am	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/tests/preempt_longrun/Makefile.am	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -26,5 +26,5 @@
 CC = @CFA_BINDIR@/@CFA_NAME@
 
-TESTS = create stack yield
+TESTS = barge block create disjoint processor stack wait yield
 
 .INTERMEDIATE: ${TESTS}
Index: src/tests/preempt_longrun/Makefile.in
===================================================================
--- src/tests/preempt_longrun/Makefile.in	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/tests/preempt_longrun/Makefile.in	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -183,5 +183,5 @@
 REPEAT = ${abs_top_srcdir}/tools/repeat -s
 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
-TESTS = create stack yield
+TESTS = barge block create disjoint processor stack wait yield
 all: all-am
 
Index: src/tests/preempt_longrun/barge.c
===================================================================
--- src/tests/preempt_longrun/barge.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/tests/preempt_longrun/barge.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,1 @@
+../sched-int-barge.c
Index: src/tests/preempt_longrun/block.c
===================================================================
--- src/tests/preempt_longrun/block.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/tests/preempt_longrun/block.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,1 @@
+../sched-int-block.c
Index: src/tests/preempt_longrun/disjoint.c
===================================================================
--- src/tests/preempt_longrun/disjoint.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/tests/preempt_longrun/disjoint.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,1 @@
+../sched-int-disjoint.c
Index: src/tests/preempt_longrun/wait.c
===================================================================
--- src/tests/preempt_longrun/wait.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
+++ src/tests/preempt_longrun/wait.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -0,0 +1,1 @@
+../sched-int-wait.c
Index: src/tests/sched-int-block.c
===================================================================
--- src/tests/sched-int-block.c	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/tests/sched-int-block.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -5,5 +5,7 @@
 #include <thread>
 
-static const unsigned N = 100_000;
+#ifndef N
+#define N 100_000
+#endif
 
 enum state_t { WAITED, SIGNAL, BARGE };
Index: src/tests/sched-int-disjoint.c
===================================================================
--- src/tests/sched-int-disjoint.c	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/tests/sched-int-disjoint.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -4,5 +4,7 @@
 #include <thread>
 
+#ifndef N
 #define N 100_000
+#endif
 
 enum state_t { WAIT, SIGNAL, BARGE };
Index: src/tests/sched-int-wait.c
===================================================================
--- src/tests/sched-int-wait.c	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ src/tests/sched-int-wait.c	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -5,5 +5,7 @@
 #include <thread>
 
-static const int N = 10_000;
+#ifndef N
+#define N 10_000
+#endif
 
 monitor global_t {};
Index: tools/repeat
===================================================================
--- tools/repeat	(revision fda816874a6a323b57c9ce0409b20c6c3ddea4cf)
+++ tools/repeat	(revision 16c95e3b72f9df582d5897baadd9484ebf9e676d)
@@ -20,5 +20,5 @@
 for (( i = 0; i < ITERATION; i ++ )); do
 	echo -ne "\r$i / $ITERATION"
-	$@ &
+	$@ > /dev/null &
 	child=$! 
 	wait "$child"
