Index: tools/prettyprinter/filter.cc
===================================================================
--- tools/prettyprinter/filter.cc	(revision 2b7afbd1825f965361012fcabf4e83ddaf392468)
+++ tools/prettyprinter/filter.cc	(revision c9383ee129f19e14e79cdf7dfbed73ff89c02129)
@@ -10,6 +10,6 @@
 // Created On       : Tue Apr  9 22:33:44 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 28 22:56:58 2017
-// Update Count     : 72
+// Last Modified On : Thu Jun 29 08:56:46 2017
+// Update Count     : 73
 // 
 
@@ -22,8 +22,8 @@
 
 
-void (*filter)( Token *tree ) = 0;
-
-
-void freeTree( Token *tree ) {				// postfix tree traversal
+void (* filter)( Token * tree ) = 0;
+
+
+void freeTree( Token * tree ) {							// postfix tree traversal
 	if ( tree == NULL ) return;
 	if ( tree->down != NULL ) freeTree( tree->down );
@@ -34,5 +34,5 @@
 
 
-void Identity( Token *tree ) {				// prefix tree traversal
+void Identity( Token * tree ) {							// prefix tree traversal
 	if ( tree == NULL ) return;
 	// print only the terminals
@@ -43,9 +43,9 @@
 
 
-static void Parse_Tree1( Token *tree, int indent ) {	// prefix tree traversal
+static void Parse_Tree1( Token * tree, int indent ) {	// prefix tree traversal
 	cout << string( indent, ' ' );
-	if ( tree->isTerminal() ) {				// terminals
+	if ( tree->isTerminal() ) {							// terminals
 		cout << "\"" << tree->getText() << "\"";
-	} else {						// non-terminals
+	} else {											// non-terminals
 		cout << tree->getText();
 	} // if
@@ -57,5 +57,5 @@
 } // Parse_Tree1
 
-void Parse_Tree( Token *tree ) {
+void Parse_Tree( Token * tree ) {
 	if ( tree == NULL ) return;
 	Parse_Tree1( tree, 0 );
@@ -63,16 +63,16 @@
 
 
-void Nocode( Token *tree ) {				// prefix tree traversal
+void Nocode( Token * tree ) {							// prefix tree traversal
 	static bool declprt = true;
 	if ( tree == NULL ) return;
 
-	if ( tree->isTerminal() ) {				// terminals
+	if ( tree->isTerminal() ) {							// terminals
 		cout << tree->getWS() << tree->getText();
-	} else {						// non-terminals
+	} else {											// non-terminals
 		switch ( tree->getKind() ) {
 		  case _RHS: {
-			  int first = 0;				// first RHS after ':' or '|' treated specially
+			  int first = 0;							// first RHS after ':' or '|' treated specially
 			  int push = 0, pop = 0;
-			  for ( Token *i = tree->down; i != 0; i = i->left ) {
+			  for ( Token * i = tree->down; i != 0; i = i->left ) {
 				  switch ( i->getKind() ) {
 					case _ACTION:
@@ -82,9 +82,9 @@
 					  break;
 					case _PREC:
-					  Nocode( i->down );		// print verbatim
-					  break;
-					case '|':				// start of alternative and special case
+					  Nocode( i->down );				// print verbatim
+					  break;
+					case '|':							// start of alternative and special case
 					  first = 0;
-					case ';':				// print with whitespace
+					case ';':							// print with whitespace
 					  cout << string( (push * 4 + pop * 3) / 7, '\t' );
 					  push = pop = 0;
@@ -95,5 +95,5 @@
 						  if ( i->getText() == "push" ) {
 							  push += 1;
-							  if ( first == 0 ) {	// first RHS after ':' or '|' ?
+							  if ( first == 0 ) {		   // first RHS after ':' or '|' ?
 								  cout << i->getComment(); // ignore rhs but print its comment, if any
 							  } // if 
@@ -101,5 +101,5 @@
 						  } else if ( i->getText() == "pop" ) {
 							  pop += 1;
-							  if ( first == 0 ) {	// first RHS after ':' or '|' ?
+							  if ( first == 0 ) {		   // first RHS after ':' or '|' ?
 								  cout << i->getComment(); // ignore rhs but print its comment, if any
 							  } // if 
@@ -107,8 +107,6 @@
 						  } // if
 					  } // if
-					  // If there is a comment or this is the first RHS after
-					  // ':' or '|', then include the whitespace before the
-					  // token. Otherwise, fold the token onto the same line
-					  // separated with a blank.
+					  // If there is a comment or this is the first RHS after ':' or '|', then include the whitespace
+					  // before the token. Otherwise, fold the token onto the same line separated with a blank.
 					  string t1( i->getText() );
 					  if ( i->isComment() || first == 0 ) {
@@ -128,13 +126,13 @@
 			  break;
 		  }
-		  case _LITERALBLOCK:				// ignore code but print its comment, if any
+		  case _LITERALBLOCK:							// ignore code but print its comment, if any
 			cout << tree->down->getComment();
 			break;
-		  case _DECLARATION: {				// ignore certain declarations
-			  int kind = tree->down->getKind();		// get kind of declaration
+		  case _DECLARATION: {							// ignore certain declarations
+			  int kind = tree->down->getKind();			// get kind of declaration
 			  if ( kind != UNION && kind != TYPE ) {
 				  declprt = true;
-				  Nocode( tree->down );			// print verbatim
-			  } else if ( declprt ) {			// ignore declaration but print its comment, if any
+				  Nocode( tree->down );					// print verbatim
+			  } else if ( declprt ) {					// ignore declaration but print its comment, if any
 				  declprt = false;
 				  cout << tree->down->getComment();
@@ -142,5 +140,5 @@
 			  break;
 		  }
-		  case _USERSECTION_OPT:			// ignore but add newline at the end
+		  case _USERSECTION_OPT:						// ignore but add newline at the end
 			cout << endl;
 			break;
@@ -153,8 +151,8 @@
 
 
-void LaTeX( Token *tree ) {				// prefix tree traversal
-	if ( tree == NULL ) return;
-
-	if ( tree->isTerminal() ) {				// terminals
+void LaTeX( Token * tree ) {							// prefix tree traversal
+	if ( tree == NULL ) return;
+
+	if ( tree->isTerminal() ) {							// terminals
 		cout << tree->getWS() << tree->getText();
 		if ( tree->getKind() == IDENTIFIER ) {
@@ -162,10 +160,10 @@
 			cout << "\\(\\index{" << id << "@\\protect\\LGbegin\\protect\\lgrinde\\)" << id << "\\(\\protect\\endlgrinde\\protect\\LGend{}}\\)";
 		} // if
-	} else {						// non-terminals
+	} else {											// non-terminals
 		switch ( tree->getKind() ) {
 		  case _RHS: {
-			  int first = 0;				// first RHS after ':' or '|' treated specially
+			  int first = 0;							// first RHS after ':' or '|' treated specially
 			  int push = 0, pop = 0;
-			  for ( Token *i = tree->down; i != 0; i = i->left ) {
+			  for ( Token * i = tree->down; i != 0; i = i->left ) {
 				  switch ( i->getKind() ) {
 					case _ACTION:
@@ -173,10 +171,10 @@
 					  break;
 					case _PREC:
-					  LaTeX( i->down );			// print verbatim
-					  break;
-					case '|':				// start of alternative and special case
+					  LaTeX( i->down );					// print verbatim
+					  break;
+					case '|':							// start of alternative and special case
 					  first = 0;
 					  push = pop = 0;
-					case ';':				// print with whitespace
+					case ';':							// print with whitespace
 					  cout << i->getWS() << i->getText();
 					  break;
@@ -191,8 +189,6 @@
 						  } // if
 					  } // if
-					  // If there is a comment or this is the first RHS after
-					  // ':' or '|', then include the whitespace before the
-					  // token. Otherwise, fold the token onto the same line
-					  // separated with a blank.
+					  // If there is a comment or this is the first RHS after ':' or '|', then include the whitespace
+					  // before the token. Otherwise, fold the token onto the same line separated with a blank.
 					  string t1( i->getText() );
 					  if ( i->isComment() || first == 0 ) {
@@ -216,15 +212,15 @@
 			  break;
 		  }
-		  case _LITERALBLOCK:				// ignore code but print its comment, if any
+		  case _LITERALBLOCK:							// ignore code but print its comment, if any
 			cout << tree->down->getComment();
 			break;
-		  case _DECLARATION: {				// ignore certain declarations
-			  int kind = tree->down->getKind();	// get kind of declaration
+		  case _DECLARATION: {							// ignore certain declarations
+			  int kind = tree->down->getKind();			// get kind of declaration
 			  if ( kind != UNION && kind != TYPE ) {
-				  LaTeX( tree->down );		// print verbatim
+				  LaTeX( tree->down );					// print verbatim
 			  } // if
 			  break;
 		  }
-		  case _USERSECTION_OPT:			// ignore but add newline at the end
+		  case _USERSECTION_OPT:						// ignore but add newline at the end
 			cout << endl;
 			break;
@@ -237,5 +233,5 @@
 
 
-void HTML( Token *tree ) {				// prefix tree traversal
+void HTML( Token * tree ) {								// prefix tree traversal
 	cerr << "ERROR: html style not implemented" << endl;
 } // HTML
Index: tools/prettyprinter/filter.h
===================================================================
--- tools/prettyprinter/filter.h	(revision 2b7afbd1825f965361012fcabf4e83ddaf392468)
+++ tools/prettyprinter/filter.h	(revision c9383ee129f19e14e79cdf7dfbed73ff89c02129)
@@ -10,6 +10,6 @@
 // Created On       : Tue Apr  9 22:31:18 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 28 22:57:04 2017
-// Update Count     : 9
+// Last Modified On : Thu Jun 29 08:28:32 2017
+// Update Count     : 10
 // 
 
@@ -19,12 +19,12 @@
 #include "parser.hh"
 
-extern void (*filter)( Token *tree );			// pointer to filter for parse tree
-void freeTree( Token *tree );				// free storage for parse tree
+extern void (* filter)( Token * tree );					// pointer to filter for parse tree
+void freeTree( Token * tree );							// free storage for parse tree
 
-void Identity( Token *tree );				// parse-tree filters
-void Parse_Tree( Token *tree );
-void Nocode( Token *tree );
-void LaTeX( Token *tree );
-void HTML( Token *tree );
+void Identity( Token * tree );							// parse-tree filters
+void Parse_Tree( Token * tree );
+void Nocode( Token * tree );
+void LaTeX( Token * tree );
+void HTML( Token * tree );
 
 #endif // __FILTER_H__
Index: tools/prettyprinter/main.cc
===================================================================
--- tools/prettyprinter/main.cc	(revision 2b7afbd1825f965361012fcabf4e83ddaf392468)
+++ tools/prettyprinter/main.cc	(revision c9383ee129f19e14e79cdf7dfbed73ff89c02129)
@@ -10,46 +10,71 @@
 // Created On       : Wed Jun 28 22:57:26 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 28 22:58:40 2017
-// Update Count     : 3
+// Last Modified On : Thu Jun 29 09:02:37 2017
+// Update Count     : 15
 // 
 
 #include <iostream>
+#include <fstream>
 #include <string>
 using namespace std;
+#include <unistd.h>										// close
 #include "filter.h"
 
+extern FILE * yyin;
+extern int yylineno;
 extern int yydebug;
 extern int yyparse( void );
 
 int main( int argc, char *argv[] ) {
-	switch ( argc ) {
-	  case 2: {
-		  string arg( argv[1] );
+	yyin = stdin;
+	filter = Nocode;
 
-		  if ( arg == "-identity" ) {
-			  filter = Identity;
-		  } else if ( arg == "-parse_tree" ) {
-			  filter = Parse_Tree;
-		  } else if ( arg == "-nocode" ) {
-			  filter = Nocode;
-		  } else if ( arg == "-latex" ) {
-			  filter = LaTeX;
-		  } else if ( arg == "-html" ) {
-			  filter = HTML;
-		  } else {
-			  cerr << "Unknown printer option: " << argv[1] << endl;
-			  goto usage;
-		  } // if
-		  break;
-	  }
-	  usage:
-	  default:
-		cerr << "Usage: " << argv[0] << " [-identity | -parse_tree | -nocode | -latex | -html] < bison.y" << endl;
-		exit( -1 );
-	}
+	try {
+		switch ( argc ) {
+		  case 3:
+			yyin = fopen( argv[ 2 ], "r" );
+			if ( yyin == nullptr ) {
+				throw ios_base::failure( "unknown printer option arguments" );
+			} // if
+			// FALL THROUGH
+		  case 2: {
+			  string arg( argv[1] );
+
+			  if ( arg == "-identity" ) {
+				  filter = Identity;
+			  } else if ( arg == "-parse_tree" ) {
+				  filter = Parse_Tree;
+			  } else if ( arg == "-nocode" ) {
+				  filter = Nocode;
+			  } else if ( arg == "-latex" ) {
+				  filter = LaTeX;
+			  } else if ( arg == "-html" ) {
+				  filter = HTML;
+			  } else {
+				  throw ios_base::failure( "unknown printer option arguments" );
+			  } // if
+			  break;
+		  }
+		  default:
+			throw ios_base::failure( "wrong number of arguments" );
+		} // switch
+	} catch( ios_base::failure err ) {
+		cerr << err.what() << endl;
+		cerr << "Usage: [" << argv[0]
+			 << "-identity |"
+			 << "-parse_tree |"
+			 << "-nocode |"
+			 << "-latex |"
+			 << "-html"
+			 << "] [input-file]"
+			 << endl;
+		exit( EXIT_FAILURE );							// TERMINATE
+	} // try
 
 	//yydebug = 1;
 	yyparse();
-}
+
+	if ( yyin != stdin ) fclose( yyin );				// close file, do not delete cin!
+} // main
 
 // Local Variables: //
Index: tools/prettyprinter/parser.yy
===================================================================
--- tools/prettyprinter/parser.yy	(revision 2b7afbd1825f965361012fcabf4e83ddaf392468)
+++ tools/prettyprinter/parser.yy	(revision c9383ee129f19e14e79cdf7dfbed73ff89c02129)
@@ -10,6 +10,6 @@
 // Created On       : Sat Dec 15 13:44:21 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 28 23:27:34 2017
-// Update Count     : 1043
+// Last Modified On : Thu Jun 29 09:26:47 2017
+// Update Count     : 1045
 // 
 
@@ -233,5 +233,5 @@
 		    $$ = $1;
 		}
-| THONG													// bison
+	| THONG												// bison
 	;
 
@@ -276,73 +276,78 @@
 	;
 
-namenolist	: nameno
-			{
-			    //cerr << "namenolist1: " << $1->text << "(" << $1 << ")" << endl;
-			    $$ = nameliststart = $1;
-			}
-		| namenolist nameno
-			{
-			    //cerr << "namenolist2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
-			    $1->left = $2;
-			    $$ = $2;
-			}
-		| namenolist ',' nameno
-			{
-			    //cerr << "namenolist3: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
-			    $1->left = $2;
-			    $2->left = $3;
-			    $$ = $3;
-			}
-		;
-
-nameno		: name
-			{
-			    $$ = new Token( "nameno", _NAMENO );
-			    $$->down = $1;
-			}
-		| name INTEGER
-			{
-			    $$ = new Token( "nameno", _NAMENO );
-			    $1->left = $2;
-			    $$->down = $1;
-			}
-		;
-
-namelist	: name
-			{
-			    //cerr << "namelist1: " << $1->text << "(" << $1 << ")" << endl;
-			    $$ = nameliststart = $1;
-			}
-		| namelist name
-			{
-			    //cerr << "namelist2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
-			    $1->left = $2;
-			    $$ = $2;
-			}
-		| namelist ',' name
-			{
-			    //cerr << "namelist3: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
-			    $1->left = $2;
-			    $2->left = $3;
-			    $$ = $3;
-			}
-		;
-
-name		: IDENTIFIER
-		| CHARACTER
-		;
-
-rulesection	: rules
-			{
-			    //cerr << "rulesection1: " << $1->text << "(" << $1 << ")" << endl;
-			    $$ = new Token( "rulesection", _RULESECTION );
-			    $$->down = $1;
-			}
-		| error					/* no rules */
-			{
-			    cerr << "no rules in the input grammar" << endl;
-			    exit( -1 );
-			}
-		;
+namenolist :
+	nameno
+		{
+			//cerr << "namenolist1: " << $1->text << "(" << $1 << ")" << endl;
+			$$ = nameliststart = $1;
+		}
+	| namenolist nameno
+		{
+		    //cerr << "namenolist2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
+		    $1->left = $2;
+		    $$ = $2;
+		}
+	| namenolist ',' nameno
+		{
+		    //cerr << "namenolist3: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
+		    $1->left = $2;
+		    $2->left = $3;
+		    $$ = $3;
+		}
+	;
+
+nameno :
+	name
+		{
+		    $$ = new Token( "nameno", _NAMENO );
+		    $$->down = $1;
+		}
+	| name INTEGER
+		{
+		    $$ = new Token( "nameno", _NAMENO );
+		    $1->left = $2;
+		    $$->down = $1;
+		}
+	;
+
+namelist :
+	name
+		{
+		    //cerr << "namelist1: " << $1->text << "(" << $1 << ")" << endl;
+		    $$ = nameliststart = $1;
+		}
+	| namelist name
+		{
+		    //cerr << "namelist2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
+		    $1->left = $2;
+		    $$ = $2;
+		}
+	| namelist ',' name
+		{
+		    //cerr << "namelist3: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
+		    $1->left = $2;
+		    $2->left = $3;
+		    $$ = $3;
+		}
+	;
+
+name :
+	IDENTIFIER
+	| CHARACTER
+	;
+
+rulesection :
+	rules
+		{
+		    //cerr << "rulesection1: " << $1->text << "(" << $1 << ")" << endl;
+		    $$ = new Token( "rulesection", _RULESECTION );
+		    $$->down = $1;
+		}
+	| error												// no rules
+		{
+			cerr << "no rules in the input grammar" << endl;
+			exit( -1 );
+		}
+	;
 
 // These grammar rules are complex because the Yacc language is LR(2) due to the optional ';' at the end of rules. The
@@ -351,26 +356,28 @@
 // (rules, rhs) being built but only one list tail can be returned through $$ for chaining.
 
-rules		: lhs rhs
-			{
-			    //cerr << "rules1: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
-			    $$ = rulestart;
-			}
-		| lhs rhs ';'
-			{
-			    //cerr << "rules2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
-			    $2->addDownLeftTail( $3 );
-			    $$ = rulestart;
-			}
-		;
-
-lhs		: IDENTIFIER ':'
-			{
-			    //cerr << "lhs: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
-			    $$ = new Token( "lhs", _LHS );
-			    //cerr << " lhs: "  << $$->text << "(" << $$ << ")" << endl;
-			    $1->left = $2;
-			    $$->down = $1;
-			}
-		;
+rules :
+	lhs rhs
+		{
+		    //cerr << "rules1: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
+		    $$ = rulestart;
+		}
+	| lhs rhs ';'
+		{
+		    //cerr << "rules2: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ") " << $3->text << "(" << $3 << ")" << endl;
+		    $2->addDownLeftTail( $3 );
+		    $$ = rulestart;
+		}
+	;
+
+lhs :
+	IDENTIFIER ':'
+		{
+		    //cerr << "lhs: " << $1->text << "(" << $1 << ") " << $2->text << "(" << $2 << ")" << endl;
+		    $$ = new Token( "lhs", _LHS );
+		    //cerr << " lhs: "  << $$->text << "(" << $$ << ")" << endl;
+		    $1->left = $2;
+		    $$->down = $1;
+		}
+	;
 
 rhs	:
@@ -479,4 +486,5 @@
 ccode_opt :
 	// empty
+		{}
 	| blocks
 	;
Index: tools/prettyprinter/token.cc
===================================================================
--- tools/prettyprinter/token.cc	(revision 2b7afbd1825f965361012fcabf4e83ddaf392468)
+++ tools/prettyprinter/token.cc	(revision c9383ee129f19e14e79cdf7dfbed73ff89c02129)
@@ -10,6 +10,6 @@
 // Created On       : Wed Jun 28 22:46:23 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 28 23:06:07 2017
-// Update Count     : 8
+// Last Modified On : Thu Jun 29 09:33:49 2017
+// Update Count     : 9
 // 
 
@@ -20,9 +20,9 @@
 #include "filter.h"
 
-Token::Token( const string &text, int kind ) : text(text), kind(kind) {
+Token::Token( const string & text, int kind ) : text(text), kind(kind) {
 	left = down = NULL;
 } // Token::Token
 
-Token::Token( const string &text, list<string> &ws_list, int kind ) : text(text), kind(kind) {
+Token::Token( const string & text, list<string> & ws_list, int kind ) : text(text), kind(kind) {
 //    cerr << "Token3 : text \"" << text << "\"";
 //    for ( list<string>::iterator i = ws_list.begin(); i != ws_list.end(); i ++ ) {
@@ -36,6 +36,6 @@
 } // Token::Token
 
-void Token::addLeftTail( Token *n ) {
-	Token *p = this;
+void Token::addLeftTail( Token * n ) {
+	Token * p = this;
 	while ( p->left != 0 ) {
 		p = p->left;
@@ -44,5 +44,5 @@
 } // Token::addLeftTail
 
-void Token::addDownLeftTail( Token *n ) {
+void Token::addDownLeftTail( Token * n ) {
 	if ( down == 0 ) {
 		down = n;
