Index: src/Common/CompilerError.h
===================================================================
--- src/Common/CompilerError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/CompilerError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,40 @@
+//
+// 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.
+//
+// CompilerError.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:20:37 2015
+// Update Count     : 2
+//
+
+#ifndef COMPILER_ERROR_H
+#define COMPILER_ERROR_H
+
+#include <string>
+//#include "../config.h"
+
+class CompilerError : public std::exception {
+  public:
+	CompilerError();
+	CompilerError( std::string what ) : what( what ) {}
+	~CompilerError() throw () {}
+
+	std::string get_what() const { return what; }
+	void set_what( std::string newValue ) { what = newValue; }
+  private:
+	std::string what;
+};
+
+#endif // COMPILER_ERROR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/SemanticError.cc
===================================================================
--- src/Common/SemanticError.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/SemanticError.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,47 @@
+//
+// 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.
+//
+// SemanticError.cc -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:21:25 2015
+// Update Count     : 1
+//
+
+#include <iostream>
+#include <list>
+#include <string>
+#include <algorithm>
+#include <iterator>
+
+#include "SemanticError.h"
+
+SemanticError::SemanticError() {
+}
+
+SemanticError::SemanticError( std::string error ) {
+	errors.push_back( std::string( "Error: " ) + error );
+}
+
+void SemanticError::append( SemanticError &other ) {
+	errors.splice( errors.end(), other.errors );
+}
+
+bool SemanticError::isEmpty() const {
+	return errors.empty();
+}
+
+void SemanticError::print( std::ostream &os ) {
+	std::copy( errors.begin(), errors.end(), std::ostream_iterator< std::string >( os, "\n" ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/SemanticError.h
===================================================================
--- src/Common/SemanticError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/SemanticError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,56 @@
+//
+// 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.
+//
+// SemanticError.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:22:23 2015
+// Update Count     : 1
+//
+
+#ifndef SEMANTICERROR_H
+#define SEMANTICERROR_H
+
+#include <exception>
+#include <string>
+#include <strstream>
+#include <list>
+#include <iostream>
+
+class SemanticError : public std::exception {
+  public:
+	SemanticError();
+	SemanticError( std::string error );
+	template< typename T > SemanticError( const std::string &error, const T *obj );
+	~SemanticError() throw() {}
+
+	void append( SemanticError &other );
+	bool isEmpty() const;
+	void print( std::ostream &os );
+
+	// constructs an exception using the given message and the printed
+	// representation of the obj (T must have a print method)
+  private:
+	std::list< std::string > errors;
+};
+
+template< typename T >
+SemanticError::SemanticError( const std::string &error, const T *obj ) {
+	std::ostrstream os;
+	os << "Error: " << error;
+	obj->print( os );
+	errors.push_back( std::string( os.str(), os.pcount() ) );
+}
+
+#endif // SEMANTICERROR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/UnimplementedError.h
===================================================================
--- src/Common/UnimplementedError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/UnimplementedError.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+// UnimplementedError.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:23:08 2015
+// Update Count     : 1
+//
+
+#ifndef _UNIMPLEMENTEDERROR_H
+#define _UNIMPLEMENTEDERROR_H
+
+#include <string>
+
+class UnimplementedError : public std::exception {
+  public:
+	UnimplementedError();
+	UnimplementedError( std::string what ) : what( what ) {}
+	~UnimplementedError() throw () {}
+  
+	std::string get_what() const { return what; }
+	void set_what( std::string newValue ) { what = newValue; }
+  private:
+	std::string what;
+};
+
+#endif // _UNIMPLEMENTEDERROR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/UniqueName.cc
===================================================================
--- src/Common/UniqueName.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/UniqueName.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+// UniqueName.cc -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:23:41 2015
+// Update Count     : 1
+//
+
+#include <string>
+#include <strstream>
+
+#include "UniqueName.h"
+
+UniqueName::UniqueName( const std::string &base ) : base( base ), count( 0 ) {
+}
+
+std::string UniqueName::newName( const std::string &additional ) {
+	std::ostrstream os;
+	os << base << additional << count++;
+	return std::string( os.str(), os.pcount() );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/UniqueName.h
===================================================================
--- src/Common/UniqueName.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/UniqueName.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,36 @@
+//
+// 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.
+//
+// UniqueName.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:24:20 2015
+// Update Count     : 1
+//
+
+#ifndef UNIQUENAME_H
+#define UNIQUENAME_H
+
+#include <string>
+
+class UniqueName {
+  public:
+	UniqueName( const std::string &base = "" );
+	std::string newName( const std::string &additional = "" );
+  private:
+	std::string base;
+	int count;
+};
+
+#endif // UNIQUENAME_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Common/module.mk
===================================================================
--- src/Common/module.mk	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/module.mk	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,2 @@
+SRC += Common/SemanticError.cc \
+       Common/UniqueName.cc
Index: src/Common/utility.h
===================================================================
--- src/Common/utility.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/Common/utility.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,206 @@
+//
+// 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.
+//
+// utility.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:34:57 2015
+// Update Count     : 3
+//
+
+#ifndef _UTILITY_H
+#define _UTILITY_H
+
+#include <iostream>
+#include <strstream>
+#include <iterator>
+#include <string>
+#include <cctype>
+#include <list>
+
+template< typename T >
+static inline T * maybeClone( const T *orig ) {
+	if ( orig ) {
+		return orig->clone();
+	} else {
+		return 0;
+	} // if
+}
+
+template< typename T, typename U >
+static inline T * maybeBuild( const U *orig ) {
+	if ( orig ) {
+		return orig->build();
+	} else {
+		return 0;
+	} // if
+}
+
+template< typename Input_iterator >
+void printEnums( Input_iterator begin, Input_iterator end, const char * const *name_array, std::ostream &os ) {
+	for ( Input_iterator i = begin; i != end; ++i ) {
+		os << name_array[ *i ] << ' ';
+	} // for
+}
+
+template< typename Container >
+void deleteAll( Container &container ) {
+	for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
+		delete *i;
+	} // for
+}
+
+template< typename Container >
+void printAll( const Container &container, std::ostream &os, int indent = 0 ) {
+	for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
+		if ( *i ) {
+			os << std::string(indent,  ' ');
+			(*i)->print( os, indent + 2 );
+			os << std::endl;
+		} // if
+	} // for
+}
+
+template< typename SrcContainer, typename DestContainer >
+void cloneAll( const SrcContainer &src, DestContainer &dest ) {
+	typename SrcContainer::const_iterator in = src.begin();
+	std::back_insert_iterator< DestContainer > out( dest );
+	while ( in != src.end() ) {
+		*out++ = (*in++)->clone();
+	} // while
+}
+
+template< typename Container >
+void assertAll( const Container &container ) {
+	int count = 0;
+	for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
+		if ( !(*i) ) {
+			std::cerr << count << " is null" << std::endl;
+		} // if
+	} // for
+}
+
+static inline std::string assign_strptr( std::string *str ) {
+	if ( str == 0 ) {
+		return "";
+	} else {
+		std::string tmp;
+		tmp = *str;
+		delete str;
+		return tmp;
+	} // if
+}
+
+template< class T, typename ResultType, ResultType (T::* memfunc)() >
+ResultType dispatch( T *pT ) {
+	return (pT->*memfunc)();
+}
+
+template < typename T >
+std::list<T> tail( std::list<T> l ) {
+	if ( ! l.empty() ) {
+		std::list<T> ret(++(l.begin()), l.end());
+		return ret;
+	} // if
+}
+
+template < typename T >
+std::list<T> flatten( std::list < std::list<T> > l) {
+	typedef std::list <T> Ts;
+
+	Ts ret;
+
+	switch ( l.size() ) {
+	  case 0:
+		return ret;
+	  case 1:
+		return l.front();
+	  default:
+		ret = flatten(tail(l));
+		ret.insert(ret.begin(), l.front().begin(), l.front().end());
+		return ret;
+	} // switch
+}
+
+template < typename T > 
+std::string toString ( T value ) {
+	std::ostrstream os;
+  
+	os << value; // << std::ends;
+	os.freeze( false );
+
+	return std::string(os.str(), os.pcount());
+}
+
+template< class Constructed, typename Arg >
+Constructed *ctor( Arg arg ) {
+	Constructed *c = new Constructed( arg );
+	return c;
+}
+
+template< class Constructed, typename Arg >
+Constructed ctor_noptr( Arg arg ) {
+	return Constructed( arg );
+}
+
+template< typename T >
+void replace( std::list< T > &org, typename std::list< T >::iterator pos, std::list< T > &with ) {
+	// TIter should secretly be a typename std::list< T >::iterator
+	//   ( g++ 3.2 issues a 'is implicitly a typename' warning if I make this explicit )
+	typename std::list< T >::iterator next = pos; advance( next, 1 );
+
+	//if ( next != org.end() ) {
+	org.erase( pos );
+	org.splice( next, with );
+	//}
+
+	return;
+}
+
+template< typename T1, typename T2 >
+T2 *cast_ptr( T1 *from ) {
+	return dynamic_cast< T2 * >( from );
+}
+
+template< class Exception, typename Arg >
+void inline assert_throw( bool pred, Arg arg ) {
+	if (pred) throw Exception( arg );
+}
+
+template< typename T >
+struct is_null_pointer {
+	bool operator()( const T *ptr ) { return ( ptr == 0 ); }
+};
+
+template< class InputIterator, class OutputIterator, class Predicate >
+void filter(InputIterator begin, InputIterator end, OutputIterator out, Predicate pred) {
+	while ( begin++ != end )
+		if ( pred(*begin) ) *out++ = *begin;
+
+	return;
+}
+
+template< class InputIterator1, class InputIterator2, class OutputIterator >
+void zip( InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, OutputIterator out ) {
+	while ( b1 != e1 && b2 != e2 )
+		*out++ = std::pair<typename InputIterator1::value_type, typename InputIterator2::value_type>(*b1++, *b2++);
+}
+
+template< class InputIterator1, class InputIterator2, class OutputIterator, class BinFunction >
+void zipWith( InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, OutputIterator out, BinFunction func ) {
+	while ( b1 != e1 && b2 != e2 )
+		*out++ = func(*b1++, *b2++);
+}
+
+#endif // _UTILITY_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
