Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/App.config
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/App.config	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/App.config	(revision 14328)
@@ -1,6 +1,6 @@
-﻿<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
     </startup>
 </configuration>
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/HeuristicLab.Algorithms.PushGP.Cli.csproj
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/HeuristicLab.Algorithms.PushGP.Cli.csproj	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/HeuristicLab.Algorithms.PushGP.Cli.csproj	(revision 14328)
@@ -10,7 +10,8 @@
     <RootNamespace>HeuristicLab.Algorithms.PushGP.Cli</RootNamespace>
     <AssemblyName>HeuristicLab.Algorithms.PushGP.Cli</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -32,4 +33,5 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <LangVersion>5</LangVersion>
   </PropertyGroup>
   <ItemGroup>
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs	(revision 14328)
@@ -12,6 +12,6 @@
         static void Main(string[] args)
         {
-            //Stepwise().Wait();
-            PerformanceTest();
+            Stepwise().Wait();
+            //PerformanceTestInterpreter();
             //PerformanceTestCodeGenerator();
 
@@ -22,9 +22,11 @@
         static async Task Stepwise()
         {
-            var program = PushGPInterpreter.Encode("( 2 3 INTEGER.* 4.1 5.2 FLOAT.+ TRUE FALSE BOOLEAN.OR )");
+            var program = PushGPInterpreter.Encode(@"( CODE.QUOTE ( INTEGER.POP 1 )
+                                                       CODE.QUOTE ( CODE.DUP INTEGER.DUP 1 INTEGER.- CODE.DO INTEGER.* )
+                                                       INTEGER.DUP 2 INTEGER.< CODE.IF )");
             var interpreter = new PushGPInterpreter();
 
-            var task = interpreter.InterpreteAsync(program);
-            await interpreter.PauseAsync();
+            interpreter.IntegerStack.Push(5);
+            interpreter.InterpretAsync(program, true).Wait();
 
             while (!interpreter.IsCompleted)
@@ -49,5 +51,5 @@
         }
 
-        static void PerformanceTest()
+        static void PerformanceTestInterpreter()
         {
             var program = PushGPInterpreter.Encode("( 5 INTEGER.DUP INTEGER.+ )");
@@ -58,6 +60,6 @@
             for (var i = 0; i < 20000000; i++)
             {
-                interpreter.Interprete(program);
-                interpreter.Reset();
+                interpreter.Interpret(program);
+                interpreter.Clear();
             }
             sw.Stop();
@@ -71,9 +73,8 @@
 
             sw.Start();
-            var expressions = CodeGenerator.RandomCode(10000000);
+            var expressions = CodeGenerator.RandomCode(3000000);
             sw.Stop();
 
-            Console.WriteLine($"Count: {expressions.Count()}");
-            Console.WriteLine(sw.Elapsed);
+            Console.WriteLine(string.Format("Generated {0} in {1}", expressions.Count(), sw.Elapsed));
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Exporter/Exporter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Exporter/Exporter.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Exporter/Exporter.cs	(revision 14328)
@@ -0,0 +1,12 @@
+﻿using HeuristicLab.Algorithms.PushGP.Expressions;
+
+namespace HeuristicLab.Algorithms.PushGP.Exporter
+{
+    public static class Exporter
+    {
+        public static string ToString(Expression expression)
+        {
+            return expression.ToString();
+        }
+    }
+}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/ExpressionCreatorTable.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/ExpressionCreatorTable.cs	(revision 14327)
+++ 	(revision )
@@ -1,93 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-using HeuristicLab.Algorithms.PushGP.Expressions;
-
-using LinqExpression = System.Linq.Expressions.Expression;
-
-namespace HeuristicLab.Algorithms.PushGP
-{
-    public static class ExpressionCreatorTable
-    {
-        private static Dictionary<OpCode, Func<Expression>> symbolTable = new Dictionary<OpCode, Func<Expression>>
-        {
-            #region Exec
-            { OpCode.ExecPop, GetExpressionCreator(typeof(ExecPopExpression)) },
-            { OpCode.ExecDup, GetExpressionCreator(typeof(ExecDuplicateExpression)) },
-            { OpCode.ExecDefine, GetExpressionCreator(typeof(ExecDefineExpression)) },
-            { OpCode.ExecDoXRange, GetExpressionCreator(typeof(ExecDoRangeExpression)) },
-            { OpCode.ExecY, GetExpressionCreator(typeof(ExecYExpression)) },
-            { OpCode.ExecIf, GetExpressionCreator(typeof(ExecIfExpression)) },
-            #endregion
-
-            #region Code
-            { OpCode.CodeDup, GetExpressionCreator(typeof(CodeDuplicateExpression)) },
-            { OpCode.CodeDefine, GetExpressionCreator(typeof(CodeDefineExpression)) },
-            { OpCode.CodeQuote, GetExpressionCreator(typeof(CodeQuoteExpression)) },
-            { OpCode.CodeDo, GetExpressionCreator(typeof(CodeDoExpression)) },
-            { OpCode.CodeIf, GetExpressionCreator(typeof(CodeIfExpression)) },
-            #endregion Code
-
-            #region Name
-            { OpCode.NamePop, GetExpressionCreator(typeof(NamePopExpression)) },
-            { OpCode.NameDup, GetExpressionCreator(typeof(NameDuplicateExpression)) },
-            #endregion Name
-
-            #region Boolean
-            { OpCode.BooleanPop, GetExpressionCreator(typeof(BooleanPopExpression)) },
-            { OpCode.BooleanDup, GetExpressionCreator(typeof(BooleanDuplicateExpression)) },
-            { OpCode.BooleanDefine, GetExpressionCreator(typeof(BooleanDefineExpression)) },
-            { OpCode.BooleanOr, GetExpressionCreator(typeof(BooleanOrExpression)) },
-            { OpCode.BooleanAnd, GetExpressionCreator(typeof(BooleanAndExpression)) },
-            #endregion Boolean
-
-            #region Integer
-            { OpCode.IntegerPop, GetExpressionCreator(typeof(IntegerPopExpression)) },
-            { OpCode.IntegerDup, GetExpressionCreator(typeof(IntegerDuplicateExpression)) },
-            { OpCode.IntegerDefine, GetExpressionCreator(typeof(IntegerDefineExpression)) },
-            { OpCode.IntegerMultiply, GetExpressionCreator(typeof(IntegerMultiplyExpression)) },
-            { OpCode.IntegerDivide, GetExpressionCreator(typeof(IntegerDivideExpression)) },
-            { OpCode.IntegerAdd, GetExpressionCreator(typeof(IntegerAddExpression)) },
-            { OpCode.IntegerSubtract, GetExpressionCreator(typeof(IntegerSubtractExpression)) },
-            { OpCode.IntegerMin, GetExpressionCreator(typeof(IntegerMinExpression)) },
-            { OpCode.IntegerMax, GetExpressionCreator(typeof(IntegerMaxExpression)) },
-            { OpCode.IntegerSmallerThan, GetExpressionCreator(typeof(IntegerSmallerThanExpression)) },
-            { OpCode.IntegerGreaterThan, GetExpressionCreator(typeof(IntegerGreaterThanExpression)) },
-            { OpCode.IntegerEquals, GetExpressionCreator(typeof(IntegerEqualsExpression)) },
-            #endregion Integer
-
-            #region Float
-            { OpCode.FloatPop, GetExpressionCreator(typeof(FloatPopExpression)) },
-            { OpCode.FloatDup, GetExpressionCreator(typeof(FloatDuplicateExpression)) },
-            { OpCode.FloatDefine, GetExpressionCreator(typeof(FloatDefineExpression)) },
-            { OpCode.FloatAdd, GetExpressionCreator(typeof(FloatAddExpression)) },
-            { OpCode.FloatMultiply, GetExpressionCreator(typeof(FloatMultiplyExpression)) },
-            { OpCode.FloatDivide, GetExpressionCreator(typeof(FloatDivideExpression)) },
-            { OpCode.FloatSubtract, GetExpressionCreator(typeof(FloatSubtractExpression)) },
-            { OpCode.FloatMin, GetExpressionCreator(typeof(FloatMinExpression)) },
-            { OpCode.FloatMax, GetExpressionCreator(typeof(FloatMaxExpression)) },
-            { OpCode.FloatSmallerThan, GetExpressionCreator(typeof(FloatSmallerThanExpression)) },
-            { OpCode.FloatGreaterThan, GetExpressionCreator(typeof(FloatGreaterThanExpression)) },
-            { OpCode.FloatEquals, GetExpressionCreator(typeof(FloatEqualsExpression)) },
-            #endregion Float
-        };
-
-        private static Func<Expression> GetExpressionCreator(Type type)
-        {
-            return LinqExpression.Lambda<Func<Expression>>(
-                       LinqExpression.New(type.GetConstructor(Type.EmptyTypes))
-                   ).Compile();
-        }
-
-        public static Func<Expression> GetCreator(OpCode opCode)
-        {
-            Func<Expression> creator;
-            if (symbolTable.TryGetValue(opCode, out creator)) return creator;
-            else throw new NotSupportedException("OpCode: " + opCode);
-        }
-
-        public static bool TryGetCreator(OpCode opCode, out Func<Expression> creator)
-        {
-            return symbolTable.TryGetValue(opCode, out creator);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanAndExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanAndExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class BooleanAndExpression : Expression
-    {
-        public BooleanAndExpression() : base(OpCode.BooleanAnd)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.BooleanStack, 2, values => values[1] && values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanDefineExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanDefineExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class BooleanDefineExpression : Expression
-    {
-        public BooleanDefineExpression() : base(OpCode.BooleanDefine)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Define(
-                interpreterService.BooleanStack,
-                interpreterService.NameStack,
-                interpreterService.CustomExpressions,
-                value => new BooleanPushExpression(value));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class BooleanDuplicateExpression : Expression
-    {
-        public BooleanDuplicateExpression() : base(OpCode.BooleanDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.BooleanStack);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanOrExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanOrExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class BooleanOrExpression : Expression
-    {
-        public BooleanOrExpression() : base(OpCode.BooleanOr)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.BooleanStack, 2, values => values[1] || values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanPopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanPopExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class BooleanPopExpression : Expression
-    {
-        public BooleanPopExpression() : base(OpCode.BooleanPop)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.BooleanStack.Pop();
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanPushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanPushExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Boolean/BooleanPushExpression.cs	(revision 14328)
@@ -1,23 +1,29 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Boolean
 {
     public class BooleanPushExpression : Expression
     {
-        public BooleanPushExpression(bool value) : base(OpCode.BooleanPush)
+        private readonly bool value;
+        public BooleanPushExpression(bool value)
         {
-            this.Value = value;
+            this.value = value;
         }
 
-        public bool Value { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            interpreterService.BooleanStack.Push(Value);
+            interpreter.BooleanStack.Push(this.value);
         }
 
         public override string ToString()
         {
-            return $"{this.Value.ToString().ToUpper()}";
+            return this.value.ToString().ToUpper();
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDefineExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDefineExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDefineExpression.cs	(revision 14328)
@@ -1,21 +1,36 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Expressions.Exec;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class CodeDefineExpression : Expression
     {
-        public CodeDefineExpression() : base(OpCode.CodeDefine)
-        { }
+        public override bool IsCodeOp { get { return true; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            Define(
-                interpreterService.CodeStack,
-                interpreterService.NameStack,
-                interpreterService.CustomExpressions,
-                value => new ExecPushExpression(value));
+            // not enough arguments on stack
+            if (interpreter.NameStack.Count == 0 ||
+                interpreter.CodeStack.Count == 0)
+                return;
 
-            // as the interpreter does not pop code expressions
-            interpreterService.CodeStack.Pop();
+            var name = interpreter.NameStack.Pop();
+            var expression = new ExecPushExpression(interpreter.CodeStack.Top);
+
+            if (interpreter.CustomExpressions.ContainsKey(name))
+            {
+                interpreter.CustomExpressions[name] = expression;
+            }
+            else
+            {
+                interpreter.CustomExpressions.Add(name, expression);
+            }
+
+            interpreter.CodeStack.Pop();
+        }
+
+        public override string ToString()
+        {
+            return Symbols.CodeDefine;
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDoExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDoExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDoExpression.cs	(revision 14328)
@@ -1,19 +1,23 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class CodeDoExpression : Expression
     {
-        public CodeDoExpression() : base(OpCode.CodeDo)
-        { }
+        public override bool IsCodeOp { get { return true; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.CodeStack.Count == 0)
+            if (interpreter.CodeStack.Count == 0)
                 return;
 
-            var expression = interpreterService.CodeStack.Pop();
-            interpreterService.ExecStack.Push(expression);
+            var expression = interpreter.CodeStack.Pop();
+            interpreter.ExecStack.Push(expression);
+        }
+
+        public override string ToString()
+        {
+            return Symbols.CodeDo;
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class CodeDuplicateExpression : Expression
-    {
-        public CodeDuplicateExpression() : base(OpCode.CodeDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.CodeStack);
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeIfExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeIfExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeIfExpression.cs	(revision 14328)
@@ -1,26 +1,30 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class CodeIfExpression : Expression
     {
-        public CodeIfExpression() : base(OpCode.CodeIf)
-        { }
+        public override bool IsCodeOp { get { return true; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.BooleanStack.Count == 0 ||
-                interpreterService.CodeStack.Count < 2)
+            if (interpreter.BooleanStack.Count == 0 ||
+                interpreter.CodeStack.Count < 2)
                 return;
 
-            var condition = interpreterService.BooleanStack.Pop();
-            var expressionFalse = interpreterService.CodeStack.Pop();
-            var expressionTrue = interpreterService.CodeStack.Pop();
+            var condition = interpreter.BooleanStack.Pop();
+            var expressionFalse = interpreter.CodeStack.Pop();
+            var expressionTrue = interpreter.CodeStack.Pop();
 
-            interpreterService.ExecStack.Push(condition
+            interpreter.ExecStack.Push(condition
                 ? expressionTrue
                 : expressionFalse);
         }
+
+        public override string ToString()
+        {
+            return Symbols.CodeIf;
+        }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeNoopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeNoopExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeNoopExpression.cs	(revision 14328)
@@ -1,15 +1,13 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class CodeNoopExpression : Expression
     {
-        public CodeNoopExpression() : base(OpCode.CodeNoop)
+        public override bool IsCodeOp { get { return true; } }
+
+        public override void Eval(IInterpreter interpreter)
         {
-        }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            // nothing to do
+            // do nothing
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodePushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodePushExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,24 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class CodePushExpression : Expression
-    {
-        public CodePushExpression(Expression value) : base(OpCode.CodePush)
-        {
-            this.Value = value;
-        }
-
-        public Expression Value { get; }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.CodeStack.Push(Value);
-        }
-
-        public override string ToString()
-        {
-            return $"{base.ToString()}({this.Value})";
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeQuoteExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeQuoteExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Code/CodeQuoteExpression.cs	(revision 14328)
@@ -1,19 +1,23 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class CodeQuoteExpression : Expression
     {
-        public CodeQuoteExpression() : base(OpCode.CodeQuote)
-        { }
+        public override bool IsCodeOp { get { return true; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.ExecStack.Count == 0)
+            if (interpreter.ExecStack.Count == 0)
                 return;
 
-            var expression = interpreterService.ExecStack.Pop();
-            interpreterService.CodeStack.Push(expression);
+            var expression = interpreter.ExecStack.Pop();
+            interpreter.CodeStack.Push(expression);
+        }
+
+        public override string ToString()
+        {
+            return Symbols.CodeQuote;
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDefineExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDefineExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDefineExpression.cs	(revision 14328)
@@ -1,21 +1,36 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Expressions.Exec;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Code
 {
     public class ExecDefineExpression : Expression
     {
-        public ExecDefineExpression() : base(OpCode.ExecDefine)
-        { }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            Define(
-                interpreterService.ExecStack,
-                interpreterService.NameStack,
-                interpreterService.CustomExpressions,
-                value => new ExecPushExpression(value));
+            // not enough arguments on stack
+            if (interpreter.NameStack.Count == 0 ||
+                interpreter.CodeStack.Count == 0)
+                return;
 
-            // as the interpreter does not pop code expressions
-            interpreterService.ExecStack.Pop();
+            var name = interpreter.NameStack.Pop();
+            var expression = new ExecPushExpression(interpreter.ExecStack.Top);
+
+            if (interpreter.CustomExpressions.ContainsKey(name))
+            {
+                interpreter.CustomExpressions[name] = expression;
+            }
+            else
+            {
+                interpreter.CustomExpressions.Add(name, expression);
+            }
+
+            interpreter.ExecStack.Pop();
+        }
+
+        public override string ToString()
+        {
+            return Symbols.CodeDefine;
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDoRangeExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDoRangeExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDoRangeExpression.cs	(revision 14328)
@@ -1,26 +1,25 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
 {
     public class ExecDoRangeExpression : Expression
     {
-        public ExecDoRangeExpression() : base(OpCode.ExecDoXRange)
-        { }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.IntegerStack.Count < 2 ||
-                interpreterService.ExecStack.Count == 0)
+            if (interpreter.IntegerStack.Count < 2 ||
+                interpreter.ExecStack.Count == 0)
                 return;
 
-            var destinationIndex = interpreterService.IntegerStack.Pop();
-            var currentIndex = interpreterService.IntegerStack.Pop();
-            var loopBody = interpreterService.ExecStack.Pop();
+            var destinationIndex = interpreter.IntegerStack.Pop();
+            var currentIndex = interpreter.IntegerStack.Pop();
+            var loopBody = interpreter.ExecStack.Pop();
 
             if (destinationIndex == currentIndex)
             {
-                interpreterService.IntegerStack.Push(currentIndex);
-                interpreterService.ExecStack.Push(loopBody);
+                interpreter.IntegerStack.Push(currentIndex);
+                interpreter.ExecStack.Push(loopBody);
             }
             else
@@ -30,13 +29,18 @@
                     : currentIndex + 1;
 
-                interpreterService.IntegerStack.Push(currentIndex);
-                interpreterService.IntegerStack.Push(nextIndex);
-                interpreterService.IntegerStack.Push(destinationIndex);
+                interpreter.IntegerStack.Push(currentIndex);
+                interpreter.IntegerStack.Push(nextIndex);
+                interpreter.IntegerStack.Push(destinationIndex);
 
                 var expression = new ExecDoRangeExpression();
-                interpreterService.ExecStack.Push(loopBody);
-                interpreterService.ExecStack.Push(loopBody);
-                interpreterService.ExecStack.Push(expression);
+                interpreter.ExecStack.Push(loopBody);
+                interpreter.ExecStack.Push(loopBody);
+                interpreter.ExecStack.Push(expression);
             }
+        }
+
+        public override string ToString()
+        {
+            return Symbols.ExecDoXRange;
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class ExecDuplicateExpression : Expression
-    {
-        public ExecDuplicateExpression() : base(OpCode.ExecDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.ExecStack);
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecExpandExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecExpandExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecExpandExpression.cs	(revision 14328)
@@ -1,27 +1,44 @@
-﻿using System.Linq;
-using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using System.Text;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
 {
     public class ExecExpandExpression : Expression
     {
-        public ExecExpandExpression(Expression[] expressions) : base(OpCode.ExecExpand)
+        private const string prefix = "( ";
+        private const string postifx = " )";
+        private const string delimiter = " ";
+
+        private readonly Expression[] expressions;
+        public ExecExpandExpression(Expression[] expressions)
         {
-            this.Expressions = expressions;
+            this.expressions = expressions;
         }
 
-        public Expression[] Expressions { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            foreach (var expression in this.Expressions)
-            {
-                interpreterService.ExecStack.Add(expression);
-            }
+            interpreter.ExecStack.Push(this.expressions);
         }
 
         public override string ToString()
         {
-            return $"( {string.Join(" ", this.Expressions.Reverse())} )";
+            if (this.expressions.Length == 0)
+            {
+                return string.Empty;
+            }
+
+            var sb = new StringBuilder();
+            sb.Append(prefix);
+
+            for (var i = this.expressions.Length - 1; i > 0; i--)
+            {
+                sb.Append(this.expressions[i] + delimiter);
+            }
+
+            sb.Append(this.expressions[0] + postifx);
+
+            return sb.ToString();
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecIfExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecIfExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecIfExpression.cs	(revision 14328)
@@ -1,26 +1,30 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
 {
     public class ExecIfExpression : Expression
     {
-        public ExecIfExpression() : base(OpCode.ExecIf)
-        { }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.BooleanStack.Count == 0 ||
-                interpreterService.ExecStack.Count < 2)
+            if (interpreter.BooleanStack.Count == 0 ||
+                interpreter.ExecStack.Count < 2)
                 return;
 
-            var condition = interpreterService.BooleanStack.Pop();
-            var expressionTrue = interpreterService.ExecStack.Pop();
-            var expressionFalse = interpreterService.ExecStack.Pop();
+            var condition = interpreter.BooleanStack.Pop();
+            var expressionTrue = interpreter.ExecStack.Pop();
+            var expressionFalse = interpreter.ExecStack.Pop();
 
-            interpreterService.ExecStack.Push(condition
+            interpreter.ExecStack.Push(condition
                 ? expressionTrue
                 : expressionFalse);
         }
+
+        public override string ToString()
+        {
+            return Symbols.ExecIf;
+        }
     }
 }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecPopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecPopExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class ExecPopExpression : Expression
-    {
-        public ExecPopExpression() : base(OpCode.ExecPop)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.ExecStack.Pop();
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecPushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecPushExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecPushExpression.cs	(revision 14328)
@@ -1,23 +1,24 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
 {
     public class ExecPushExpression : Expression
     {
-        public ExecPushExpression(Expression value) : base(OpCode.ExecPush)
+        private readonly Expression value;
+        public ExecPushExpression(Expression value)
         {
-            this.Value = value;
+            this.value = value;
         }
 
-        public Expression Value { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            interpreterService.ExecStack.Push(Value);
+            interpreter.ExecStack.Push(this.value);
         }
 
         public override string ToString()
         {
-            return $"{base.ToString()}({this.Value})";
+            return this.value.ToString();
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecYExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecYExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecYExpression.cs	(revision 14328)
@@ -1,24 +1,28 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
 {
     public class ExecYExpression : Expression
     {
-        public ExecYExpression() : base(OpCode.ExecY)
-        { }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             // not enough arguments on stack
-            if (interpreterService.ExecStack.Count == 0)
+            if (interpreter.ExecStack.Count == 0)
                 return;
 
             var expandExpression = new ExecExpandExpression(new[]
             {
-                interpreterService.ExecStack.Top,
+                interpreter.ExecStack.Top,
                 new ExecYExpression()
             });
 
-            interpreterService.ExecStack.Insert(interpreterService.ExecStack.Count - 1, expandExpression);
+            interpreter.ExecStack.Insert(interpreter.ExecStack.Count - 1, expandExpression);
+        }
+
+        public override string ToString()
+        {
+            return Symbols.ExecY;
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs	(revision 14328)
@@ -1,4 +1,5 @@
 ﻿using System;
 using System.Collections.Generic;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
 using HeuristicLab.Algorithms.PushGP.Stack;
 
@@ -7,24 +8,13 @@
     public abstract class Expression
     {
-        public Expression(OpCode opCode)
-        {
-            this.OpCode = opCode;
-        }
+        public abstract bool IsCodeOp { get; }
+        public abstract void Eval(IInterpreter interpreter);
 
-        public OpCode OpCode { get; }
-
-        public abstract void Eval(IInterpreterService interpreterService);
-
-        public override string ToString()
-        {
-            return SymbolTable.GetSymbol(this.OpCode);
-        }
-
-        protected static void PushResult<T>(IStack<T> stack, int count, Func<T[], T> templateFunc)
+        public void PushResult<T>(IStack<T> stack, int count, Func<T[], T> templateFunc)
         {
             PushResult(stack, stack, count, templateFunc);
         }
 
-        protected static void PushResult<T, R>(IStack<T> sourceStack, IStack<R> targetStack, int count, Func<T[], R> templateFunc)
+        public void PushResult<T, R>(IStack<T> sourceStack, IStack<R> targetStack, int count, Func<T[], R> templateFunc)
         {
             // not enough arguments on stack
@@ -38,5 +28,5 @@
         }
 
-        protected static void Duplicate<T>(IStack<T> stack)
+        public void Duplicate<T>(IStack<T> stack)
         {
             // not enough arguments on stack
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExpressionFactory.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExpressionFactory.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExpressionFactory.cs	(revision 14328)
@@ -0,0 +1,95 @@
+﻿using System;
+using System.Collections.Generic;
+using HeuristicLab.Algorithms.PushGP.Expressions.Boolean;
+using HeuristicLab.Algorithms.PushGP.Expressions.Code;
+using HeuristicLab.Algorithms.PushGP.Expressions.Exec;
+using HeuristicLab.Algorithms.PushGP.Expressions.Float;
+using HeuristicLab.Algorithms.PushGP.Expressions.Integer;
+using HeuristicLab.Algorithms.PushGP.Expressions.Templates;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public static class ExpressionFactory
+    {
+        private static Func<IInterpreter, IStack<Expression>> execStackProvider = interpreter => interpreter.ExecStack;
+        private static Func<IInterpreter, IStack<Expression>> codeStackProvider = interpreter => interpreter.CodeStack;
+        private static Func<IInterpreter, IStack<string>> nameStackProvider = interpreter => interpreter.NameStack;
+        private static Func<IInterpreter, IStack<long>> integerStackProvider = interpreter => interpreter.IntegerStack;
+        private static Func<IInterpreter, IStack<double>> floatStackProvider = interpreter => interpreter.FloatStack;
+        private static Func<IInterpreter, IStack<bool>> booleanStackProvider = interpreter => interpreter.BooleanStack;
+
+        private static IDictionary<OpCode, Expression> expressions = new Dictionary<OpCode, Expression>()
+        {
+            #region Exec
+            { OpCode.ExecPop, new PopExpressionTemplate<Expression>(Symbols.ExecPop, execStackProvider) },
+            { OpCode.ExecDuplicate, new DuplicateExpressionTemplate<Expression>(Symbols.ExecDuplicate, execStackProvider) },
+            { OpCode.ExecDefine, new ExecDefineExpression() },
+            { OpCode.ExecDoXRange, new ExecDoRangeExpression() },
+            { OpCode.ExecY, new ExecYExpression() },
+            { OpCode.ExecIf, new ExecIfExpression() },
+            #endregion Exec
+
+            #region Code
+            { OpCode.CodeDuplicate, new DuplicateExpressionTemplate<Expression>(Symbols.CodeDuplicate, codeStackProvider, true) },
+            { OpCode.CodeDefine, new CodeDefineExpression() },
+            { OpCode.CodeQuote, new CodeQuoteExpression() },
+            { OpCode.CodeDo, new CodeDoExpression() },
+            { OpCode.CodeIf, new CodeIfExpression() },
+            { OpCode.CodeNoop, new CodeNoopExpression() },
+            #endregion Code
+
+            #region Name
+            { OpCode.NamePop, new PopExpressionTemplate<string>(Symbols.NamePop, nameStackProvider) },
+            { OpCode.NameDuplicate, new DuplicateExpressionTemplate<string>(Symbols.NameDuplicate, nameStackProvider) },
+            #endregion Name
+
+            #region Boolean
+            { OpCode.BooleanPop, new PopExpressionTemplate<bool>(Symbols.BooleanPop, booleanStackProvider) },
+            { OpCode.BooleanDuplicate, new DuplicateExpressionTemplate<bool>(Symbols.BooleanDuplicate, booleanStackProvider) },
+            { OpCode.BooleanDefine, new DefineExpressionTemplate<bool>(Symbols.BooleanDefine, booleanStackProvider, v => new BooleanPushExpression(v)) },
+            { OpCode.BooleanOr, new PushResultExpressionTemplate<bool, bool>(Symbols.BooleanOr, booleanStackProvider, booleanStackProvider, v => v[0] || v[1]) },
+            { OpCode.BooleanAnd, new PushResultExpressionTemplate<bool, bool>(Symbols.BooleanAnd, booleanStackProvider, booleanStackProvider, v => v[0] && v[1]) },
+            #endregion Boolean
+
+            #region Float
+            { OpCode.IntegerPop, new PopExpressionTemplate<long>(Symbols.IntegerPop, integerStackProvider) },
+            { OpCode.IntegerDuplicate, new DuplicateExpressionTemplate<long>(Symbols.IntegerDuplicate, integerStackProvider) },
+            { OpCode.IntegerDefine, new DefineExpressionTemplate<long>(Symbols.IntegerDefine, integerStackProvider, v => new IntegerPushExpression(v)) },
+            { OpCode.IntegerAdd, new PushResultExpressionTemplate<long, long>(Symbols.IntegerAdd, integerStackProvider, integerStackProvider, v => v[0] + v[1]) },
+            { OpCode.IntegerSubtract, new PushResultExpressionTemplate<long, long>(Symbols.IntegerSubtract, integerStackProvider, integerStackProvider, v => v[0] - v[1]) },
+            { OpCode.IntegerMultiply, new PushResultExpressionTemplate<long, long>(Symbols.IntegerMultiply, integerStackProvider, integerStackProvider, v => v[0] * v[1]) },
+            { OpCode.IntegerDivide, new PushResultExpressionTemplate<long, long>(Symbols.IntegerDivide, integerStackProvider, integerStackProvider, v => v[0] / v[1]) },
+            { OpCode.IntegerMin, new PushResultExpressionTemplate<long, long>(Symbols.IntegerMin, integerStackProvider, integerStackProvider, v => Math.Min(v[0], v[1])) },
+            { OpCode.IntegerMax, new PushResultExpressionTemplate<long, long>(Symbols.IntegerMax, integerStackProvider, integerStackProvider, v => Math.Max(v[0], v[1])) },
+            { OpCode.IntegerSmallerThan, new PushResultExpressionTemplate<long, bool>(Symbols.IntegerSmallerThan, integerStackProvider, booleanStackProvider, v => v[0] < v[1]) },
+            { OpCode.IntegerGreaterThan, new PushResultExpressionTemplate<long, bool>(Symbols.IntegerGreaterThan, integerStackProvider, booleanStackProvider, v => v[0] > v[1]) },
+            { OpCode.IntegerEquals, new PushResultExpressionTemplate<long, bool>(Symbols.IntegerEquals, integerStackProvider, booleanStackProvider, v => v[0] == v[1]) },
+            #endregion Float
+
+            #region Float
+            { OpCode.FloatPop, new PopExpressionTemplate<double>(Symbols.FloatPop, floatStackProvider) },
+            { OpCode.FloatDuplicate, new DuplicateExpressionTemplate<double>(Symbols.FloatDuplicate, floatStackProvider) },
+            { OpCode.FloatDefine, new DefineExpressionTemplate<double>(Symbols.FloatDefine, floatStackProvider, v => new FloatPushExpression(v)) },
+            { OpCode.FloatAdd, new PushResultExpressionTemplate<double, double>(Symbols.FloatAdd, floatStackProvider, floatStackProvider, v => v[0] + v[1]) },
+            { OpCode.FloatSubtract, new PushResultExpressionTemplate<double, double>(Symbols.FloatSubtract, floatStackProvider, floatStackProvider, v => v[0] - v[1]) },
+            { OpCode.FloatMultiply, new PushResultExpressionTemplate<double, double>(Symbols.FloatMultiply, floatStackProvider, floatStackProvider, v => v[0] * v[1]) },
+            { OpCode.FloatDivide, new PushResultExpressionTemplate<double, double>(Symbols.FloatDivide, floatStackProvider, floatStackProvider, v => v[0] / v[1]) },
+            { OpCode.FloatMin, new PushResultExpressionTemplate<double, double>(Symbols.FloatMin, floatStackProvider, floatStackProvider, v => Math.Min(v[0], v[1])) },
+            { OpCode.FloatMax, new PushResultExpressionTemplate<double, double>(Symbols.FloatMax, floatStackProvider, floatStackProvider, v => Math.Max(v[0], v[1])) },
+            { OpCode.FloatSmallerThan, new PushResultExpressionTemplate<double, bool>(Symbols.FloatSmallerThan, floatStackProvider, booleanStackProvider, v => v[0] < v[1]) },
+            { OpCode.FloatGreaterThan, new PushResultExpressionTemplate<double, bool>(Symbols.FloatGreaterThan, floatStackProvider, booleanStackProvider, v => v[0] > v[1]) },
+            { OpCode.FloatEquals, new PushResultExpressionTemplate<double, bool>(Symbols.FloatEquals, floatStackProvider, booleanStackProvider, v => v[0] == v[1]) },
+            #endregion Float
+        };
+
+        public static Expression Create(OpCode opCode)
+        {
+            Expression expression;
+            return expressions.TryGetValue(opCode, out expression)
+                ? expression
+                : expressions[OpCode.CodeNoop];
+        }
+    }
+}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatAddExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatAddExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatAddExpression : Expression
-    {
-        public FloatAddExpression() : base(OpCode.FloatAdd)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => values[1] + values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDefineExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDefineExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatDefineExpression : Expression
-    {
-        public FloatDefineExpression() : base(OpCode.FloatDefine)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Define(
-                interpreterService.FloatStack,
-                interpreterService.NameStack,
-                interpreterService.CustomExpressions,
-                value => new FloatPushExpression(value));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDivideExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDivideExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatDivideExpression : Expression
-    {
-        public FloatDivideExpression() : base(OpCode.FloatDivide)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => values[1] / values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatDuplicateExpression : Expression
-    {
-        public FloatDuplicateExpression() : base(OpCode.FloatDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.FloatStack);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatEqualsExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatEqualsExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatEqualsExpression : Expression
-    {
-        public FloatEqualsExpression() : base(OpCode.FloatEquals)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.FloatStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] == values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatGreaterThanExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatGreaterThanExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatGreaterThanExpression : Expression
-    {
-        public FloatGreaterThanExpression() : base(OpCode.FloatGreaterThan)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.FloatStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] > values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMaxExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMaxExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿using System;
-using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatMaxExpression : Expression
-    {
-        public FloatMaxExpression() : base(OpCode.FloatMax)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => Math.Max(values[1], values[0]));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMinExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMinExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿using System;
-using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatMinExpression : Expression
-    {
-        public FloatMinExpression() : base(OpCode.FloatMin)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => Math.Min(values[1], values[0]));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMultiplyExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatMultiplyExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatMultiplyExpression : Expression
-    {
-        public FloatMultiplyExpression() : base(OpCode.FloatMultiply)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => values[1] * values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatPopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatPopExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatPopExpression : Expression
-    {
-        public FloatPopExpression() : base(OpCode.FloatPop)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.FloatStack.Pop();
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatPushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatPushExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatPushExpression.cs	(revision 14328)
@@ -1,23 +1,24 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Float
 {
     public class FloatPushExpression : Expression
     {
-        public FloatPushExpression(double value) : base(OpCode.FloatPush)
+        private readonly double value;
+        public FloatPushExpression(double value)
         {
-            this.Value = value;
+            this.value = value;
         }
 
-        public double Value { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            interpreterService.FloatStack.Push(Value);
+            interpreter.FloatStack.Push(this.value);
         }
 
         public override string ToString()
         {
-            return $"{this.Value}";
+            return this.value.ToString();
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatSmallerThanExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatSmallerThanExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatSmallerThanExpression : Expression
-    {
-        public FloatSmallerThanExpression() : base(OpCode.FloatSmallerThan)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.FloatStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] < values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatSubtractExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Float/FloatSubtractExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class FloatSubtractExpression : Expression
-    {
-        public FloatSubtractExpression() : base(OpCode.FloatSubtract)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.FloatStack, 2, values => values[1] - values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerAddExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerAddExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerAddExpression : Expression
-    {
-        public IntegerAddExpression() : base(OpCode.IntegerAdd)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => values[1] + values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDefineExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDefineExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerDefineExpression : Expression
-    {
-        public IntegerDefineExpression() : base(OpCode.IntegerDefine)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Define(
-                interpreterService.IntegerStack,
-                interpreterService.NameStack,
-                interpreterService.CustomExpressions,
-                value => new IntegerPushExpression(value));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDivideExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDivideExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerDivideExpression : Expression
-    {
-        public IntegerDivideExpression() : base(OpCode.IntegerDivide)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => values[1] / values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerDuplicateExpression : Expression
-    {
-        public IntegerDuplicateExpression() : base(OpCode.IntegerDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.IntegerStack);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerEqualsExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerEqualsExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerEqualsExpression : Expression
-    {
-        public IntegerEqualsExpression() : base(OpCode.IntegerEquals)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.IntegerStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] == values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerGreaterThanExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerGreaterThanExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerGreaterThanExpression : Expression
-    {
-        public IntegerGreaterThanExpression() : base(OpCode.IntegerGreaterThan)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.IntegerStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] > values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMaxExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMaxExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿using System;
-using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerMaxExpression : Expression
-    {
-        public IntegerMaxExpression() : base(OpCode.IntegerMax)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => Math.Max(values[1], values[0]));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMinExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMinExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿using System;
-using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerMinExpression : Expression
-    {
-        public IntegerMinExpression() : base(OpCode.IntegerMin)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => Math.Min(values[1], values[0]));
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMultiplyExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerMultiplyExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerMultiplyExpression : Expression
-    {
-        public IntegerMultiplyExpression() : base(OpCode.IntegerMultiply)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => values[1] * values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerPopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerPopExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerPopExpression : Expression
-    {
-        public IntegerPopExpression() : base(OpCode.IntegerPop)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.IntegerStack.Pop();
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerPushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerPushExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerPushExpression.cs	(revision 14328)
@@ -1,23 +1,24 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Integer
 {
     public class IntegerPushExpression : Expression
     {
-        public IntegerPushExpression(long value) : base(OpCode.IntegerPush)
+        private readonly long value;
+        public IntegerPushExpression(long value)
         {
-            this.Value = value;
+            this.value = value;
         }
 
-        public long Value { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
-            interpreterService.IntegerStack.Push(Value);
+            interpreter.IntegerStack.Push(this.value);
         }
 
         public override string ToString()
         {
-            return $"{this.Value}";
+            return this.value.ToString();
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerSmallerThanExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerSmallerThanExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,19 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerSmallerThanExpression : Expression
-    {
-        public IntegerSmallerThanExpression() : base(OpCode.IntegerSmallerThan)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(
-                interpreterService.IntegerStack,
-                interpreterService.BooleanStack,
-                2,
-                values => values[1] < values[0]);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerSubtractExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Integer/IntegerSubtractExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class IntegerSubtractExpression : Expression
-    {
-        public IntegerSubtractExpression() : base(OpCode.IntegerSubtract)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            PushResult(interpreterService.IntegerStack, 2, values => values[1] - values[0]);
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NameDefineXExecExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NameDefineXExecExpression.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NameDefineXExecExpression.cs	(revision 14328)
@@ -1,25 +1,26 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
 
-namespace HeuristicLab.Algorithms.PushGP.Expressions
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Name
 {
     public class NameDefineXExecExpression : Expression
     {
-        public NameDefineXExecExpression(string value) : base(OpCode.NameDefineXExec)
+        private readonly string name;
+        public NameDefineXExecExpression(string name)
         {
-            this.Value = value;
+            this.name = name;
         }
 
-        public string Value { get; }
+        public override bool IsCodeOp { get { return false; } }
 
-        public override void Eval(IInterpreterService interpreterService)
+        public override void Eval(IInterpreter interpreter)
         {
             Expression expression;
-            if (interpreterService.CustomExpressions.TryGetValue(this.Value, out expression))
+            if (interpreter.CustomExpressions.TryGetValue(this.name, out expression))
             {
-                interpreterService.ExecStack.Push(expression);
+                interpreter.ExecStack.Push(expression);
             }
             else
             {
-                interpreterService.NameStack.Push(this.Value);
+                interpreter.NameStack.Push(this.name);
             }
         }
@@ -27,5 +28,5 @@
         public override string ToString()
         {
-            return this.Value;
+            return this.name;
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NameDuplicateExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NameDuplicateExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class NameDuplicateExpression : Expression
-    {
-        public NameDuplicateExpression() : base(OpCode.NameDup)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            Duplicate(interpreterService.NameStack);
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NamePopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NamePopExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class NamePopExpression : Expression
-    {
-        public NamePopExpression() : base(OpCode.NamePop)
-        { }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.NameStack.Pop();
-        }
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NamePushExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Name/NamePushExpression.cs	(revision 14327)
+++ 	(revision )
@@ -1,24 +1,0 @@
-﻿using HeuristicLab.Algorithms.PushGP.Stack;
-
-namespace HeuristicLab.Algorithms.PushGP.Expressions
-{
-    public class NamePushExpression : Expression
-    {
-        public NamePushExpression(string value) : base(OpCode.NamePush)
-        {
-            this.Value = value;
-        }
-
-        public string Value { get; }
-
-        public override void Eval(IInterpreterService interpreterService)
-        {
-            interpreterService.NameStack.Push(Value);
-        }
-
-        public override string ToString()
-        {
-            return $"{base.ToString()}({this.Value})";
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DefineExpressionTemplate.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DefineExpressionTemplate.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DefineExpressionTemplate.cs	(revision 14328)
@@ -0,0 +1,43 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Templates
+{
+    public class DefineExpressionTemplate<T> : ExpressionTemplate
+    {
+        private readonly Func<IInterpreter, IStack<T>> sourceStackProvider;
+        private readonly Func<T, Expression> creator;
+        private readonly bool isCodeOp;
+        public DefineExpressionTemplate(string symbol, Func<IInterpreter, IStack<T>> sourceStackProvider, Func<T, Expression> creator, bool isCodeOp = false) : base(symbol)
+        {
+            this.sourceStackProvider = sourceStackProvider;
+            this.creator = creator;
+            this.isCodeOp = isCodeOp;
+        }
+
+        public override bool IsCodeOp { get { return this.isCodeOp; } }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var sourceStack = this.sourceStackProvider(interpreter);
+
+            // not enough arguments on stack
+            if (interpreter.NameStack.Count == 0 ||
+                sourceStack.Count == 0)
+                return;
+
+            var name = interpreter.NameStack.Pop();
+            var expression = creator(sourceStack.Top);
+
+            if (interpreter.CustomExpressions.ContainsKey(name))
+            {
+                interpreter.CustomExpressions[name] = expression;
+            }
+            else
+            {
+                interpreter.CustomExpressions.Add(name, expression);
+            }
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DuplicateExpressionTemplate.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DuplicateExpressionTemplate.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/DuplicateExpressionTemplate.cs	(revision 14328)
@@ -0,0 +1,30 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Templates
+{
+    public class DuplicateExpressionTemplate<T> : ExpressionTemplate
+    {
+        private readonly Func<IInterpreter, IStack<T>> sourceStackProvider;
+        private readonly bool isCodeOp;
+        public DuplicateExpressionTemplate(string symbol, Func<IInterpreter, IStack<T>> sourceStackProvider, bool isCodeOp = false) : base(symbol)
+        {
+            this.sourceStackProvider = sourceStackProvider;
+            this.isCodeOp = isCodeOp;
+        }
+
+        public override bool IsCodeOp { get { return this.isCodeOp; } }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var sourceStack = this.sourceStackProvider(interpreter);
+
+            // not enough arguments on stack
+            if (sourceStack.Count == 0)
+                return;
+
+            sourceStack.Push(sourceStack.Top);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/ExpressionTemplate.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/ExpressionTemplate.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/ExpressionTemplate.cs	(revision 14328)
@@ -0,0 +1,17 @@
+﻿namespace HeuristicLab.Algorithms.PushGP.Expressions.Templates
+{
+    public abstract class ExpressionTemplate : Expression
+    {
+        private readonly string symbol;
+
+        public ExpressionTemplate(string symbol)
+        {
+            this.symbol = symbol;
+        }
+
+        public override string ToString()
+        {
+            return this.symbol;
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PopExpressionTemplate.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PopExpressionTemplate.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PopExpressionTemplate.cs	(revision 14328)
@@ -0,0 +1,30 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Templates
+{
+    public class PopExpressionTemplate<T> : ExpressionTemplate
+    {
+        private readonly Func<IInterpreter, IStack<T>> sourceStackProvider;
+        private readonly bool isCodeOp;
+        public PopExpressionTemplate(string symbol, Func<IInterpreter, IStack<T>> sourceStackProvider, bool isCodeOp = false) : base(symbol)
+        {
+            this.sourceStackProvider = sourceStackProvider;
+            this.isCodeOp = isCodeOp;
+        }
+
+        public override bool IsCodeOp { get { return this.isCodeOp; } }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var sourceStack = this.sourceStackProvider(interpreter);
+
+            // not enough arguments on stack
+            if (sourceStack.Count == 0)
+                return;
+
+            sourceStack.Pop();
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PushResultExpressionTemplate.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PushResultExpressionTemplate.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Templates/PushResultExpressionTemplate.cs	(revision 14328)
@@ -0,0 +1,40 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions.Templates
+{
+    public class PushResultExpressionTemplate<T, R> : ExpressionTemplate
+    {
+        private readonly Func<IInterpreter, IStack<T>> sourceStackProvider;
+        private readonly Func<IInterpreter, IStack<R>> targetStackProvider;
+        private readonly Func<T[], R> templateFunc;
+        private readonly bool isCodeOp;
+        public PushResultExpressionTemplate(string symbol, Func<IInterpreter, IStack<T>> sourceStackProvider, Func<IInterpreter, IStack<R>> targetSourceProvider, Func<T[], R> templateFunc, bool isCodeOp = false) : base(symbol)
+        {
+            this.sourceStackProvider = sourceStackProvider;
+            this.targetStackProvider = targetSourceProvider;
+            this.templateFunc = templateFunc;
+
+            this.isCodeOp = isCodeOp;
+        }
+
+        public override bool IsCodeOp { get { return this.isCodeOp; } }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var sourceStack = this.sourceStackProvider(interpreter);
+
+            // not enough arguments on stack
+            if (sourceStack.Count < 2)
+                return;
+
+            var targetStack = this.targetStackProvider(interpreter);
+
+            var values = sourceStack.Pop(2);
+            var result = this.templateFunc(values);
+
+            targetStack.Push(result);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs	(revision 14328)
@@ -1,6 +1,6 @@
-﻿using System;
-using System.Collections.Generic;
+﻿using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Algorithms.PushGP.Generators
@@ -8,7 +8,8 @@
     public static class CodeGenerator
     {
+        private static FastRandom random = new FastRandom();
         public static IEnumerable<Expression> RandomCode(int maxPoints)
         {
-            var actualPoints = StaticRandom.Next(1, maxPoints);
+            var actualPoints = random.Next(1, maxPoints);
 
             return RandomCodeWithSize(actualPoints).ToArray();
@@ -19,15 +20,8 @@
             if (points == 1)
             {
-                OpCode opCode;
-                Func<Expression> creator;
+                // TODO: If this is an "ephemeral random constant"???? then return a randomly - chosen value of the appropriate type;
+                var opCode = (OpCode)random.Next(OpCodeExtensions.Min, OpCodeExtensions.Max);
 
-                do
-                {
-                    // TODO: If this is an "ephemeral random constant"???? then return a randomly - chosen value of the appropriate type;
-                    opCode = (OpCode)StaticRandom.Next(OpCodeExtensions.Min, OpCodeExtensions.Max);
-                }
-                while (!ExpressionCreatorTable.TryGetCreator(opCode, out creator));
-
-                return new[] { creator.Invoke() };
+                return new[] { ExpressionFactory.Create(opCode) };
             }
             else
@@ -35,5 +29,5 @@
                 var sizesThisLevel = Decompose(points - 1, points - 1);
 
-                return sizesThisLevel.SelectMany(size => RandomCodeWithSize(size));
+                return sizesThisLevel.SelectMany(size => RandomCodeWithSize(size)).Shuffle(random);
             }
         }
@@ -47,5 +41,5 @@
             else
             {
-                var thisPart = StaticRandom.Next(1, number - 1);
+                var thisPart = random.Next(1, number - 1);
 
                 return new[] { thisPart }.Concat(Decompose(number - thisPart, maxParts - 1));
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/Configuration.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/Configuration.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/Configuration.cs	(revision 14328)
@@ -3,23 +3,32 @@
     public class Configuration
     {
+        public Configuration()
+        {
+            this.MinRandomInteger = long.MinValue;
+            this.MaxRandomInteger = long.MaxValue;
+            this.MinRandomFloat = double.MaxValue;
+            this.MaxRandomFloat = double.MaxValue;
+            this.NewErcNameProbability = 0.5;
+        }
+
         /// <summary>
         /// The minimum INTEGER that will be produced as an ephemeral random INTEGER constant or from a call to INTEGER.RAND.
         /// </summary>
-        public long MinRandomInteger { get; set; } = long.MinValue;
+        public long MinRandomInteger { get; set; }
 
         /// <summary>
         /// The maximum INTEGER that will be produced as an ephemeral random INTEGER constant or from a call to INTEGER.RAND.
         /// </summary>
-        public long MaxRandomInteger { get; set; } = long.MaxValue;
+        public long MaxRandomInteger { get; set; }
 
         /// <summary>
         /// The minimum FLOAT that will be produced as an ephemeral random FLOAT constant or from a call to FLOAT.RAND.
         /// </summary>
-        public double MinRandomFloag { get; set; } = double.MinValue;
+        public double MinRandomFloat { get; set; }
 
         /// <summary>
         /// The maximum FLOAT that will be produced as an ephemeral random FLOAT constant or from a call to FLOAT.RAND.
         /// </summary>
-        public double MaxRandomFloag { get; set; } = double.MaxValue;
+        public double MaxRandomFloat { get; set; }
 
         /// <summary>
@@ -28,5 +37,5 @@
         /// (rather than a name that was previously generated).
         /// </summary>
-        public double NewErcNameProbability { get; set; } = 0.5;
+        public double NewErcNameProbability { get; set; }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj	(revision 14328)
@@ -10,6 +10,7 @@
     <RootNamespace>HeuristicLab.Algorithms.PushGP</RootNamespace>
     <AssemblyName>HeuristicLab.Algorithms.PushGP</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -29,6 +30,16 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <LangVersion>5</LangVersion>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -41,79 +52,40 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Interpreter\Configuration.cs" />
-    <Compile Include="Data\Expression.cs" />
-    <Compile Include="Expressions\Boolean\BooleanAndExpression.cs" />
-    <Compile Include="Expressions\Boolean\BooleanOrExpression.cs" />
+    <Compile Include="Exporter\Exporter.cs" />
     <Compile Include="Expressions\Boolean\BooleanPushExpression.cs" />
-    <Compile Include="Expressions\Boolean\BooleanDuplicateExpression.cs" />
-    <Compile Include="Expressions\Boolean\BooleanDefineExpression.cs" />
-    <Compile Include="Expressions\Boolean\BooleanPopExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecIfExpression.cs" />
+    <Compile Include="Expressions\Code\CodeDoExpression.cs" />
+    <Compile Include="Expressions\Code\CodeDefineExpression.cs" />
     <Compile Include="Expressions\Code\CodeIfExpression.cs" />
-    <Compile Include="Expressions\Code\CodeDoExpression.cs" />
+    <Compile Include="Expressions\Code\CodeNoopExpression.cs" />
     <Compile Include="Expressions\Code\CodeQuoteExpression.cs" />
-    <Compile Include="Expressions\Code\CodeDuplicateExpression.cs" />
-    <Compile Include="Expressions\Code\CodeNoopExpression.cs" />
-    <Compile Include="Expressions\Code\CodePushExpression.cs" />
-    <Compile Include="Expressions\Code\CodeDefineExpression.cs" />
+    <Compile Include="Expressions\Exec\ExecDefineExpression.cs" />
     <Compile Include="Expressions\Exec\ExecYExpression.cs" />
     <Compile Include="Expressions\Exec\ExecDoRangeExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecDuplicateExpression.cs" />
+    <Compile Include="Expressions\Exec\ExecIfExpression.cs" />
+    <Compile Include="Expressions\Exec\ExecPushExpression.cs" />
     <Compile Include="Expressions\Exec\ExecExpandExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecPushExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecDefineExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecPopExpression.cs" />
+    <Compile Include="Expressions\ExpressionFactory.cs" />
     <Compile Include="Expressions\Expression.cs" />
-    <Compile Include="ExpressionCreatorTable.cs" />
-    <Compile Include="Expressions\Float\FloatAddExpression.cs" />
     <Compile Include="Expressions\Float\FloatPushExpression.cs" />
-    <Compile Include="Expressions\Float\FloatMultiplyExpression.cs" />
-    <Compile Include="Expressions\Float\FloatDivideExpression.cs" />
-    <Compile Include="Expressions\Float\FloatSubtractExpression.cs" />
-    <Compile Include="Expressions\Float\FloatDuplicateExpression.cs" />
-    <Compile Include="Expressions\Float\FloatMaxExpression.cs" />
-    <Compile Include="Expressions\Float\FloatMinExpression.cs" />
-    <Compile Include="Expressions\Float\FloatEqualsExpression.cs" />
-    <Compile Include="Expressions\Float\FloatGreaterThanExpression.cs" />
-    <Compile Include="Expressions\Float\FloatSmallerThanExpression.cs" />
-    <Compile Include="Expressions\Float\FloatDefineExpression.cs" />
-    <Compile Include="Expressions\Float\FloatPopExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerPopExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerMinExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerMaxExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerDivideExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerDuplicateExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerEqualsExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerSmallerThanExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerGreaterThanExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerDefineExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerSubtractExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerAddExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerMultiplyExpression.cs" />
     <Compile Include="Expressions\Integer\IntegerPushExpression.cs" />
-    <Compile Include="Expressions\Name\NamePopExpression.cs" />
-    <Compile Include="Expressions\Name\NamePushExpression.cs" />
-    <Compile Include="Expressions\Name\NameDuplicateExpression.cs" />
     <Compile Include="Expressions\Name\NameDefineXExecExpression.cs" />
+    <Compile Include="Expressions\Templates\DefineExpressionTemplate.cs" />
+    <Compile Include="Expressions\Templates\DuplicateExpressionTemplate.cs" />
+    <Compile Include="Expressions\Templates\ExpressionTemplate.cs" />
+    <Compile Include="Expressions\Templates\PopExpressionTemplate.cs" />
+    <Compile Include="Expressions\Templates\PushResultExpressionTemplate.cs" />
+    <Compile Include="Interpreter\Configuration.cs" />
     <Compile Include="Generators\CodeGenerator.cs" />
     <Compile Include="Generators\Configuration.cs" />
-    <Compile Include="InstructionSets\ExecInstructionSet.cs" />
-    <Compile Include="InstructionSets\CodeInstructionSet.cs" />
-    <Compile Include="InstructionSets\FloatInstructionSet.cs" />
-    <Compile Include="InstructionSets\NameInstructionSet.cs" />
-    <Compile Include="InstructionSets\IntegerInstructionSet.cs" />
-    <Compile Include="InstructionSets\CommonInstructionSet.cs" />
-    <Compile Include="InstructionSets\BooleanInstructionSet.cs" />
     <Compile Include="OpCode.cs" />
     <Compile Include="OpCodeExtensions.cs" />
-    <Compile Include="OperationTable.cs" />
     <Compile Include="Parser\Parser.cs" />
-    <Compile Include="StaticRandom.cs" />
     <Compile Include="Stack\IStack.cs" />
     <Compile Include="Interpreter\Interpreter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Stack\IInterpreterService.cs" />
+    <Compile Include="Interpreter\IInterpreter.cs" />
     <Compile Include="Stack\PushGPStack.cs" />
     <Compile Include="Parser\SymbolTable.cs" />
+    <Compile Include="Symbols.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj.user
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj.user	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj.user	(revision 14328)
@@ -0,0 +1,6 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Configuration.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Configuration.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Configuration.cs	(revision 14328)
@@ -4,39 +4,39 @@
 namespace HeuristicLab.Algorithms.PushGP.Interpreter
 {
-    public class Configuration
+    public class Configuration : Generators.Configuration
     {
-        public bool IsBooleanStackEnabled { get; set; } = true;
-        public bool IsIntegerStackEnabled { get; set; } = true;
-        public bool IsFloatStackEnabled { get; set; } = true;
-        public bool IsCodeStackEnabled { get; set; } = true;
-        public bool IsNameStackEnabled { get; set; } = true;
+        public Configuration()
+        {
+            this.IsBooleanStackEnabled = true;
+            this.IsIntegerStackEnabled = true;
+            this.IsFloatStackEnabled = true;
+            this.IsCodeStackEnabled = true;
+            this.IsNameStackEnabled = true;
 
-        public IList<OpCode> AllowedInstructions { get; set; }
+            this.EvalPushLimit = uint.MaxValue;
+            this.MaxPointsInProgram = uint.MaxValue;
+            this.MaxPointsInRandomExpression = uint.MaxValue;
+
+            this.TopLevelPushCode = true;
+            this.TopLevelPopCode = true;
+
+            this.RandomSeedMax = 30081;
+            this.RandomSeedMin = 0;
+            this.RandomSeed = null;
+        }
+
+        public bool IsBooleanStackEnabled { get; set; }
+        public bool IsIntegerStackEnabled { get; set; }
+        public bool IsFloatStackEnabled { get; set; }
+        public bool IsCodeStackEnabled { get; set; }
+        public bool IsNameStackEnabled { get; set; }
+
+        public IList<OpCode> AllowedInclassions { get; set; }
 
         public IList<Expression> PredefinedExpressions { get; set; }
 
         /// <summary>
-        /// The minimum INTEGER that will be produced as an ephemeral random INTEGER constant or from a call to INTEGER.RAND.
-        /// </summary>
-        public long MinRandomInteger { get; set; } = long.MinValue;
-
-        /// <summary>
-        /// The maximum INTEGER that will be produced as an ephemeral random INTEGER constant or from a call to INTEGER.RAND.
-        /// </summary>
-        public long MaxRandomInteger { get; set; } = long.MaxValue;
-
-        /// <summary>
-        /// The minimum FLOAT that will be produced as an ephemeral random FLOAT constant or from a call to FLOAT.RAND.
-        /// </summary>
-        public double MinRandomFloag { get; set; } = double.MinValue;
-
-        /// <summary>
-        /// The maximum FLOAT that will be produced as an ephemeral random FLOAT constant or from a call to FLOAT.RAND.
-        /// </summary>
-        public double MaxRandomFloag { get; set; } = double.MaxValue;
-
-        /// <summary>
         /// This is the maximum allowed number of "executions" in a single top-level call to the interpreter.
-        /// The execution of a single Push instruction counts as one execution, as does the processing of a single literal,
+        /// The execution of a single Push inclassion counts as one execution, as does the processing of a single literal,
         /// as does the descent into one layer of parentheses (that is, the processing of the "(" counts as one execution).
         /// When this limit is exceeded the interpreter aborts immediately, leaving its stacks in the states they were in prior
@@ -44,17 +44,17 @@
         /// is up to the calling program.
         /// </summary>
-        public uint EvalPushLimit { get; set; } = uint.MaxValue;
+        public uint EvalPushLimit { get; set; }
 
         /// <summary>
         /// This is the maximum size of an item on the CODE stack, expressed as a number of points.
-        /// A point is an instruction, a literal, or a pair of parentheses. Any instruction that would cause this limit to be exceeded
-        /// should instead act as a NOOP, leaving all stacks in the states that they were in before the execution of the instruction.
+        /// A point is an inclassion, a literal, or a pair of parentheses. Any inclassion that would cause this limit to be exceeded
+        /// should instead act as a NOOP, leaving all stacks in the states that they were in before the execution of the inclassion.
         /// </summary>
-        public uint MaxPointsInProgram { get; set; } = uint.MaxValue;
+        public uint MaxPointsInProgram { get; set; }
 
         /// <summary>
-        /// The maximum number of points in an expression produced by the CODE.RAND instruction.
+        /// The maximum number of points in an expression produced by the CODE.RAND inclassion.
         /// </summary>
-        public uint MaxPointsInRandomExpression { get; set; } = uint.MaxValue;
+        public uint MaxPointsInRandomExpression { get; set; }
 
         /// <summary>
@@ -62,22 +62,15 @@
         /// will be pushed onto the CODE stack prior to execution.
         /// </summary>
-        public bool TopLevelPushCode { get; set; } = true;
+        public bool TopLevelPushCode { get; set; }
 
         /// <summary>
         /// When TRUE, the CODE stack will be popped at the end of top level calls to the interpreter. The default is FALSE.
         /// </summary>
-        public bool TopLevelPopCode { get; set; } = true;
+        public bool TopLevelPopCode { get; set; }
 
-        /// <summary>
-        /// The probability that the selection of the ephemeral
-        /// random NAME constant for inclusion in randomly generated code will produce a new name
-        /// (rather than a name that was previously generated).
-        /// </summary>
-        public double NewErcNameProbability { get; set; } = 0.5;
+        public ushort RandomSeedMax { get; set; }
+        public ushort RandomSeedMin { get; set; }
 
-        public ushort RandomSeedMax { get; set; } = 30081;
-        public ushort RandomSeedMin { get; set; } = 0;
-
-        public ushort? RandomSeed { get; set; } = null;
+        public ushort? RandomSeed { get; set; }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/IInterpreter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/IInterpreter.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/IInterpreter.cs	(revision 14328)
@@ -0,0 +1,31 @@
+﻿using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Interpreter
+{
+    public interface IInterpreter
+    {
+        IStack<Expression> CodeStack { get; }
+        IStack<Expression> ExecStack { get; }
+        IStack<string> NameStack { get; }
+        IStack<bool> BooleanStack { get; }
+        IStack<long> IntegerStack { get; }
+        IStack<double> FloatStack { get; }
+
+        IDictionary<string, Expression> CustomExpressions { get; }
+
+        void Interpret(string code);
+        Task InterpretAsync(string code, bool paused = false, CancellationToken token = default(CancellationToken));
+        void Interpret(Expression program);
+        Task InterpretAsync(Expression program, bool paused = false, CancellationToken token = default(CancellationToken));
+        Task AbortAndReset();
+        Task AbortAsync();
+        Task PauseAsync();
+        Task ResumeAsync();
+        void Step();
+        void PrintStacks();
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Interpreter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Interpreter.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Interpreter.cs	(revision 14328)
@@ -1,3 +1,4 @@
-﻿using System.Collections.Generic;
+﻿using System;
+using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
@@ -7,7 +8,6 @@
 namespace HeuristicLab.Algorithms.PushGP.Interpreter
 {
-    public class PushGPInterpreter : IInterpreterService
+    public class PushGPInterpreter : IInterpreter
     {
-        private static Parser parser = new Parser();
         private Task currentTask;
 
@@ -16,28 +16,30 @@
             this.Configuration = config ?? new Configuration();
 
-            this.CodeStack = new PushGPStack<Expression>();
-            this.ExecStack = new PushGPStack<Expression>();
-            this.NameStack = new PushGPStack<string>();
-            this.BooleanStack = new PushGPStack<bool>();
-            this.IntegerStack = new PushGPStack<long>();
-            this.FloatStack = new PushGPStack<double>();
-        }
-
-        public Configuration Configuration { get; }
-
-        public bool IsPaused { get; private set; } = false;
-        public bool IsAborted { get; private set; } = false;
-        public bool IsRunning => this.ExecStack.Count > 0 && !IsPaused && !IsAborted;
-        public bool IsCompleted => this.ExecStack.Count == 0;
-        public bool CanStep => !IsCompleted && !IsAborted && IsPaused;
-
-        public IStack<Expression> CodeStack { get; }
-        public IStack<Expression> ExecStack { get; }
-        public IStack<string> NameStack { get; }
-        public IStack<bool> BooleanStack { get; }
-        public IStack<long> IntegerStack { get; }
-        public IStack<double> FloatStack { get; }
-
-        public IDictionary<string, Expression> CustomExpressions { get; } = new Dictionary<string, Expression>();
+            this.CodeStack = new PushGPStack<Expression>(128);
+            this.ExecStack = new PushGPStack<Expression>(128);
+            this.NameStack = new PushGPStack<string>(16);
+            this.BooleanStack = new PushGPStack<bool>(16);
+            this.IntegerStack = new PushGPStack<long>(16);
+            this.FloatStack = new PushGPStack<double>(16);
+
+            this.CustomExpressions = new Dictionary<string, Expression>();
+        }
+
+        public Configuration Configuration { get; private set; }
+
+        public bool IsPaused { get; private set; }
+        public bool IsAborted { get; private set; }
+        public bool IsRunning { get { return this.ExecStack.Count > 0 && !IsPaused && !IsAborted; } }
+        public bool IsCompleted { get { return this.ExecStack.Count == 0; } }
+        public bool CanStep { get { return !IsCompleted && !IsAborted && IsPaused; } }
+
+        public IStack<Expression> CodeStack { get; private set; }
+        public IStack<Expression> ExecStack { get; private set; }
+        public IStack<string> NameStack { get; private set; }
+        public IStack<bool> BooleanStack { get; private set; }
+        public IStack<long> IntegerStack { get; private set; }
+        public IStack<double> FloatStack { get; private set; }
+
+        public IDictionary<string, Expression> CustomExpressions { get; private set; }
 
         public void Reset()
@@ -47,4 +49,9 @@
             this.currentTask = null;
 
+            this.Clear();
+        }
+
+        public void Clear()
+        {
             this.ExecStack.Clear();
             this.CodeStack.Clear();
@@ -53,7 +60,103 @@
             this.IntegerStack.Clear();
             this.FloatStack.Clear();
-        }
-
-        public async void AbortAndReset()
+
+            this.CustomExpressions.Clear();
+        }
+
+        public void Interpret(string code)
+        {
+            var program = Encode(code);
+            this.Interpret(program);
+        }
+
+        public Task InterpretAsync(string code, bool paused = false, CancellationToken token = default(CancellationToken))
+        {
+            var program = Encode(code);
+
+            this.currentTask = this.InterpretAsync(program, paused, token);
+
+            return currentTask;
+        }
+
+        public Task InterpretAsync(Expression program, bool paused = false, CancellationToken token = default(CancellationToken))
+        {
+            this.IsPaused = paused;
+            this.currentTask = Task.Run(() => this.Interpret(program), token);
+
+            return currentTask;
+        }
+
+        public void Interpret(Expression program)
+        {
+            this.IsAborted = false;
+
+            /* Push top expression so the loop is able to enter
+             * If the top expression is a single statement then the loop has nothing to do
+             * Otherwise the expand expression will be evaluated and pushes code onto the EXEC stack */
+            this.ExecStack.Push(program);
+            this.CodeStack.Push(program);
+
+            // run top expression
+            this.ExecStack.Pop().Eval(this);
+
+            this.Interpret();
+        }
+
+        private void Interpret()
+        {
+            if (!IsRunning)
+            {
+                return;
+            }
+
+            while (IsRunning)
+            {
+                this.DoStep();
+            }
+
+            if (this.Configuration.TopLevelPushCode)
+            {
+                this.CodeStack.Pop();
+            }
+        }
+
+        private void DoStep()
+        {
+            var expression = this.ExecStack.Pop();
+
+            if (!expression.IsCodeOp)
+            {
+                this.CodeStack.Push(expression);
+            }
+
+            expression.Eval(this);
+
+            if (!expression.IsCodeOp)
+            {
+                CodeStack.Pop();
+            }
+        }
+
+        private Task InterpreteAsync()
+        {
+            this.currentTask = Task.Run(() => this.Interpret());
+
+            return this.currentTask;
+        }
+
+        public async Task AbortAsync()
+        {
+            if (this.IsAborted || this.IsCompleted)
+                return;
+
+            this.IsAborted = true;
+
+            if (this.currentTask != null)
+            {
+                await this.currentTask;
+            }
+        }
+
+        public async Task AbortAndReset()
         {
             await this.AbortAsync();
@@ -61,91 +164,4 @@
         }
 
-        public void Interprete(string code)
-        {
-            var program = Encode(code);
-            this.Interprete(program);
-        }
-
-        public Task InterpreteAsync(string code, CancellationToken token = default(CancellationToken))
-        {
-            var program = Encode(code);
-
-            this.currentTask = this.InterpreteAsync(program, token);
-
-            return currentTask;
-        }
-
-        public Task InterpreteAsync(Expression program, CancellationToken token = default(CancellationToken))
-        {
-            this.currentTask = Task.Run(() => this.Interprete(program), token);
-
-            return currentTask;
-        }
-
-        public void Interprete(Expression program)
-        {
-            this.ExecStack.Push(program);
-            this.CodeStack.Push(program);
-
-            // run top expression
-            this.ExecStack.Pop().Eval(this);
-
-            this.Interprete();
-        }
-
-        private void Interprete()
-        {
-            while (IsRunning)
-            {
-                this.DoStep();
-            }
-
-            if (this.Configuration.TopLevelPushCode)
-            {
-                this.CodeStack.Pop();
-            }
-        }
-
-        private void DoStep()
-        {
-            var expression = this.ExecStack.Pop();
-            var isNotCodeOp = !expression.OpCode.IsCodeOp();
-
-            if (isNotCodeOp)
-            {
-                this.CodeStack.Push(expression);
-            }
-
-            expression.Eval(this);
-
-            if (isNotCodeOp)
-            {
-                CodeStack.Pop();
-            }
-        }
-
-        private Task InterpreteAsync()
-        {
-            this.currentTask = Task.Run(() =>
-            {
-                this.Interprete();
-            });
-
-            return this.currentTask;
-        }
-
-        public async Task AbortAsync()
-        {
-            if (this.IsAborted || this.IsCompleted)
-                return;
-
-            this.IsAborted = true;
-
-            if (this.currentTask != null)
-            {
-                await this.currentTask;
-            }
-        }
-
         public async Task PauseAsync()
         {
@@ -163,5 +179,5 @@
         public Task ResumeAsync()
         {
-            if (this.IsPaused)
+            if (this.IsPaused || !this.IsAborted)
             {
                 this.IsPaused = false;
@@ -177,4 +193,9 @@
             {
                 DoStep();
+
+                if (IsCompleted && this.Configuration.TopLevelPopCode)
+                {
+                    this.CodeStack.Pop();
+                }
             }
         }
@@ -182,5 +203,5 @@
         public static Expression Encode(string code)
         {
-            return parser.Parse(code);
+            return Parser.Parse(code);
         }
 
@@ -212,5 +233,8 @@
         private void PrintStack<T>(string name, IStack<T> stack)
         {
-            System.Console.WriteLine($"--- {name} ---\n{stack}\n---------------------------------------------------");
+            Console.WriteLine(string.Format(
+                "--- {0} ---\n{1}\n---------------------------------------------------",
+                name,
+                stack));
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs	(revision 14328)
@@ -18,5 +18,5 @@
         /// <summary>
         /// BOOLEAN.DEFINE:
-        /// Defines the name on top of the NAME stack as an instruction that will push the top item of the BOOLEAN stack onto the EXEC stack.
+        /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the BOOLEAN stack onto the EXEC stack.
         /// </summary>
         BooleanDefine,
@@ -24,7 +24,7 @@
         /// <summary>
         /// BOOLEAN.DUP:
-        /// Duplicates the top item on the BOOLEAN stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!)
-        /// </summary>
-        BooleanDup,
+        /// Duplicatelicates the top item on the BOOLEAN stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!)
+        /// </summary>
+        BooleanDuplicate,
 
         /// <summary>
@@ -109,5 +109,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        BooleanYankDup,
+        BooleanYankDuplicate,
         #endregion Boolean
 
@@ -123,5 +123,5 @@
         /// <summary>
         /// CODE.APPEND:
-        /// Pushes the result of appending the top two pieces of code. If one of the pieces of code is a single instruction or literal (that is, something not surrounded by parentheses) then it is surrounded by parentheses first.
+        /// Pushes the result of appending the top two pieces of code. If one of the pieces of code is a single inclassion or literal (that is, something not surrounded by parentheses) then it is surrounded by parentheses first.
         /// </summary>
         CodeAppend,
@@ -129,5 +129,5 @@
         /// <summary>
         /// CODE.ATOM:
-        /// Pushes TRUE onto the BOOLEAN stack if the top piece of code is a single instruction or a literal, and FALSE otherwise (that is, if it is something surrounded by parentheses).
+        /// Pushes TRUE onto the BOOLEAN stack if the top piece of code is a single inclassion or a literal, and FALSE otherwise (that is, if it is something surrounded by parentheses).
         /// </summary>
         CodeAtom,
@@ -165,5 +165,5 @@
         /// <summary>
         /// CODE.DEFINE:
-        /// Defines the name on top of the NAME stack as an instruction that will push the top item of the CODE stack onto the EXEC stack.
+        /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the CODE stack onto the EXEC stack.
         /// </summary>
         CodeDefine,
@@ -171,5 +171,5 @@
         /// <summary>
         /// CODE.DEFINITION:
-        /// Pushes the definition associated with the top NAME on the NAME stack (if any) onto the CODE stack. This extracts the definition for inspection/manipulation, rather than for immediate execution (although it may then be executed with a call to CODE.DO or a similar instruction).
+        /// Pushes the definition associated with the top NAME on the NAME stack (if any) onto the CODE stack. This extracts the definition for inspection/manipulation, rather than for immediate execution (although it may then be executed with a call to CODE.DO or a similar inclassion).
         /// </summary>
         CodeDefinition,
@@ -178,5 +178,5 @@
         /// CODE.DESCREPANCY:
         /// Pushes a measure of the discrepancy between the top two CODE stack items onto the INTEGER stack. This will be zero if the top two items are equivalent, and will be higher the 'more different' the items are from one another. The calculation is as follows:
-        /// 1. Construct a list of all of the unique items in both of the lists (where uniqueness is determined by equalp). Sub-lists and atoms all count as items.
+        /// 1. Conclass a list of all of the unique items in both of the lists (where uniqueness is determined by equalp). Sub-lists and atoms all count as items.
         /// 2. Initialize the result to zero.
         /// 3. For each unique item increment the result by the difference between the number of occurrences of the item in the two pieces of code.
@@ -199,5 +199,5 @@
         /// <summary>
         /// CODE.DO*COUNT:
-        /// An iteration instruction that performs a loop (the body of which is taken from the CODE stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This should be implemented as a macro that expands into a call to CODE.DO*RANGE. CODE.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single CODE argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:
+        /// An iteration inclassion that performs a loop (the body of which is taken from the CODE stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This should be implemented as a macro that expands into a call to CODE.DO*RANGE. CODE.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single CODE argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:
         /// ( 0 '1 - IntegerArg' CODE.QUOTE <CodeArg> CODE.DO*RANGE )
         /// </summary>
@@ -206,5 +206,5 @@
         /// <summary>
         /// CODE.DO*RANGE:
-        /// An iteration instruction that executes the top item on the CODE stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to CODE.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.
+        /// An iteration inclassion that executes the top item on the CODE stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to CODE.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.
         /// </summary>
         CodeDoXRange,
@@ -218,11 +218,11 @@
         /// <summary>
         /// CODE.DUP:
-        /// Duplicates the top item on the CODE stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
-        /// </summary>
-        CodeDup,
+        /// Duplicatelicates the top item on the CODE stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
+        /// </summary>
+        CodeDuplicate,
 
         /// <summary>
         /// CODE.EXTRACT:
-        /// Pushes the sub-expression of the top item of the CODE stack that is indexed by the top item of the INTEGER stack. The indexing here counts "points," where each parenthesized expression and each literal/instruction is considered a point, and it proceeds in depth first order. The entire piece of code is at index 0; if it is a list then the first item in the list is at index 1, etc. The integer used as the index is taken modulo the number of points in the overall expression (and its absolute value is taken in case it is negative) to ensure that it is within the meaningful range.
+        /// Pushes the sub-expression of the top item of the CODE stack that is indexed by the top item of the INTEGER stack. The indexing here counts "points," where each parenthesized expression and each literal/inclassion is considered a point, and it proceeds in depth first order. The entire piece of code is at index 0; if it is a list then the first item in the list is at index 1, etc. The integer used as the index is taken modulo the number of points in the overall expression (and its absolute value is taken in case it is negative) to ensure that it is within the meaningful range.
         /// </summary>
         CodeExtract,
@@ -265,4 +265,10 @@
 
         /// <summary>
+        /// CODE.INSTRUCTIONS:
+        /// Pushes a list of all active instructions in the interpreter's current configuration.
+        /// </summary>
+        CodeInstructions,
+
+        /// <summary>
         /// CODE.INSERT:
         /// Pushes the result of inserting the second item of the CODE stack into the first item, at the position indexed by the top item of the INTEGER stack (and replacing whatever was there formerly). The indexing is computed as in CODE.EXTRACT.
@@ -272,7 +278,7 @@
         /// <summary>
         /// CODE.INSTRUCTIONS:
-        /// Pushes a list of all active instructions in the interpreter's current configuration.
-        /// </summary>
-        CodeInstructions,
+        /// Pushes a list of all active inclassions in the interpreter's current configuration.
+        /// </summary>
+        CodeInclassions,
 
         /// <summary>
@@ -311,4 +317,15 @@
 
         /// <summary>
+        /// CODE.NULL: Pushes TRUE onto the BOOLEAN stack if the top item of the CODE stack is an empty list, or FALSE otherwise.
+        /// </summary>
+        CodeNull,
+
+        /// <summary>
+        /// CODE.POSITION:
+        /// Pushes onto the INTEGER stack the position of the second item on the CODE stack within the first item (which is coerced to a list if necessary). Pushes -1 if no match is found.
+        /// </summary>
+        CodePosition,
+
+        /// <summary>
         /// CODE.QUOTE:
         /// Specifies that the next expression submitted for execution will instead be pushed literally onto the CODE stack. This can be implemented by moving the top item on the EXEC stack onto the CODE stack.
@@ -334,5 +351,5 @@
 
         /// <summary>
-        /// CODE.SIZE: Pushes the number of "points" in the top piece of CODE onto the INTEGER stack. Each instruction, literal, and pair of parentheses counts as a point.
+        /// CODE.SIZE: Pushes the number of "points" in the top piece of CODE onto the INTEGER stack. Each inclassion, literal, and pair of parentheses counts as a point.
         /// </summary>
         CodeSize,
@@ -364,5 +381,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        CodeYankDup,
+        CodeYankDuplicate,
         #endregion Code
 
@@ -380,5 +397,5 @@
         /// <summary>
         /// EXEC.DEFINE:
-        /// Defines the name on top of the NAME stack as an instruction that will push the top item of the EXEC stack back onto the EXEC stack.
+        /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the EXEC stack back onto the EXEC stack.
         /// </summary>
         ExecDefine,
@@ -386,5 +403,5 @@
         /// <summary>
         /// EXEC.DO*COUNT:
-        /// An iteration instruction that performs a loop (the body of which is taken from the EXEC stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. This should be implemented as a macro that expands into a call to EXEC.DO*RANGE. EXEC.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single EXEC argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:
+        /// An iteration inclassion that performs a loop (the body of which is taken from the EXEC stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. This should be implemented as a macro that expands into a call to EXEC.DO*RANGE. EXEC.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single EXEC argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:
         /// ( 0 <1 - IntegerArg> EXEC.DO*RANGE <ExecArg> )
         /// </summary>
@@ -393,5 +410,5 @@
         /// <summary>
         /// EXEC.DO*RANGE:
-        /// An iteration instruction that executes the top item on the EXEC stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to EXEC.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.
+        /// An iteration inclassion that executes the top item on the EXEC stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to EXEC.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.
         /// </summary>
         ExecDoXRange,
@@ -405,11 +422,11 @@
         /// <summary>
         /// EXEC.DUP:
-        /// Duplicates the top item on the EXEC stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). This may be thought of as a "DO TWICE" instruction.
-        /// </summary>
-        ExecDup,
+        /// Duplicatelicates the top item on the EXEC stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). This may be thought of as a "DO TWICE" inclassion.
+        /// </summary>
+        ExecDuplicate,
 
         /// <summary>
         /// EXEC.FLUSH:
-        /// Empties the EXEC stack. This may be thought of as a "HALT" instruction.
+        /// Empties the EXEC stack. This may be thought of as a "HALT" inclassion.
         /// </summary>
         ExecFlush,
@@ -428,5 +445,5 @@
 
         /// <summary>
-        /// EXEC.POP: Pops the EXEC stack. This may be thought of as a "DONT" instruction.
+        /// EXEC.POP: Pops the EXEC stack. This may be thought of as a "DONT" inclassion.
         /// </summary>
         ExecPop,
@@ -439,6 +456,12 @@
 
         /// <summary>
+        /// EXEC.S:
+        /// The Push implementation of the "S combinator". Pops 3 items from the EXEC stack, which we will call A, B, and C (with A being the first one popped). Then pushes a list containing B and C back onto the EXEC stack, followed by another instance of C, followed by another instance of A.
+        /// </summary>
+        ExecS,
+
+        /// <summary>
         /// EXEC.SHOVE:
-        /// Inserts the top EXEC item "deep" in the stack, at the position indexed by the top INTEGER. This may be thought of as a "DO LATER" instruction.
+        /// Inserts the top EXEC item "deep" in the stack, at the position indexed by the top INTEGER. This may be thought of as a "DO LATER" inclassion.
         /// </summary>
         ExecShove,
@@ -464,5 +487,5 @@
         /// <summary>
         /// EXEC.YANK:
-        /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack. This may be thought of as a "DO SOONER" instruction.
+        /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack. This may be thought of as a "DO SOONER" inclassion.
         /// </summary>
         ExecYank,
@@ -472,5 +495,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        ExecYankDup,
+        ExecYankDuplicate,
         #endregion Exec
 
@@ -533,5 +556,5 @@
         /// <summary>
         /// FLOAT.DEFINE:
-        /// Defines the name on top of the NAME stack as an instruction that will push the top item of the FLOAT stack onto the EXEC stack.
+        /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the FLOAT stack onto the EXEC stack.
         /// </summary>
         FloatDefine,
@@ -539,7 +562,7 @@
         /// <summary>
         /// FLOAT.DUP:
-        /// Duplicates the top item on the FLOAT stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
-        /// </summary>
-        FloatDup,
+        /// Duplicatelicates the top item on the FLOAT stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
+        /// </summary>
+        FloatDuplicate,
 
         /// <summary>
@@ -636,5 +659,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        FloatYankDup,
+        FloatYankDuplicate,
 
         #endregion Float
@@ -692,12 +715,6 @@
 
         /// <summary>
-        /// INTEGER.COS:
-        /// Pushes the cosine of the top item.
-        /// </summary>
-        IntegerCos,
-
-        /// <summary>
         /// INTEGER.DEFINE:
-        /// Defines the name on top of the NAME stack as an instruction that will push the top item of the INTEGER stack onto the EXEC stack.
+        /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the INTEGER stack onto the EXEC stack.
         /// </summary>
         IntegerDefine,
@@ -705,7 +722,7 @@
         /// <summary>
         /// INTEGER.DUP:
-        /// Duplicates the top item on the INTEGER stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
-        /// </summary>
-        IntegerDup,
+        /// Duplicatelicates the top item on the INTEGER stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
+        /// </summary>
+        IntegerDuplicate,
 
         /// <summary>
@@ -769,10 +786,4 @@
 
         /// <summary>
-        /// INTEGER.SIN:
-        /// Pushes the sine of the top item.
-        /// </summary>
-        IntegerSin,
-
-        /// <summary>
         /// INTEGER.STACKDEPTH:
         /// Pushes the stack depth onto the INTEGER stack.
@@ -787,10 +798,4 @@
 
         /// <summary>
-        /// INTEGER.TAN:
-        /// Pushes the tangent of the top item.
-        /// </summary>
-        IntegerTan,
-
-        /// <summary>
         /// INTEGER.YANK:
         /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack.
@@ -802,5 +807,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        IntegerYankDup,
+        IntegerYankDuplicate,
 
         #endregion Integer
@@ -823,7 +828,7 @@
         /// <summary>
         /// NAME.DUP:
-        /// Duplicates the top item on the NAME stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
-        /// </summary>
-        NameDup,
+        /// Duplicatelicates the top item on the NAME stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).
+        /// </summary>
+        NameDuplicate,
 
         /// <summary>
@@ -890,5 +895,5 @@
         /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack.
         /// </summary>
-        NameYankDup,
+        NameYankDuplicate,
         #endregion Name
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCodeExtensions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCodeExtensions.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCodeExtensions.cs	(revision 14328)
@@ -6,11 +6,6 @@
     public static class OpCodeExtensions
     {
-        public readonly static byte Min = 0;
+        public const byte Min = 0;
         public readonly static byte Max = Enum.GetValues(typeof(OpCode)).Cast<byte>().Last();
-
-        public static bool IsCodeOp(this OpCode opCode)
-        {
-            return opCode >= OpCode.CodeEquals && opCode < OpCode.CodeYankDup;
-        }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs	(revision 14328)
@@ -2,24 +2,31 @@
 using System.Globalization;
 using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Expressions.Boolean;
+using HeuristicLab.Algorithms.PushGP.Expressions.Code;
+using HeuristicLab.Algorithms.PushGP.Expressions.Exec;
+using HeuristicLab.Algorithms.PushGP.Expressions.Float;
+using HeuristicLab.Algorithms.PushGP.Expressions.Integer;
+using HeuristicLab.Algorithms.PushGP.Expressions.Name;
 
 namespace HeuristicLab.Algorithms.PushGP
 {
-    public class Parser
+    public static class Parser
     {
-        private readonly CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture("en-US");
+        private static readonly CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture("en-US");
 
-        private const string OpenBrace = "(";
-        private const string CloseBrace = ")";
-        private readonly char[] symbolTrim = new[] { '\r', '\n' };
+        private const string openBrace = "(";
+        private const string closeBrace = ")";
+        private const char delimiter = ' ';
+        private static readonly char[] symbolTrim = new[] { '\r', '\n' };
 
-        public Expression Parse(string source, int startIndex = 0)
+        public static Expression Parse(string source, int startIndex = 0)
         {
-            var symbols = source.Split(' ');
+            var symbols = source.Split(delimiter);
 
             int endIndex;
-            return this.Parse(symbols, 0, out endIndex);
+            return Parse(symbols, 0, out endIndex);
         }
 
-        private Expression Parse(string[] symbols, int startIndex, out int endIndex)
+        private static Expression Parse(string[] symbols, int startIndex, out int endIndex)
         {
             var expressions = new List<Expression>();
@@ -28,4 +35,5 @@
             {
                 var symbol = symbols[i].TrimEnd(symbolTrim);
+
                 if (string.IsNullOrWhiteSpace(symbol))
                 {
@@ -33,5 +41,5 @@
                 }
 
-                if (symbol == OpenBrace)
+                if (symbol == openBrace)
                 {
                     var subExpression = Parse(symbols, i + 1, out endIndex);
@@ -40,5 +48,5 @@
                     continue;
                 }
-                else if (symbol == CloseBrace)
+                else if (symbol == closeBrace)
                 {
                     endIndex = i;
@@ -46,9 +54,4 @@
                         ? new ExecExpandExpression(expressions.ToArray())
                         : new CodeNoopExpression() as Expression;
-                }
-
-                if (string.IsNullOrWhiteSpace(symbol))
-                {
-                    continue;
                 }
 
@@ -61,14 +64,14 @@
                 }
 
-                // instruction
+                // expression
                 OpCode opCode;
                 if (SymbolTable.TryGetOpCode(symbol, out opCode))
                 {
-                    expression = ExpressionCreatorTable.GetCreator(opCode).Invoke();
+                    expression = ExpressionFactory.Create(opCode);
                     expressions.Insert(0, expression);
                     continue;
                 }
 
-                // identifier - custom instruction or named literals
+                // identifier - custom expression or named literals
                 expressions.Insert(0, new NameDefineXExecExpression(symbol));
             }
@@ -80,5 +83,5 @@
         }
 
-        private bool TryParseLiteral(string word, out Expression expression)
+        private static bool TryParseLiteral(string word, out Expression expression)
         {
             long longValue;
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/SymbolTable.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/SymbolTable.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/SymbolTable.cs	(revision 14328)
@@ -1,5 +1,4 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.Linq;
 
 namespace HeuristicLab.Algorithms.PushGP
@@ -10,68 +9,156 @@
         {
             #region Code
-            { "CODE.NOOP", OpCode.CodeNoop },
-            { "CODE.PUSH", OpCode.CodePush },
-            { "CODE.IF", OpCode.CodeIf },
-            { "CODE.DEFINE", OpCode.CodeDefine },
-            { "CODE.DUP", OpCode.CodeDup },
-            { "CODE.QUOTE", OpCode.CodeQuote },
-            { "CODE.DO", OpCode.CodeDo },
+            { Symbols.CodeIf, OpCode.CodeIf },
+            { Symbols.CodeDefine, OpCode.CodeDefine },
+            { Symbols.CodeDuplicate, OpCode.CodeDuplicate },
+            { Symbols.CodeQuote, OpCode.CodeQuote },
+            { Symbols.CodeDo, OpCode.CodeDo },
+            { Symbols.CodeEquals, OpCode.CodeEquals },
+            { Symbols.CodeAppend, OpCode.CodeAppend },
+            { Symbols.CodeAtom, OpCode.CodeAtom },
+            { Symbols.CodeCar, OpCode.CodeCar },
+            { Symbols.CodeCdr, OpCode.CodeCdr },
+            { Symbols.CodeCons, OpCode.CodeCons },
+            { Symbols.CodeContainer, OpCode.CodeContainer },
+            { Symbols.CodeContains, OpCode.CodeContains },
+            { Symbols.CodeDefinition, OpCode.CodeDefinition },
+            { Symbols.CodeDiscrepancy, OpCode.CodeDiscrepancy },
+            { Symbols.CodeDoX, OpCode.CodeDoX },
+            { Symbols.CodeDoXCount, OpCode.CodeDoXCount },
+            { Symbols.CodeDoXRange, OpCode.CodeDoXRange },
+            { Symbols.CodeDoXTimes, OpCode.CodeDoXTimes },
+            { Symbols.CodeExtract, OpCode.CodeExtract },
+            { Symbols.CodeFlush, OpCode.CodeFlush },
+            { Symbols.CodeFromFloat, OpCode.CodeFromFloat },
+            { Symbols.CodeFromInteger, OpCode.CodeFromInteger },
+            { Symbols.CodeFromName, OpCode.CodeFromName },
+            { Symbols.CodeInsert, OpCode.CodeInsert },
+            { Symbols.CodeInstructions, OpCode.CodeInstructions },
+            { Symbols.CodeLength, OpCode.CodeLength },
+            { Symbols.CodeList, OpCode.CodeList },
+            { Symbols.CodeMember, OpCode.CodeMember },
+            { Symbols.CodeNoop, OpCode.CodeNoop },
+            { Symbols.CodeNth, OpCode.CodeNth },
+            { Symbols.CodeNthCdr, OpCode.CodeNthCdr },
+            { Symbols.CodeNull, OpCode.CodeNull },
+            { Symbols.CodePosition, OpCode.CodePosition },
+            { Symbols.CodeRand, OpCode.CodeRand },
+            { Symbols.CodeRot, OpCode.CodeRot },
+            { Symbols.CodeShove, OpCode.CodeShove },
+            { Symbols.CodeSize, OpCode.CodeSize },
+            { Symbols.CodeStackDepth, OpCode.CodeStackDepth },
+            { Symbols.CodeSubst, OpCode.CodeSubst },
+            { Symbols.CodeSwap, OpCode.CodeSwap },
+            { Symbols.CodeYank, OpCode.CodeYank },
+            { Symbols.CodeYankDuplicate, OpCode.CodeYankDuplicate },
             #endregion Code
 
             #region Exec
-            { "EXEC.EXPAND", OpCode.ExecExpand },
-            { "EXEC.PUSH", OpCode.ExecPush },
-            { "EXEC.IF", OpCode.ExecIf },
-            { "EXEC.DEFINE", OpCode.ExecDefine },
-            { "EXEC.DUP", OpCode.ExecDup },
-            { "EXEC.POP", OpCode.ExecPop },
-            { "EXEC.Y", OpCode.ExecY },
-            { "EXEC.DO*RANGE", OpCode.ExecDoXRange },
+            { Symbols.ExecIf, OpCode.ExecIf },
+            { Symbols.ExecDefine, OpCode.ExecDefine },
+            { Symbols.ExecDuplicate, OpCode.ExecDuplicate },
+            { Symbols.ExecPop, OpCode.ExecPop },
+            { Symbols.ExecY, OpCode.ExecY },
+            { Symbols.ExecDoXRange, OpCode.ExecDoXRange },
+            { Symbols.ExecEquals, OpCode.ExecEquals },
+            { Symbols.ExecDoXCount, OpCode.ExecDoXCount },
+            { Symbols.ExecDoXTimes, OpCode.ExecDoXTimes },
+            { Symbols.ExecFlush, OpCode.ExecFlush },
+            { Symbols.ExecK, OpCode.ExecK },
+            { Symbols.ExecRot, OpCode.ExecRot },
+            { Symbols.ExecS, OpCode.ExecS },
+            { Symbols.ExecShove, OpCode.ExecShove },
+            { Symbols.ExecStackDepth, OpCode.ExecStackDepth },
+            { Symbols.ExecSwap, OpCode.ExecSwap },
+            { Symbols.ExecYank, OpCode.ExecYank },
+            { Symbols.ExecYankDuplicate, OpCode.ExecYankDuplicate },
             #endregion Exec
 
             #region Name
-            { "NAME.DEFINE*EXEC", OpCode.NameDefineXExec },
-            { "NAME.POP", OpCode.NamePop },
-            { "NAME.DUP", OpCode.NameDup },
+            { Symbols.NamePop, OpCode.NamePop },
+            { Symbols.NameDuplicate, OpCode.NameDuplicate },
+            { Symbols.NameEquals, OpCode.NameEquals },
+            { Symbols.NameFlush, OpCode.NameFlush },
+            { Symbols.NameQuote, OpCode.NameQuote },
+            { Symbols.NameRand, OpCode.NameRand },
+            { Symbols.NameRandBoundName, OpCode.NameRand },
+            { Symbols.NameRot, OpCode.NameRot },
+            { Symbols.NameShove, OpCode.NameShove },
+            { Symbols.NameStackDepth, OpCode.NameStackDepth },
+            { Symbols.NameSwap, OpCode.NameSwap },
+            { Symbols.NameYank, OpCode.NameYank },
+            { Symbols.NameYankDuplicate, OpCode.NameYankDuplicate },
             #endregion Name
 
             #region Boolean
-            { "BOOLEAN.PUSH", OpCode.BooleanPush },
-            { "BOOLEAN.POP", OpCode.BooleanPop },
-            { "BOOLEAN.DUP", OpCode.BooleanDup },
-            { "BOOLEAN.AND", OpCode.BooleanAnd },
-            { "BOOLEAN.OR", OpCode.BooleanOr },
+            { Symbols.BooleanPop, OpCode.BooleanPop },
+            { Symbols.BooleanDuplicate, OpCode.BooleanDuplicate },
+            { Symbols.BooleanAnd, OpCode.BooleanAnd },
+            { Symbols.BooleanOr, OpCode.BooleanOr },
+            { Symbols.BooleanEquals, OpCode.BooleanEquals },
+            { Symbols.BooleanFlush, OpCode.BooleanFlush },
+            { Symbols.BooleanFromFloat, OpCode.BooleanFromFloat },
+            { Symbols.BooleanFromInteger, OpCode.BooleanFromInteger },
+            { Symbols.BooleanNot, OpCode.BooleanNot },
+            { Symbols.BooleanRand, OpCode.BooleanRand },
+            { Symbols.BooleanRot, OpCode.BooleanRot },
+            { Symbols.BooleanShove, OpCode.BooleanShove },
+            { Symbols.BooleanStackDepth, OpCode.BooleanStackDepth },
+            { Symbols.BooleanSwap, OpCode.BooleanSwap },
+            { Symbols.BooleanYank, OpCode.BooleanYank },
+            { Symbols.BooleanYankDuplicate, OpCode.BooleanYankDuplicate },
             #endregion Boolean
 
             #region Integer
-            { "INTEGER.PUSH", OpCode.IntegerPush },
-            { "INTEGER.POP", OpCode.IntegerPop },
-            { "INTEGER.DUP", OpCode.IntegerDup },
-            { "INTEGER.DEFINE", OpCode.IntegerDefine },
-            { "INTEGER.+", OpCode.IntegerAdd },
-            { "INTEGER.-", OpCode.IntegerSubtract },
-            { "INTEGER.*", OpCode.IntegerMultiply },
-            { "INTEGER./", OpCode.IntegerDivide },
-            { "INTEGER.<", OpCode.IntegerSmallerThan },
-            { "INTEGER.>", OpCode.IntegerGreaterThan },
-            { "INTEGER.=", OpCode.IntegerEquals },
-            { "INTEGER.MIN", OpCode.IntegerMin },
-            { "INTEGER.MAX", OpCode.IntegerMax },
+            { Symbols.IntegerPop, OpCode.IntegerPop },
+            { Symbols.IntegerDuplicate, OpCode.IntegerDuplicate },
+            { Symbols.IntegerDefine, OpCode.IntegerDefine },
+            { Symbols.IntegerAdd, OpCode.IntegerAdd },
+            { Symbols.IntegerSubtract, OpCode.IntegerSubtract },
+            { Symbols.IntegerMultiply, OpCode.IntegerMultiply },
+            { Symbols.IntegerDivide, OpCode.IntegerDivide },
+            { Symbols.IntegerSmallerThan, OpCode.IntegerSmallerThan },
+            { Symbols.IntegerGreaterThan, OpCode.IntegerGreaterThan },
+            { Symbols.IntegerEquals, OpCode.IntegerEquals },
+            { Symbols.IntegerMin, OpCode.IntegerMin },
+            { Symbols.IntegerMax, OpCode.IntegerMax },
+            { Symbols.IntegerModulo, OpCode.IntegerModulo },
+            { Symbols.IntegerFlush, OpCode.IntegerFlush },
+            { Symbols.IntegerFromBoolean, OpCode.IntegerFromBoolean },
+            { Symbols.IntegerFromFloat, OpCode.IntegerFromFloat },
+            { Symbols.IntegerRand, OpCode.IntegerRand },
+            { Symbols.IntegerRot, OpCode.IntegerRot },
+            { Symbols.IntegerShove, OpCode.IntegerShove },
+            { Symbols.IntegerStackDepth, OpCode.IntegerStackDepth },
+            { Symbols.IntegerSwap, OpCode.IntegerSwap },
+            { Symbols.IntegerYank, OpCode.IntegerYank },
+            { Symbols.IntegerYankDuplicate, OpCode.IntegerYankDuplicate },
             #endregion Integer
 
             #region Float
-            { "FLOAT.PUSH", OpCode.FloatPush },
-            { "FLOAT.POP", OpCode.FloatPop },
-            { "FLOAT.DUP", OpCode.FloatDup },
-            { "FLOAT.DEFINE", OpCode.FloatDefine },
-            { "FLOAT.+", OpCode.FloatAdd },
-            { "FLOAT.-", OpCode.FloatSubtract },
-            { "FLOAT.*", OpCode.FloatMultiply },
-            { "FLOAT./", OpCode.FloatDivide },
-            { "FLOAT.<", OpCode.FloatSmallerThan },
-            { "FLOAT.>", OpCode.FloatGreaterThan },
-            { "FLOAT.=", OpCode.FloatEquals },
-            { "FLOAT.MIN", OpCode.FloatMin },
-            { "FLOAT.MAX", OpCode.FloatMax },
+            { Symbols.FloatPop, OpCode.FloatPop },
+            { Symbols.FloatDuplicate, OpCode.FloatDuplicate },
+            { Symbols.FloatDefine, OpCode.FloatDefine },
+            { Symbols.FloatAdd, OpCode.FloatAdd },
+            { Symbols.FloatSubtract, OpCode.FloatSubtract },
+            { Symbols.FloatMultiply, OpCode.FloatMultiply },
+            { Symbols.FloatDivide, OpCode.FloatDivide },
+            { Symbols.FloatSmallerThan, OpCode.FloatSmallerThan },
+            { Symbols.FloatGreaterThan, OpCode.FloatGreaterThan },
+            { Symbols.FloatEquals, OpCode.FloatEquals },
+            { Symbols.FloatMin, OpCode.FloatMin },
+            { Symbols.FloatMax, OpCode.FloatMax },
+            { Symbols.FloatCos, OpCode.FloatCos },
+            { Symbols.FloatSin, OpCode.FloatSin },
+            { Symbols.FloatTan, OpCode.FloatTan },
+            { Symbols.FloatFromBoolean, OpCode.FloatFromBoolean },
+            { Symbols.FloatFromInteger, OpCode.FloatFromInteger },
+            { Symbols.FloatRand, OpCode.FloatRand },
+            { Symbols.FloatRot, OpCode.FloatRot },
+            { Symbols.FloatShove, OpCode.FloatShove },
+            { Symbols.FloatStackDepth, OpCode.FloatStackDepth },
+            { Symbols.FloatSwap, OpCode.FloatSwap },
+            { Symbols.FloatYank, OpCode.FloatYank },
+            { Symbols.FloatYankDuplicate, OpCode.FloatYankDuplicate },
             #endregion Float
         };
@@ -81,5 +168,5 @@
             OpCode opCode;
             if (symbolTable.TryGetValue(operationName, out opCode)) return opCode;
-            else throw new NotSupportedException("Symbol: " + operationName);
+            else throw new NotSupportedException("Operation not supported: " + operationName);
         }
 
@@ -88,13 +175,4 @@
             return symbolTable.TryGetValue(operationName, out opCode);
         }
-
-        public static string GetSymbol(OpCode opCode)
-        {
-            var symbol = symbolTable.SingleOrDefault(pair => pair.Value == opCode);
-
-            return !symbol.Equals(default(KeyValuePair<string, OpCode>))
-                ? symbol.Key
-                : null;
-        }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs	(revision 14328)
@@ -2,12 +2,13 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Text;
 
 namespace HeuristicLab.Algorithms.PushGP.Stack
 {
     /// <summary>
-    /// While Push's stacks are generally treated as genuine stacks---that is, instructions take their arguments from the tops of
-    /// the stacks and push their results onto the tops of the stacks---a few instructions (like YANK and SHOVE) do allow direct access
+    /// While Push's stacks are generally treated as genuine stacks---that is, inclassions take their arguments from the tops of
+    /// the stacks and push their results onto the tops of the stacks---a few inclassions (like YANK and SHOVE) do allow direct access
     /// to "deep" stack elements by means of integer indices. To this extent the stacks can be used as general, random access memory
-    /// structures. This is one of the features that ensures the Turing-completeness of Push (another being the arbitrary name/value
+    /// classures. This is one of the features that ensures the Turing-completeness of Push (another being the arbitrary name/value
     /// bindings supported by the NAME data type and DEFINE methods; see below).
     /// </summary>
@@ -15,9 +16,16 @@
     public class PushGPStack<T> : IStack<T>
     {
-        private List<T> data = new List<T>();
+        private readonly List<T> data;
+        private const string delimiter = " ";
 
-        public T Top => this.data[Count - 1];
-        public int Count => data.Count;
-        public bool IsEmpty => this.Count == 0;
+        public PushGPStack(int capacity = 0)
+        {
+            this.data = new List<T>();
+        }
+
+        public T Top { get { return this.data[Count - 1]; } }
+        public int Count { get { return this.data.Count; } }
+        public int Capacity { get { return this.data.Capacity; } }
+        public bool IsEmpty { get { return this.Count == 0; } }
 
         public bool IsReadOnly
@@ -61,7 +69,6 @@
         public T Pop()
         {
-            var index = Count - 1;
-            var value = this.data[index];
-            this.data.RemoveAt(index);
+            var value = this.data[Count - 1];
+            this.data.RemoveAt(Count - 1);
 
             return value;
@@ -75,5 +82,10 @@
             this.data.RemoveRange(startIndex, count);
 
-            items.Reverse();
+            // is faster than remove range??
+            for (var i = this.Count - 1; i > startIndex - 1; i--)
+            {
+                this.data.RemoveAt(i);
+            }
+
             return items.ToArray();
         }
@@ -86,5 +98,8 @@
         public void Push(params T[] items)
         {
-            this.data.AddRange(items);
+            foreach (var item in items)
+            {
+                this.data.Add(item);
+            }
         }
 
@@ -112,5 +127,5 @@
         {
             var index = Count - 1;
-            if (this.data.Count > 0 && this.data[index].Equals(item))
+            if (this.Count > 0 && this.data[index].Equals(item))
             {
                 this.data.RemoveAt(index);
@@ -125,5 +140,5 @@
         public bool TryPop(out T item)
         {
-            if (this.data.Count > 0)
+            if (this.Count > 0)
             {
                 item = this.Pop();
@@ -144,5 +159,19 @@
         public override string ToString()
         {
-            return string.Join(", ", this.data);
+            if (this.Count == 0)
+            {
+                return string.Empty;
+            }
+
+            var sb = new StringBuilder();
+
+            for (var i = this.Count - 1; i > 0; i--)
+            {
+                sb.Append(this.data[i] + delimiter);
+            }
+
+            sb.Append(this.data[0]);
+
+            return sb.ToString();
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/StaticRandom.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/StaticRandom.cs	(revision 14327)
+++ 	(revision )
@@ -1,20 +1,0 @@
-﻿using System;
-using System.Threading;
-
-namespace HeuristicLab.Algorithms.PushGP
-{
-    public static class StaticRandom
-    {
-        static int seed = Environment.TickCount;
-
-        static readonly ThreadLocal<Random> random =
-            new ThreadLocal<Random>(() => new Random(Interlocked.Increment(ref seed)));
-
-        public static int Next(int minValue = int.MinValue, int maxValue = int.MaxValue)
-        {
-            return random.Value.Next(minValue, maxValue);
-        }
-
-        public static double NextDouble => random.Value.NextDouble();
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/BooleanExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/BooleanExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/BooleanExpressionTests.cs	(revision 14328)
@@ -0,0 +1,10 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class BooleanExpressionTests : InterpreterTest
+    {
+
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/CodeExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/CodeExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/CodeExpressionTests.cs	(revision 14328)
@@ -0,0 +1,10 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class CodeExpressionTests : InterpreterTest
+    {
+
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExampleTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExampleTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExampleTests.cs	(revision 14328)
@@ -0,0 +1,256 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class MixedExpressionTests : InterpreterTest
+    {
+        const double Delta = 0.00000001;
+
+        [TestMethod]
+        public void Example1()
+        {
+            this.interpreter.Interpret("( 2 3 INTEGER.* 4.1 5.2 FLOAT.+ TRUE FALSE BOOLEAN.OR )");
+
+            Assert.AreEqual(6, interpreter.IntegerStack.Top);
+            Assert.AreEqual(9.3, interpreter.FloatStack.Top);
+            Assert.AreEqual(interpreter.BooleanStack.Top, true);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example2()
+        {
+            this.interpreter.Interpret("( 5 1.23 INTEGER.+ ( 4 ) INTEGER.- 5.67 FLOAT.* )");
+
+            Assert.AreEqual(1, interpreter.IntegerStack.Top);
+            Assert.AreEqual(6.9741, interpreter.FloatStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example3()
+        {
+            this.interpreter.Interpret("( 5 INTEGER.DUP INTEGER.+ )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example4()
+        {
+            this.interpreter.Interpret("( 5 CODE.QUOTE ( INTEGER.DUP INTEGER.+ ) CODE.DO )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example5()
+        {
+            this.interpreter.Interpret("( DOUBLE CODE.QUOTE ( INTEGER.DUP INTEGER.+ ) CODE.DEFINE 5 DOUBLE )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example6()
+        {
+            this.interpreter.Interpret("( CODE.QUOTE ( INTEGER.DUP INTEGER.+ ) DOUBLE CODE.DEFINE 5 DOUBLE )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example7()
+        {
+            this.interpreter.Interpret("( DOUBLE EXEC.DEFINE ( INTEGER.DUP INTEGER.+ ) 5 DOUBLE )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example8()
+        {
+            this.interpreter.IntegerStack.Push(5);
+            this.interpreter.Interpret(@"( CODE.QUOTE ( INTEGER.POP 1 )
+                                           CODE.QUOTE ( CODE.DUP INTEGER.DUP 1 INTEGER.- CODE.DO INTEGER.* )
+                                           INTEGER.DUP 2 INTEGER.< CODE.IF )");
+
+            Assert.AreEqual(120, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example9()
+        {
+            this.interpreter.IntegerStack.Push(5);
+            this.interpreter.Interpret("( 1 INTEGER.MAX 1 EXEC.DO*RANGE INTEGER.* )");
+
+            Assert.AreEqual(120, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example10()
+        {
+            this.interpreter.IntegerStack.Push(5);
+            this.interpreter.Interpret("( 1 INTEGER.MAX 1 EXEC.DO*RANGE ( 2 INTEGER.* ) )");
+
+            Assert.AreEqual(32, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example11()
+        {
+            var program = PushGPInterpreter.Encode("( INTEGER.= CODE.QUOTE FLOAT.* CODE.QUOTE FLOAT./ CODE.IF )");
+
+            this.interpreter.IntegerStack.Push(1, 1);
+            this.interpreter.FloatStack.Push(2.1, 0.7);
+
+            this.interpreter.Interpret(program);
+
+            Assert.IsTrue(interpreter.IntegerStack.IsEmpty);
+            Assert.AreEqual(1.47, interpreter.FloatStack.Top, Delta);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+
+            this.interpreter.Clear();
+            this.interpreter.IntegerStack.Push(1, 2);
+            this.interpreter.FloatStack.Push(2.1, 0.7);
+            this.interpreter.Interpret(program);
+
+            Assert.IsTrue(interpreter.IntegerStack.IsEmpty);
+            Assert.AreEqual(3d, interpreter.FloatStack.Top, Delta);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example12()
+        {
+            var program = PushGPInterpreter.Encode("( INTEGER.= EXEC.IF FLOAT.* FLOAT./ )");
+
+            this.interpreter.IntegerStack.Push(1, 1);
+            this.interpreter.FloatStack.Push(2.1, 0.7);
+
+            this.interpreter.Interpret(program);
+
+            Assert.IsTrue(interpreter.IntegerStack.IsEmpty);
+            Assert.AreEqual(1.47, interpreter.FloatStack.Top, Delta);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+
+            this.interpreter.Clear();
+            this.interpreter.IntegerStack.Push(1, 2);
+            this.interpreter.FloatStack.Push(2.1, 0.7);
+            this.interpreter.Interpret(program);
+
+            Assert.IsTrue(interpreter.IntegerStack.IsEmpty);
+            Assert.AreEqual(3d, interpreter.FloatStack.Top, Delta);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example13()
+        {
+            this.interpreter.IntegerStack.Push(5);
+            this.interpreter.Interpret("( EXEC.Y ( ( FALSE 2 INTEGER.* ) EXEC.IF ( ) EXEC.POP ) )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example14()
+        {
+            this.interpreter.IntegerStack.Push(5);
+            this.interpreter.Interpret("( EXEC.Y ( ( 2 INTEGER.* INTEGER.DUP 1000 INTEGER.< ) EXEC.IF ( ) EXEC.POP ) )");
+
+            Assert.AreEqual(1280, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void Example15()
+        {
+            this.interpreter.IntegerStack.Push(10);
+            this.interpreter.FloatStack.Push(2);
+            this.interpreter.Interpret(@"( ARG FLOAT.DEFINE
+                                            EXEC.Y (
+                                            ARG FLOAT.*
+                                            1 INTEGER.-
+                                            INTEGER.DUP 1 INTEGER.>
+                                            EXEC.IF ( ) EXEC.POP
+                                            )
+                                          )");
+
+            Assert.AreEqual(1024, interpreter.FloatStack.Top, Delta);
+            Assert.AreEqual(1, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExecExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExecExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/ExecExpressionTests.cs	(revision 14328)
@@ -0,0 +1,10 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class ExecExpressionTests : InterpreterTest
+    {
+
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/FloatExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/FloatExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/FloatExpressionTests.cs	(revision 14328)
@@ -0,0 +1,10 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class FloatExpressionTests : InterpreterTest
+    {
+
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/IntegerExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/IntegerExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/IntegerExpressionTests.cs	(revision 14328)
@@ -0,0 +1,34 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class IntegerExpressionTests : InterpreterTest
+    {
+        [TestMethod]
+        public void TestAdd()
+        {
+            interpreter.Interpret("( 5 5 INTEGER.+ )");
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+
+        [TestMethod]
+        public void TestSubtract()
+        {
+            interpreter.Interpret("( 10 5 INTEGER.- )");
+
+            Assert.AreEqual(5, interpreter.IntegerStack.Top);
+            Assert.IsTrue(interpreter.CodeStack.IsEmpty);
+            Assert.IsTrue(interpreter.ExecStack.IsEmpty);
+            Assert.IsTrue(interpreter.NameStack.IsEmpty);
+            Assert.IsTrue(interpreter.BooleanStack.IsEmpty);
+            Assert.IsTrue(interpreter.FloatStack.IsEmpty);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/NameExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/NameExpressionTests.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Expressions/NameExpressionTests.cs	(revision 14328)
@@ -0,0 +1,10 @@
+﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Expressions
+{
+    [TestClass]
+    public class NameExpressionTests : InterpreterTest
+    {
+
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 14327)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 14328)
@@ -9,5 +9,5 @@
     <RootNamespace>HeuristicLab.Tests</RootNamespace>
     <AssemblyName>HeuristicLab.Tests</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -17,4 +17,5 @@
     <IsCodedUITest>False</IsCodedUITest>
     <TestProjectType>UnitTest</TestProjectType>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -34,4 +35,5 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <LangVersion>5</LangVersion>
   </PropertyGroup>
   <ItemGroup>
@@ -51,12 +53,13 @@
   </Choose>
   <ItemGroup>
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\MixedExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\NameExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\FloatExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\BooleanExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\ExecExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\CodeExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\Expressions\IntegerExpressionTests.cs" />
-    <Compile Include="HeuristicLab.Algorithms.PushGP\InterpreterTest.cs" />
+    <Compile Include="Expressions\ExampleTests.cs" />
+    <Compile Include="Expressions\NameExpressionTests.cs" />
+    <Compile Include="Expressions\FloatExpressionTests.cs" />
+    <Compile Include="Expressions\BooleanExpressionTests.cs" />
+    <Compile Include="Expressions\ExecExpressionTests.cs" />
+    <Compile Include="Expressions\CodeExpressionTests.cs" />
+    <Compile Include="Expressions\IntegerExpressionTests.cs" />
+    <Compile Include="InterpreterTest.cs" />
+    <Compile Include="Problems\Checksum.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
@@ -68,5 +71,5 @@
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="HeuristicLab.Algorithms.PushGP\Problems\" />
+    <Folder Include="Problems\Data\" />
   </ItemGroup>
   <Choose>
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/InterpreterTest.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/InterpreterTest.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/InterpreterTest.cs	(revision 14328)
@@ -0,0 +1,16 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests
+{
+    public class InterpreterTest
+    {
+        protected PushGPInterpreter interpreter;
+
+        [TestInitialize]
+        public void BeforeTest()
+        {
+            interpreter = new PushGPInterpreter();
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Problems/Checksum.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Problems/Checksum.cs	(revision 14328)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Problems/Checksum.cs	(revision 14328)
@@ -0,0 +1,6 @@
+﻿namespace HeuristicLab.Tests.Problems
+{
+    public class Checksum
+    {
+    }
+}
