Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 593370c331acdc999e4d5d6c09865db01b8c63db)
+++ src/CodeGen/CodeGenerator.cc	(revision 70a5acf64cb1850994236fd2ed4362de64437a59)
@@ -116,5 +116,5 @@
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), endl( *this ) {}
+	CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks, bool printExprTypes ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), printExprTypes( printExprTypes ), endl( *this ) {}
 
 	string CodeGenerator::mangleName( DeclarationWithType * decl ) {
@@ -157,4 +157,14 @@
 		node->print( ss );
 		assertf( false, "Unhandled node reached in CodeGenerator: %s", ss.str().c_str() );
+	}
+
+	// *** Expression
+	void CodeGenerator::previsit( Expression * node ) {
+		previsit( (BaseSyntaxNode *)node );
+		GuardAction( [this, node](){
+			if ( printExprTypes ) {
+				output << " /* " << genType( node->result, "", pretty, genC ) << " */ ";
+			}
+		} );
 	}
 
Index: src/CodeGen/CodeGenerator.h
===================================================================
--- src/CodeGen/CodeGenerator.h	(revision 593370c331acdc999e4d5d6c09865db01b8c63db)
+++ src/CodeGen/CodeGenerator.h	(revision 70a5acf64cb1850994236fd2ed4362de64437a59)
@@ -27,8 +27,8 @@
 
 namespace CodeGen {
-	struct CodeGenerator : public WithShortCircuiting, public WithVisitorRef<CodeGenerator> {
+	struct CodeGenerator : public WithShortCircuiting, public WithGuards, public WithVisitorRef<CodeGenerator> {
 	  static int tabsize;
 
-		CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false );
+		CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false, bool printExprTypes = false );
 
 		//*** Turn off visit_children for all nodes
@@ -37,4 +37,7 @@
 		//*** Error for unhandled node types
 		void postvisit( BaseSyntaxNode * );
+
+		//*** print type for all expressions
+		void previsit( Expression * node );
 
 		//*** Declaration
@@ -140,4 +143,5 @@
 		bool genC = false;    // true if output has to be C code
 		bool lineMarks = false;
+		bool printExprTypes = false;
 	public:
 		LineEnder endl;
Index: src/CodeGen/Generate.cc
===================================================================
--- src/CodeGen/Generate.cc	(revision 593370c331acdc999e4d5d6c09865db01b8c63db)
+++ src/CodeGen/Generate.cc	(revision 70a5acf64cb1850994236fd2ed4362de64437a59)
@@ -46,8 +46,8 @@
 	} // namespace
 
-	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks ) {
+	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks, bool printExprTypes ) {
 		cleanTree( translationUnit );
 
-		PassVisitor<CodeGenerator> cgv( os, pretty, generateC, lineMarks );
+		PassVisitor<CodeGenerator> cgv( os, pretty, generateC, lineMarks, printExprTypes );
 		for ( auto & dcl : translationUnit ) {
 			if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
@@ -66,5 +66,5 @@
 			os << CodeGen::genPrettyType( type, "" );
 		} else {
-			PassVisitor<CodeGenerator> cgv( os, true, false, false );
+			PassVisitor<CodeGenerator> cgv( os, true, false, false, false );
 			node->accept( cgv );
 		}
Index: src/CodeGen/Generate.h
===================================================================
--- src/CodeGen/Generate.h	(revision 593370c331acdc999e4d5d6c09865db01b8c63db)
+++ src/CodeGen/Generate.h	(revision 70a5acf64cb1850994236fd2ed4362de64437a59)
@@ -24,5 +24,5 @@
 namespace CodeGen {
 	/// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.)
-	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false );
+	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false, bool printTypeExpr = false );
 
 	/// Generate code for a single node -- helpful for debugging in gdb
