Index: src/Parser/ParseNode.h
===================================================================
--- src/Parser/ParseNode.h	(revision d1625f82c40dd212bed00f86dad00c157f461b77)
+++ src/Parser/ParseNode.h	(revision 2f22cc45dfe19e7fffcc9e6ab65a3894af3f6dce)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 13:28:16 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Aug  9 12:28:12 2016
-// Update Count     : 389
+// Last Modified On : Wed Aug 10 13:08:46 2016
+// Update Count     : 436
 //
 
@@ -26,4 +26,5 @@
 #include "SynTree/Type.h"
 #include "SynTree/Expression.h"
+#include "SynTree/Statement.h"
 //#include "SynTree/Declaration.h"
 #include "Common/UniqueName.h"
@@ -57,5 +58,5 @@
 	virtual void printList( std::ostream &os, int indent = 0 ) const;
 
-	ParseNode &operator,( ParseNode &);
+	ParseNode &operator,( ParseNode & );
   protected:
 	std::string name;
@@ -134,37 +135,4 @@
 //##############################################################################
 
-// NullExprNode is used in tuples as a place-holder where a tuple component is omitted e.g., [ 2, , 3 ]
-// class NullExprNode : public ExpressionNode {
-//   public:
-// 	NullExprNode() {}
-
-// 	virtual NullExprNode *clone() const { assert( false ); }
-
-// 	virtual void print( std::ostream &os, int indent = 0) const {}
-// 	virtual void printOneLine( std::ostream &os, int indent = 0) const {}
-
-// 	virtual Expression *build() const { assert( false ); return 0; }
-// };
-
-//##############################################################################
-
-// class ConstantNode : public ExpressionNode {
-//   public:
-// 	ConstantNode( ConstantExpr *expr ) : expr( expr ) {}
-// 	ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {}
-// 	virtual ~ConstantNode() {}
-
-// 	virtual ConstantNode *clone() const { assert( false ); return new ConstantNode( *this ); }
-
-// 	ConstantExpr *get_expr() const { return expr; }
-
-// 	virtual void print( std::ostream &os, int indent = 0 ) const {}
-// 	virtual void printOneLine( std::ostream &os, int indent = 0 ) const {}
-
-// 	Expression *build() const { return expr; }
-//   private:
-// 	ConstantExpr *expr;
-// };
-
 Expression *build_constantInteger( std::string &str );
 Expression *build_constantFloat( std::string &str );
@@ -174,75 +142,11 @@
 //##############################################################################
 
-// class VarRefNode : public ExpressionNode {
-//   public:
-// 	VarRefNode( const std::string *, bool isLabel = false );
-// 	VarRefNode( const VarRefNode &other );
-
-// 	virtual Expression *build() const ;
-
-// 	virtual VarRefNode *clone() const { return new VarRefNode( *this ); }
-
-// 	virtual void print( std::ostream &os, int indent = 0 ) const;
-// 	virtual void printOneLine( std::ostream &os, int indent = 0 ) const;
-//   private:
-// 	bool isLabel;
-// };
-
 NameExpr *build_varref( const std::string *name, bool labelp = false );
 
 //##############################################################################
 
-// class DesignatorNode : public ExpressionNode {
-//   public:
-// 	DesignatorNode( ExpressionNode *expr, bool isArrayIndex = false );
-// 	DesignatorNode( const DesignatorNode &other );
-
-// 	virtual Expression *build() const ;
-// 	virtual DesignatorNode *clone() const { return new DesignatorNode( *this ); }
-
-// 	virtual void print( std::ostream &os, int indent = 0 ) const;
-// 	virtual void printOneLine( std::ostream &os, int indent = 0 ) const;
-//   private:
-// 	bool isArrayIndex;
-// };
-
-//##############################################################################
-
-// class TypeValueNode : public ExpressionNode {
-//   public:
-// 	TypeValueNode( DeclarationNode * );
-// 	TypeValueNode( const TypeValueNode &other );
-
-// 	DeclarationNode *get_decl() const { return decl; }
-
-// 	virtual Expression *build() const ;
-
-// 	virtual TypeValueNode *clone() const { return new TypeValueNode( *this ); }
-
-// 	virtual void print( std::ostream &os, int indent = 0) const;
-// 	virtual void printOneLine( std::ostream &os, int indent = 0) const;
-//   private:
-// 	DeclarationNode *decl;
-// };
-
 Expression *build_typevalue( DeclarationNode *decl );
 
 //##############################################################################
-
-// class CompositeExprNode : public ExpressionNode {
-//   public:
-// 	CompositeExprNode( Expression *expr ) : expr( expr ) {}
-// 	CompositeExprNode( const CompositeExprNode &other ) : expr( other.expr->clone() ) {}
-// 	virtual ~CompositeExprNode() {}
-
-// 	CompositeExprNode *clone() const { assert( false ); return new CompositeExprNode( *this ); }
-
-// 	Expression *build() const { return expr; }
-
-// 	void print( std::ostream &os, int indent = 0 ) const {}
-// 	void printOneLine( std::ostream &os, int indent = 0 ) const {}
-//   private:
-// 	Expression *expr;
-// };
 
 enum class OperKinds {
@@ -282,30 +186,4 @@
 //##############################################################################
 
-// class AsmExprNode : public ExpressionNode {
-//   public:
-// 	AsmExprNode();
-// 	AsmExprNode( ExpressionNode *inout, ConstantNode *constraint, ExpressionNode *operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
-// 	virtual ~AsmExprNode() { delete inout; delete constraint; delete operand; }
-
-// 	virtual AsmExprNode *clone() const { return new AsmExprNode( *this ); }
-// 	virtual Expression *build() const;
-
-// 	virtual void print( std::ostream &os, int indent = 0) const;
-// 	virtual void printOneLine( std::ostream &os, int indent = 0) const;
-
-// 	ExpressionNode *get_inout() const { return inout; };
-// 	void set_inout( ExpressionNode *newValue ) { inout = newValue; }
-
-// 	ConstantNode *get_constraint() const { return constraint; };
-// 	void set_constraint( ConstantNode *newValue ) { constraint = newValue; }
-
-// 	ExpressionNode *get_operand() const { return operand; };
-// 	void set_operand( ExpressionNode *newValue ) { operand = newValue; }
-//   private:
-// 	ExpressionNode *inout;
-// 	ConstantNode *constraint;
-// 	ExpressionNode *operand;
-// };
-
 Expression *build_asm( ExpressionNode *inout, ConstantExpr *constraint, ExpressionNode *operand );
 
@@ -328,71 +206,7 @@
 //##############################################################################
 
-class ForCtlExprNode : public ExpressionNode {
-  public:
-	ForCtlExprNode( ParseNode *, ExpressionNode *, ExpressionNode * ) throw ( SemanticError );
-	ForCtlExprNode( const ForCtlExprNode &other );
-	~ForCtlExprNode();
-
-	StatementNode *get_init() const { return init; }
-	ExpressionNode *get_condition() const { return condition; }
-	ExpressionNode *get_change() const { return change; }
-
-	virtual ForCtlExprNode *clone() const { return new ForCtlExprNode( *this ); }
-	virtual Expression *build() const;
-
-	virtual void print( std::ostream &os, int indent = 0 ) const;
-	virtual void printOneLine( std::ostream &os, int indent = 0 ) const;
-  private:
-	StatementNode *init;
-	ExpressionNode *condition;
-	ExpressionNode *change;
-};
-
-//##############################################################################
-
-// class ValofExprNode : public ExpressionNode {
-//   public:
-// 	ValofExprNode();
-// 	ValofExprNode( StatementNode *s = 0 );
-// 	ValofExprNode( const ValofExprNode &other );
-// 	~ValofExprNode();
-
-// 	virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); }
-
-// 	StatementNode *get_body() const { return body; }
-// 	void print( std::ostream &os, int indent = 0 ) const;
-// 	void printOneLine( std::ostream &os, int indent = 0 ) const;
-// 	Expression *build() const;
-
-//   private:
-// 	StatementNode *body;
-// };
-
 Expression *build_valexpr( StatementNode *s );
 
 //##############################################################################
-
-// class CompoundLiteralNode : public ExpressionNode {
-//   public:
-// 	CompoundLiteralNode( DeclarationNode *type, InitializerNode *kids );
-// 	CompoundLiteralNode( const CompoundLiteralNode &type );
-// 	~CompoundLiteralNode();
-
-// 	virtual CompoundLiteralNode *clone() const;
-
-// 	DeclarationNode *get_type() const { return type; }
-// 	CompoundLiteralNode *set_type( DeclarationNode *t ) { type = t; return this; }
-
-// 	InitializerNode *get_initializer() const { return kids; }
-// 	CompoundLiteralNode *set_initializer( InitializerNode *k ) { kids = k; return this; }
-
-// 	void print( std::ostream &os, int indent = 0 ) const;
-// 	void printOneLine( std::ostream &os, int indent = 0 ) const;
-
-// 	virtual Expression *build() const;
-//   private:
-// 	DeclarationNode *type;
-// 	InitializerNode *kids;
-// };
 
 Expression *build_compoundLiteral( DeclarationNode *decl_node, InitializerNode *kids );
@@ -531,5 +345,5 @@
 	static StatementNode *newCatchStmt( DeclarationNode *d = 0, StatementNode *s = 0, bool catchRestP = false );
 
-	StatementNode *set_block( StatementNode *b ) {	block = b; return this; }
+	StatementNode *set_block( StatementNode *b ) { block = b; return this; }
 	StatementNode *get_block() const { return block; }
 
@@ -539,6 +353,6 @@
 	StatementNode::Type get_type() const { return type; }
 
-	StatementNode *add_label( const std::string * );
-	const std::list<std::string> &get_labels() const { return labels; }
+	virtual StatementNode *add_label( const std::string * );
+	virtual std::list<std::string> get_labels() const { return labels; }
 
 	void addDeclaration( DeclarationNode *newDecl ) { decl = newDecl; }
@@ -565,4 +379,41 @@
 }; // StatementNode
 
+class StatementNode2 : public StatementNode {
+  public:
+	StatementNode2() {}
+	StatementNode2( Statement *stmt ) : stmt( stmt ) {}
+	virtual ~StatementNode2() {}
+
+	virtual StatementNode2 *clone() const { assert( false ); return nullptr; }
+	virtual Statement *build() const { return stmt; }
+
+	virtual StatementNode2 *add_label( const std::string * name ) {
+		stmt->get_labels().emplace_back( *name );
+		return this;
+	}
+	virtual std::list<std::string> get_labels() const { assert( false ); return StatementNode::get_labels(); }
+
+	virtual void print( std::ostream &os, int indent = 0 ) {}
+	virtual void printList( std::ostream &os, int indent = 0 ) {}
+  private:
+	Statement *stmt;
+}; // StatementNode
+
+struct ForCtl {
+	ForCtl( ExpressionNode *expr, ExpressionNode *condition, ExpressionNode *change ) :
+		init( new StatementNode( StatementNode::Exp, expr ) ), condition( condition ), change( change ) {}
+	ForCtl( DeclarationNode *decl, ExpressionNode *condition, ExpressionNode *change ) :
+		init( new StatementNode( decl ) ), condition( condition ), change( change ) {}
+
+	StatementNode *init;
+	ExpressionNode *condition;
+	ExpressionNode *change;
+};
+
+Statement *build_if( ExpressionNode *ctl, StatementNode *then_stmt, StatementNode *else_stmt );
+Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt );
+Statement *build_while( ExpressionNode *ctl, StatementNode *stmt, bool kind = false );
+Statement *build_for( ForCtl *forctl, StatementNode *stmt );
+
 //##############################################################################
 
@@ -602,5 +453,5 @@
 
 template< typename SynTreeType, typename NodeType >
-void buildList( const NodeType *firstNode, std::list< SynTreeType *> &outputList ) {
+void buildList( const NodeType *firstNode, std::list< SynTreeType * > &outputList ) {
 	SemanticError errors;
 	std::back_insert_iterator< std::list< SynTreeType *> > out( outputList );
