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 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/HeuristicLab.Algorithms.PushGP.Cli.csproj	(revision 14392)
@@ -36,4 +36,12 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.Cli/Program.cs	(revision 14392)
@@ -22,11 +22,7 @@
         static async Task Stepwise()
         {
-            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();
 
-            interpreter.IntegerStack.Push(5);
-            interpreter.InterpretAsync(program, true).Wait();
+            interpreter.InterpretAsync("( 0 2 CODE.QUOTE ( 1 INTEGER.+ 0 3 CODE.QUOTE ( 1 INTEGER.+ INTEGER.* ) CODE.DO*RANGE INTEGER.+ ) CODE.DO*RANGE )", true).Wait();
 
             while (!interpreter.IsCompleted)
@@ -72,6 +68,9 @@
             var sw = new Stopwatch();
 
+            var interpreter = new PushGPInterpreter();
+            var generator = new CodeGenerator(interpreter);
+
             sw.Start();
-            var expressions = CodeGenerator.RandomCode(3000000);
+            var expressions = generator.RandomCode(3000000);
             sw.Stop();
 
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.sln
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.sln	(revision 14391)
+++ 	(revision )
@@ -1,34 +1,0 @@
-﻿
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.PushGP", "HeuristicLab.Algorithms.PushGP\HeuristicLab.Algorithms.PushGP.csproj", "{368D1303-470C-4F31-91F2-0FAD379DAA45}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.PushGP.Cli", "HeuristicLab.Algorithms.PushGP.Cli\HeuristicLab.Algorithms.PushGP.Cli.csproj", "{293FD718-99E9-4F6A-A0EC-343C92D0B03E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Tests", "HeuristicLab.Tests\HeuristicLab.Tests.csproj", "{117B7D68-ED7D-4350-996B-9CA15259E107}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Release|Any CPU.Build.0 = Release|Any CPU
-		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{117B7D68-ED7D-4350-996B-9CA15259E107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{117B7D68-ED7D-4350-996B-9CA15259E107}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{117B7D68-ED7D-4350-996B-9CA15259E107}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{117B7D68-ED7D-4350-996B-9CA15259E107}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/ExpressionTable.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/ExpressionTable.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/ExpressionTable.cs	(revision 14392)
@@ -0,0 +1,136 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+
+namespace HeuristicLab.Algorithms.PushGP
+{
+    public static class ExpressionTable
+    {
+        private static Dictionary<string, Expression> expressionTable;
+        private static Dictionary<string, Func<Expression>> statefullExpressionFactory;
+
+        public static int Count;
+
+        static ExpressionTable()
+        {
+            expressionTable = GetExperssionTable(e => e.ToString());
+            statefullExpressionFactory = GetStatefullExpressionFactory(e => e.ToString());
+
+            Count = expressionTable.Count + statefullExpressionFactory.Count;
+        }
+
+        private static Dictionary<string, Expression> GetExperssionTable(Func<Expression, string> keyFunc)
+        {
+            return GetExperssionTable(e => new KeyValuePair<string, Expression>(keyFunc(e), e));
+        }
+
+        private static Dictionary<string, Expression> GetExperssionTable(Func<Expression, KeyValuePair<string, Expression>> pairFunc)
+        {
+            var dictionary = new Dictionary<string, Expression>();
+            var expressionTypes = GetExpressionTypes(filterStatefull: false);
+
+            foreach (var type in expressionTypes)
+            {
+                var expression = (Expression)Activator.CreateInstance(type);
+                var pair = pairFunc(expression);
+
+                dictionary.Add(pair.Key, pair.Value);
+            }
+
+            return dictionary;
+        }
+
+        private static Dictionary<string, Func<Expression>> GetStatefullExpressionFactory(Func<Expression, string> keyFunc)
+        {
+            var dictionary = new Dictionary<string, Func<Expression>>();
+            var expressionTypes = GetExpressionTypes(filterStatefull: true);
+
+            foreach (var type in expressionTypes)
+            {
+                // Make a NewExpression that calls the ctor
+                var newExp = System.Linq.Expressions.Expression.New(type);
+
+                // Create a lambda with the New expression as body
+                var creator = System.Linq.Expressions.Expression.Lambda<Func<Expression>>(newExp).Compile();
+
+                var expression = creator();
+                var key = keyFunc(expression);
+
+                dictionary.Add(key, creator);
+            }
+
+            return dictionary;
+        }
+
+        private static IEnumerable<Type> GetExpressionTypes(bool filterStatefull)
+        {
+            return from domainAssembly in AppDomain.CurrentDomain.GetAssemblies()
+                   from assemblyType in domainAssembly.GetTypes()
+                   let type = typeof(Expression)
+                   where !assemblyType.IsAbstract &&
+                         assemblyType.IsSubclassOf(type) &&
+                         Attribute.IsDefined(assemblyType, typeof(StatefullExpressionAttribute)) == filterStatefull &&
+                         assemblyType.GetConstructor(Type.EmptyTypes) != null
+                   select assemblyType;
+        }
+
+        public static int StatelessCount { get { return expressionTable.Count; } }
+
+        public static int StatefullCount { get { return statefullExpressionFactory.Count; } }
+
+        public static Expression GetExpression(int index)
+        {
+            return index < StatelessCount
+                ? expressionTable.ElementAt(index).Value
+                : statefullExpressionFactory.ElementAt(index - StatelessCount).Value();
+        }
+
+        public static Expression GetExpression(string symbol)
+        {
+            Expression expression;
+            if (TryGetStatelessExpression(symbol, out expression) ||
+                TryGetStatefullExpression(symbol, out expression))
+            {
+                return expression;
+            }
+
+            return null;
+        }
+
+        public static Expression GetStatelessExpression(string symbol)
+        {
+            Expression expression;
+            if (expressionTable.TryGetValue(symbol, out expression)) return expression;
+            else throw new NotSupportedException("Expression not supported: " + symbol);
+        }
+
+        public static bool TryGetStatelessExpression(string name, out Expression expression)
+        {
+            return expressionTable.TryGetValue(name, out expression);
+        }
+
+        public static Expression GetStatefullExpression(string symbol)
+        {
+            Func<Expression> creator;
+            if (statefullExpressionFactory.TryGetValue(symbol, out creator)) return creator();
+            else throw new NotSupportedException("Expression not supported: " + symbol);
+        }
+
+        public static bool TryGetStatefullExpression(string name, out Expression expression)
+        {
+            Func<Expression> creator;
+            if (statefullExpressionFactory.TryGetValue(name, out creator))
+            {
+                expression = creator();
+                return true;
+            }
+            else
+            {
+                expression = default(Expression);
+                return false;
+            }
+
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/BooleanExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/BooleanExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/BooleanExpressions.cs	(revision 14392)
@@ -0,0 +1,79 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes the logical AND of the top two BOOLEANs.
+    /// </summary>
+    public class BooleanAndExpression : PushResultExpression<bool>
+    {
+        public BooleanAndExpression() : base("BOOLEAN.AND") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, 2, values => values[0] && values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the logical OR of the top two BOOLEANs.
+    /// </summary>
+    public class BooleanOrExpression : PushResultExpression<bool>
+    {
+        public BooleanOrExpression() : base("BOOLEAN.OR") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, 2, values => values[0] || values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the logical NOT of the top BOOLEAN.
+    /// </summary>
+    public class BooleanNotExpression : PushResultExpression<bool>
+    {
+        public BooleanNotExpression() : base("BOOLEAN.NOT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, 1, values => !values[0]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes FALSE if the top FLOAT is 0.0, or TRUE otherwise.
+    /// </summary>
+    public class BooleanFromFloatExpression : Expression
+    {
+        public BooleanFromFloatExpression() : base("BOOLEAN.FROMFLOAT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.FloatStack.Count == 0)
+                return;
+
+            var value = interpreter.FloatStack.Pop() != 0.0;
+
+            interpreter.BooleanStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes FALSE if the top INTEGER is 0, or TRUE otherwise.
+    /// </summary>
+    public class BooleanFromIntegerExpression : Expression
+    {
+        public BooleanFromIntegerExpression() : base("BOOLEAN.FROMINTEGER") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0)
+                return;
+
+            var value = interpreter.IntegerStack.Pop() != 0;
+
+            interpreter.BooleanStack.Push(value);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/CodeExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/CodeExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/CodeExpressions.cs	(revision 14392)
@@ -0,0 +1,854 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+
+/// <summary>
+/// For explicit code manipulation and execution. May also be used as a general list data type.
+/// This type must always be present, as the top level interpreter will push any code to be executed on the
+/// CODE stack prior to execution. However, one may turn off all CODE instructions if code manipulation is not needed.
+/// </summary>
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Recursively invokes the interpreter on the program on top of the CODE stack. After evaluation the
+    /// CODE stack is popped; normally this pops the program that was just executed, but if the expression itself
+    /// manipulates the stack then this final pop may end up popping something else.
+    /// </summary>
+    public class CodeDoExpression : Expression
+    {
+        public CodeDoExpression() : base("CODE.DO") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            interpreter.ExecStack.Push(interpreter.CodeStack.Top);
+            interpreter.CodeStack.Pop();
+        }
+    }
+
+    /// <summary>
+    /// Like CODE.DO but pops the stack before, rather than after, the recursive execution
+    /// </summary>
+    public class CodeDoXExpression : Expression
+    {
+        public CodeDoXExpression() : base("CODE.DO*") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            var expression = interpreter.CodeStack.Pop();
+            interpreter.ExecStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// Does nothing.
+    /// </summary>
+    public class CodeNoopExpression : Expression
+    {
+        public CodeNoopExpression() : base("CODE.NOOP") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // nothing to do
+        }
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    public class CodeQuoteExpression : Expression
+    {
+        public CodeQuoteExpression() : base("CODE.QUOTE") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.ExecStack.Count == 0)
+                return;
+
+            var expression = interpreter.ExecStack.Pop();
+            interpreter.CodeStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// If the top item of the BOOLEAN stack is TRUE this recursively executes the second item of the CODE stack;
+    /// otherwise it recursively executes the first item of the CODE stack. Either way both elements of the CODE stack
+    /// (and the BOOLEAN value upon which the decision was made) are popped.
+    /// </summary>
+    public class CodeIfExpression : Expression
+    {
+        public CodeIfExpression() : base("CODE.IF") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.BooleanStack.Count == 0 ||
+                interpreter.CodeStack.Count < 2)
+                return;
+
+            var condition = interpreter.BooleanStack.Pop();
+            var items = interpreter.CodeStack.Pop(2);
+
+            interpreter.ExecStack.Push(condition
+                ? items[0]
+                : items[1]);
+        }
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    public class CodeAppendExpression : Expression
+    {
+        public CodeAppendExpression() : base("CODE.APPEND") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2)
+                return;
+
+            var first = interpreter.CodeStack.Pop();
+            var second = interpreter.CodeStack.Top;
+
+            var isFirstList = first.GetType() == typeof(ExecExpandExpression);
+            var isSecondList = second.GetType() == typeof(ExecExpandExpression);
+
+            List<Expression> result = null;
+
+            if (isFirstList)
+            {
+                var list1 = first as ExecExpandExpression;
+
+                if (isSecondList)
+                {
+                    var list2 = second as ExecExpandExpression;
+
+                    result = new List<Expression>(list2.Expressions.Length + list1.Expressions.Length);
+                    result.AddRange(list2.Expressions);
+                    result.AddRange(list1.Expressions);
+                }
+                else
+                {
+                    result = new List<Expression>(list1.Expressions.Length + 1);
+                    result.Add(second);
+                    result.AddRange(list1.Expressions);
+                }
+            }
+            else if (isSecondList)
+            {
+                var list2 = second as ExecExpandExpression;
+
+                result = new List<Expression>(list2.Expressions.Length + 1);
+                result.Add(first);
+                result.AddRange(list2.Expressions);
+            }
+            else
+            {
+                result = new List<Expression> { second, first };
+            }
+
+            interpreter.CodeStack.SetTop(ExecExpandExpression.TryCreate(result.ToArray(), interpreter.Configuration));
+        }
+    }
+
+    /// <summary>
+    /// 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).
+    /// </summary>
+    public class CodeAtomExpression : Expression
+    {
+        public CodeAtomExpression() : base("CODE.ATOM") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            var expression = interpreter.CodeStack.Pop();
+            var isExpandExpression = expression.GetType() != typeof(ExecExpandExpression);
+
+            interpreter.BooleanStack.Push(isExpandExpression);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the first item of the list on top of the CODE stack. For example, if the top piece of code is "( A B )"
+    /// then this pushes "A" (after popping the argument). If the code on top of the stack is not a list then this has no effect.
+    /// The name derives from the similar Lisp function; a more generic name would be "FIRST".
+    /// </summary>
+    public class CodeCarExpression : Expression
+    {
+        public CodeCarExpression() : base("CODE.CAR") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0 ||
+                interpreter.CodeStack.Top.GetType() != typeof(ExecExpandExpression))
+                return;
+
+            var expression = interpreter.CodeStack.Pop() as ExecExpandExpression;
+            if (expression.Expressions.Length > 0)
+            {
+                var first = expression.Expressions[expression.Expressions.Length - 1];
+
+                interpreter.CodeStack.Push(first);
+            }
+
+        }
+    }
+
+    /// <summary>
+    /// Pushes a version of the list from the top of the CODE stack without its first element.
+    /// For example, if the top piece of code is "( A B )" then this pushes "( B )" (after popping the argument).
+    /// If the code on top of the stack is not a list then this pushes the empty list ("( )"). The name derives from
+    /// the similar Lisp function; a more generic name would be "REST".
+    /// </summary>
+    public class CodeCdrExpression : Expression
+    {
+        public CodeCdrExpression() : base("CODE.CDR") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            Expression expandExpression = null;
+            var top = interpreter.CodeStack.Top;
+
+            if (top.GetType() == typeof(ExecExpandExpression))
+            {
+                var expression = top as ExecExpandExpression;
+
+                if (expression.Expressions.Length == 0)
+                {
+                    return;
+                }
+                else
+                {
+                    var length = expression.Expressions.Length - 1;
+                    var newExpressions = new Expression[length];
+
+                    Array.Copy(expression.Expressions, 0, newExpressions, 0, length);
+
+                    expandExpression = new ExecExpandExpression(newExpressions);
+                }
+            }
+            else
+            {
+                expandExpression = ExecExpandExpression.Empty;
+            }
+
+            interpreter.CodeStack.SetTop(expandExpression);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the result of "consing" (in the Lisp sense) the second stack item onto the first stack item
+    /// (which is coerced to a list if necessary). For example, if the top piece of code is "( A B )" and the
+    /// second piece of code is "X" then this pushes "( X A B )" (after popping the argument).
+    /// </summary>
+    public class CodeConsExpression : Expression
+    {
+        public CodeConsExpression() : base("CODE.CONS") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2 ||
+                interpreter.CodeStack[interpreter.CodeStack.Count - 1].GetType() != typeof(ExecExpandExpression))
+                return;
+
+            var first = interpreter.CodeStack.Pop() as ExecExpandExpression;
+            var expressions = new Expression[first.Expressions.Length + 1];
+
+            expressions[first.Expressions.Length] = interpreter.CodeStack.Top;
+            Array.Copy(first.Expressions, 0, expressions, 0, first.Expressions.Length);
+
+            interpreter.CodeStack.SetTop(ExecExpandExpression.TryCreate(expressions, interpreter.Configuration));
+        }
+    }
+
+    /// <summary>
+    /// Pushes the "container" of the second CODE stack item within the first CODE stack item onto the CODE stack.
+    /// If second item contains the first anywhere (i.e. in any nested list) then the container is the smallest sub-list
+    /// that contains but is not equal to the first instance. For example, if the top piece of code is "( B ( C ( A ) ) ( D ( A ) ) )"
+    /// and the second piece of code is "( A )" then this pushes ( C ( A ) ). Pushes an empty list if there is no such container.
+    /// </summary>
+    public class CodeContainerExpression : Expression
+    {
+        public CodeContainerExpression() : base("CODE.CONTAINER") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2 ||
+                interpreter.CodeStack[interpreter.CodeStack.Count - 2].GetType() != typeof(ExecExpandExpression))
+            {
+                return;
+            }
+
+            var target = interpreter.CodeStack.Pop();
+            var source = interpreter.CodeStack.Top;
+
+            var container = this.GetContainer(null, source as ExecExpandExpression, target);
+            var result = container == null
+                ? ExecExpandExpression.Empty
+                : container;
+
+            interpreter.CodeStack.SetTop(result);
+        }
+
+        private ExecExpandExpression GetContainer(ExecExpandExpression parent, ExecExpandExpression current, Expression target)
+        {
+            var subContainer = current.Expressions
+                    .Where(e => e.GetType() == typeof(ExecExpandExpression))
+                    .Select(e => GetContainer(current, e as ExecExpandExpression, target))
+                    .Where(e => e != null);
+
+            if (subContainer.Any())
+            {
+                return subContainer.OrderBy(c => c.Expressions.Length).LastOrDefault();
+            }
+            else return current.Expressions.Contains(target)
+                ? current
+                : null;
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE on the BOOLEAN stack if the second CODE stack item contains the first CODE stack
+    /// item anywhere (e.g. in a sub-list).
+    /// </summary>
+    public class CodeContainsExpression : Expression
+    {
+        public CodeContainsExpression() : base("CODE.CONTAINS") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2 ||
+                interpreter.CodeStack[interpreter.CodeStack.Count - 2].GetType() != typeof(ExecExpandExpression))
+                return;
+
+            var values = interpreter.CodeStack.Pop(2);
+            var second = values[0] as ExecExpandExpression;
+
+            interpreter.BooleanStack.Push(second.Expressions.Contains(values[1]));
+        }
+    }
+
+    /// <summary>
+    /// 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).
+    /// </summary>
+    public class CodeDefinitionExpression : Expression
+    {
+        public CodeDefinitionExpression() : base("CODE.DEFINITION") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.NameStack.Count == 0 ||
+                !interpreter.CustomExpressions.ContainsKey(interpreter.NameStack.Top))
+                return;
+
+            var name = interpreter.NameStack.Pop();
+            var definition = interpreter.CustomExpressions[name];
+
+            interpreter.CodeStack.Push(definition);
+        }
+    }
+
+    /// <summary>
+    /// 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:
+    /// <list type="bullet">
+    /// <item><description>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.
+    /// </item>
+    /// <item><description>Initialize the result to zero.
+    /// </item>
+    /// <item><description>For each unique item increment the result by the difference between the number of occurrences of the item in
+    /// the two pieces of code.
+    /// </item>
+    /// <item><description>Push the result.
+    /// </item>
+    /// </list>
+    /// </summary>
+    public class CodeDiscrepancyExpression : Expression
+    {
+        public CodeDiscrepancyExpression() : base("CODE.DISCREPANCY") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2)
+                return;
+
+            var expressions = interpreter.CodeStack.Pop(2);
+            var firstItems = new Dictionary<int, int>();
+            var secondItems = new Dictionary<int, int>();
+
+            DetermineUniqueItems(expressions[0], secondItems);
+            DetermineUniqueItems(expressions[1], firstItems);
+
+            var discrepancy = this.GetDiscrepancy(firstItems, secondItems);
+
+            interpreter.IntegerStack.Push(discrepancy);
+        }
+
+        private int GetDiscrepancy(IDictionary<int, int> first, IDictionary<int, int> second)
+        {
+            var discrepancy = 0;
+            var keys = first.Keys.Concat(second.Keys).Distinct();
+
+            foreach (var key in keys)
+            {
+                if (first.ContainsKey(key) && second.ContainsKey(key))
+                {
+                    discrepancy += Math.Abs(first[key] - second[key]);
+                }
+                else if (first.ContainsKey(key))
+                {
+                    discrepancy += first[key];
+                }
+                else
+                {
+                    discrepancy += second[key];
+                }
+            }
+
+            return discrepancy;
+        }
+
+        private void DetermineUniqueItems(Expression source, IDictionary<int, int> items)
+        {
+            if (source.GetType() == typeof(ExecExpandExpression))
+            {
+                var list = source as ExecExpandExpression;
+
+                foreach (var e in list.Expressions)
+                {
+                    var id = e.GetHashCode();
+                    if (!items.ContainsKey(id))
+                    {
+                        items.Add(id, 1);
+                    }
+                    else
+                    {
+                        items[id]++;
+                    }
+                }
+            }
+            else
+            {
+                items.Add(source.GetHashCode(), 1);
+            }
+        }
+    }
+
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    public class CodeExtractExpression : Expression
+    {
+        public CodeExtractExpression() : base("CODE.EXTRACT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0 ||
+                interpreter.CodeStack.Count == 0 ||
+                interpreter.CodeStack.Top.GetType() != typeof(ExecExpandExpression))
+            {
+                return;
+            }
+
+            var expression = interpreter.CodeStack.Top as ExecExpandExpression;
+            var index = (int)Math.Abs(interpreter.IntegerStack.Pop() % expression.TotalCount);
+            var result = expression.GetFromTree(index);
+
+            interpreter.CodeStack.SetTop(result);
+        }
+    }
+
+    /// <summary>
+    /// Pops the BOOLEAN stack and pushes the popped item (TRUE or FALSE) onto the CODE stack.
+    /// </summary>
+    public class CodeFromBooleanExpression : Expression
+    {
+        public CodeFromBooleanExpression() : base("CODE.FROMBOOLEAN") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.BooleanStack.Count == 0)
+                return;
+
+            var value = interpreter.BooleanStack.Pop();
+            var expression = new BooleanPushExpression(value);
+
+            interpreter.CodeStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// Pops the FLOAT stack and pushes the popped item onto the CODE stack.
+    /// </summary>
+    public class CodeFromFloatExpression : Expression
+    {
+        public CodeFromFloatExpression() : base("CODE.FROMFLOAT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.FloatStack.Count == 0)
+                return;
+
+            var value = interpreter.FloatStack.Pop();
+            var expression = new FloatPushExpression(value);
+
+            interpreter.CodeStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// Pops the INTEGER stack and pushes the popped integer onto the CODE stack.
+    /// </summary>
+    public class CodeFromIntegerExpression : Expression
+    {
+        public CodeFromIntegerExpression() : base("CODE.FROMINTEGER") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0)
+                return;
+
+            var value = interpreter.IntegerStack.Pop();
+            var expression = new IntegerPushExpression(value);
+
+            interpreter.CodeStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// Pops the NAME stack and pushes the popped item onto the CODE stack.
+    /// </summary>
+    public class CodeFromNameExpression : Expression
+    {
+        public CodeFromNameExpression() : base("CODE.FROMNAME") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.NameStack.Count == 0)
+                return;
+
+            var value = interpreter.NameStack.Pop();
+            var expression = new NameDefineXExecExpression(value);
+
+            interpreter.CodeStack.Push(expression);
+        }
+    }
+
+    /// <summary>
+    /// 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).
+    /// </summary>
+    public class CodeInsertExpression : Expression
+    {
+        public CodeInsertExpression() : base("CODE.INSERT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0 ||
+                interpreter.CodeStack.Count < 2 ||
+                interpreter.CodeStack.Top.GetType() != typeof(ExecExpandExpression))
+                return;
+
+            var source = interpreter.CodeStack[interpreter.CodeStack.Count - 2];
+            var target = interpreter.CodeStack.Pop() as ExecExpandExpression;
+            var index = interpreter.IntegerStack.Pop();
+            Expression result = null;
+
+            if (target.Expressions.Length > 0)
+            {
+                index = target.Expressions.Length - 1 - (Math.Abs(index % target.Expressions.Length));
+                target.Expressions[index] = source;
+                result = target;
+            }
+            else
+            {
+                result = new ExecExpandExpression(new[] { source });
+            }
+
+            interpreter.CodeStack.SetTop(result);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the length of the top item on the CODE stack onto the INTEGER stack.
+    /// If the top item is not a list then this pushes a 1. If the top item is a list then this pushes the
+    /// number of items in the top level of the list; that is, nested lists contribute only 1 to this count, no
+    /// matter what they contain.
+    /// </summary>
+    public class CodeLengthExpression : Expression
+    {
+        public CodeLengthExpression() : base("CODE.LENGTH") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            var expression = interpreter.CodeStack.Pop();
+            var count = 1;
+
+            if (expression.GetType() == typeof(ExecExpandExpression))
+            {
+                count = (expression as ExecExpandExpression).Expressions.Length;
+            }
+
+            interpreter.IntegerStack.Push(count);
+        }
+    }
+
+    /// <summary>
+    /// Pushes a list of the top two items of the CODE stack onto the CODE stack.
+    /// </summary>
+    public class CodeListExpression : Expression
+    {
+        public CodeListExpression() : base("CODE.LIST") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2)
+                return;
+
+            var first = interpreter.CodeStack.Pop();
+            var second = interpreter.CodeStack.Top;
+
+            var expandExpression = ExecExpandExpression.TryCreate(new[]
+            {
+                second,
+                first
+            }, interpreter.Configuration);
+
+            interpreter.CodeStack.SetTop(expandExpression);
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the second item of the CODE stack is a member of the first item
+    /// (which is coerced to a list if necessary). Pushes FALSE onto the BOOLEAN stack otherwise.
+    /// </summary>
+    public class CodeMemberExpression : Expression
+    {
+        public CodeMemberExpression() : base("CODE.MEMBER") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2)
+                return;
+
+            var expressions = interpreter.CodeStack.Pop(2);
+
+            var contains = expressions[1].GetType() == typeof(ExecExpandExpression)
+                ? (expressions[1] as ExecExpandExpression).Expressions.Contains(expressions[0])
+                : expressions[1].Equals(expressions[0]);
+
+            interpreter.BooleanStack.Push(contains);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the nth element of the expression on top of the CODE stack (which is coerced to a list first if necessary).
+    /// If the expression is an empty list then the result is an empty list. N is taken from the INTEGER stack and is taken
+    /// modulo the length of the expression into which it is indexing.
+    /// </summary>
+    public class CodeNthExpression : Expression
+    {
+        public CodeNthExpression() : base("CODE.NTH") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0 ||
+                interpreter.IntegerStack.Count == 0)
+                return;
+
+            var n = interpreter.IntegerStack.Pop();
+            var expression = interpreter.CodeStack.Top;
+
+            Expression nthExpression = null;
+
+            if (expression.GetType() == typeof(ExecExpandExpression))
+            {
+                var subExpressions = (expression as ExecExpandExpression).Expressions;
+
+                nthExpression = subExpressions.Length == 0
+                    ? ExecExpandExpression.Empty
+                    : subExpressions[subExpressions.Length - 1 - Math.Abs(n % subExpressions.Length)];
+            }
+            else
+            {
+                nthExpression = expression;
+            }
+
+            interpreter.CodeStack.SetTop(nthExpression);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the nth "CDR" (in the Lisp sense) of the expression on top of the CODE stack (which is coerced to a list
+    /// first if necessary). If the expression is an empty list then the result is an empty list. N is taken from the INTEGER
+    /// stack and is taken modulo the length of the expression into which it is indexing. A "CDR" of a list is the list without
+    /// its first element.
+    /// </summary>
+    public class CodeNthCdrExpression : Expression
+    {
+        public CodeNthCdrExpression() : base("CODE.NTHCDR") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0 ||
+                interpreter.IntegerStack.Count == 0)
+                return;
+
+            var n = interpreter.IntegerStack.Pop();
+            var expression = interpreter.CodeStack.Top;
+
+            Expression nthExpression = null;
+
+            if (expression.GetType() == typeof(ExecExpandExpression))
+            {
+                var subExpressions = (expression as ExecExpandExpression).Expressions;
+
+                nthExpression = subExpressions.Length < 2
+                    ? ExecExpandExpression.Empty
+                    : subExpressions[subExpressions.Length - 2 - Math.Abs(n % (subExpressions.Length - 1))];
+            }
+            else
+            {
+                nthExpression = expression;
+            }
+
+            interpreter.CodeStack.SetTop(nthExpression);
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the top item of the CODE stack is an empty list, or FALSE otherwise.
+    /// </summary>
+    public class CodeNullExpression : Expression
+    {
+        public CodeNullExpression() : base("CODE.NULL") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            var result = interpreter.CodeStack.Pop().Equals(ExecExpandExpression.Empty);
+
+            interpreter.BooleanStack.Push(result);
+        }
+    }
+
+    /// <summary>
+    /// 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>
+    public class CodePositionExpression : Expression
+    {
+        public CodePositionExpression() : base("CODE.POSITION") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 2)
+                return;
+
+            var expressions = interpreter.CodeStack.Pop(2);
+            var first = expressions[1];
+            var second = expressions[0];
+
+            var position = -1;
+            if (first.GetType() == typeof(ExecExpandExpression))
+            {
+                var list = first as ExecExpandExpression;
+                position = list.Expressions.Length - 1 - Array.FindIndex(list.Expressions, e => e.Equals(second));
+            }
+            else if (first.Equals(second))
+            {
+                position = 0;
+            }
+
+            interpreter.IntegerStack.Push(position);
+        }
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    public class CodeSizeExpression : Expression
+    {
+        public CodeSizeExpression() : base("CODE.SIZE") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count == 0)
+                return;
+
+            var expression = interpreter.CodeStack.Pop();
+            var points = expression.GetType() == typeof(ExecExpandExpression)
+                ? (expression as ExecExpandExpression).Expressions.Length
+                : 1;
+
+            interpreter.IntegerStack.Push(points);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the result of substituting the third item on the code stack for the second item in the first item.
+    /// As of this writing this is implemented only in the Lisp implementation, within which it relies on the Lisp "subst"
+    /// function. As such, there are several problematic possibilities; for example "dotted-lists" can result in certain
+    /// cases with empty-list arguments. If any of these problematic possibilities occurs the stack is left unchanged.
+    /// </summary>
+    public class CodeSubstitutionExpression : Expression
+    {
+        public CodeSubstitutionExpression() : base("CODE.SUBST") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.CodeStack.Count < 3 ||
+                interpreter.CodeStack.Top.GetType() != typeof(ExecExpandExpression))
+                return;
+
+            var expressions = interpreter.CodeStack.Pop(2);
+            var third = interpreter.CodeStack.Top;
+            var second = expressions[0];
+            var first = expressions[1] as ExecExpandExpression;
+
+
+            for (var i = 0; i < first.Expressions.Length; i++)
+            {
+                if (first.Expressions[i].Equals(third))
+                {
+                    first.Expressions[i] = second;
+                }
+            }
+
+            interpreter.CodeStack.SetTop(first);
+        }
+    }
+
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DefineExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DefineExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DefineExpressions.cs	(revision 14392)
@@ -0,0 +1,128 @@
+﻿using System;
+using System.Collections.Generic;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Defines the name on top of the NAME stack as an instruction that will push the top item of the T stack onto the EXEC stack.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class DefineExpression<T> : Expression
+    {
+        public DefineExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        protected void Eval(IStack<T> stack, IStack<string> nameStack, IDictionary<string, Expression> customExpressions, Func<T, Expression> creator)
+        {
+            // not enough arguments on stack
+            if (nameStack.Count == 0 ||
+                stack.Count < 1)
+                return;
+
+            var name = nameStack.Pop();
+            var expression = creator(stack.Top);
+
+            if (customExpressions.ContainsKey(name))
+            {
+                customExpressions[name] = expression;
+            }
+            else
+            {
+                customExpressions.Add(name, expression);
+            }
+        }
+    }
+
+    public class CodeDefineExpression : DefineExpression<Expression>
+    {
+        public CodeDefineExpression() : base("CODE.DEFINE")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.Configuration.TopLevelPushCode &&
+                interpreter.CodeStack.Count < 2)
+                return;
+
+            this.Eval(
+                interpreter.CodeStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new ExecPushExpression(v));
+
+            interpreter.CodeStack.Pop();
+        }
+    }
+
+    public class ExecDefineExpression : DefineExpression<Expression>
+    {
+        public ExecDefineExpression() : base("EXEC.DEFINE")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.ExecStack.Count < 2)
+                return;
+
+            this.Eval(
+                interpreter.ExecStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new ExecPushExpression(v));
+
+            interpreter.ExecStack.Pop();
+        }
+    }
+
+    public class FloatDefineExpression : DefineExpression<double>
+    {
+        public FloatDefineExpression() : base("FLOAT.DEFINE")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new FloatPushExpression(v));
+        }
+    }
+
+    public class IntegerDefineExpression : DefineExpression<long>
+    {
+        public IntegerDefineExpression() : base("INTEGER.DEFINE")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.IntegerStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new IntegerPushExpression(v));
+        }
+    }
+
+    public class BooleanDefineExpression : DefineExpression<bool>
+    {
+        public BooleanDefineExpression() : base("BOOLENA.DEFINE")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.BooleanStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new BooleanPushExpression(v));
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoCountExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoCountExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoCountExpressions.cs	(revision 14392)
@@ -0,0 +1,66 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class DoCountExpression : LoopExpression
+    {
+        public DoCountExpression(string stringRepresentation) : base(stringRepresentation) { }
+
+        protected override bool HasInsufficientArguments(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            return interpreter.IntegerStack.Count < 1 ||
+                   sourceStack.Count == 0 ||
+                   interpreter.IntegerStack.Top <= 0;
+        }
+
+        protected override void InitState(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            this.body = sourceStack.Pop();
+            this.destinationIndex = interpreter.IntegerStack.Top;
+            this.currentIndex = 1;
+            this.incrementor = 1;
+
+            interpreter.IntegerStack.SetTop(0);
+        }
+    }
+
+    /// <summary>
+    /// 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:
+    /// ( 0 '1 - IntegerArg>' CODE.QUOTE 'CodeArg' CODE.DO*RANGE )
+    /// </summary>
+    [StatefullExpression]
+    public class CodeDoCountExpression : DoCountExpression
+    {
+        public CodeDoCountExpression() : base("CODE.DO*COUNT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.CodeStack);
+        }
+    }
+
+    /// <summary>
+    /// 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:
+    /// ( 0 '1 - IntegerArg' EXEC.DO* RANGE'ExecArg' )
+    /// </summary>
+    [StatefullExpression]
+    public class ExecDoCountExpression : DoCountExpression
+    {
+        public ExecDoCountExpression() : base("EXEC.DO*COUNT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.ExecStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoRangeExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoRangeExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoRangeExpressions.cs	(revision 14392)
@@ -0,0 +1,75 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class DoRangeExpression : LoopExpression
+    {
+        public DoRangeExpression(string stringRepresentation) : base(stringRepresentation) { }
+
+        protected override bool HasInsufficientArguments(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            return interpreter.IntegerStack.Count < 2 ||
+                   sourceStack.Count == 0 ||
+                   interpreter.IntegerStack.Top == interpreter.IntegerStack.ReverseElementAt(1);
+        }
+
+        protected override void InitState(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            this.body = sourceStack.Pop();
+            this.destinationIndex = interpreter.IntegerStack.Pop();
+            this.currentIndex = interpreter.IntegerStack.Top;
+            this.incrementor = this.destinationIndex < this.currentIndex ? -1 : 1;
+            this.currentIndex += this.incrementor;
+        }
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    [StatefullExpression]
+    public class CodeDoRangeExpression : DoRangeExpression
+    {
+        public CodeDoRangeExpression() : base("CODE.DO*RANGE") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.CodeStack);
+        }
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    [StatefullExpression]
+    public class ExecDoRangeExpression : DoRangeExpression
+    {
+        public ExecDoRangeExpression() : base("EXEC.DO*RANGE") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.ExecStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoTimesExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoTimesExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DoTimesExpressions.cs	(revision 14392)
@@ -0,0 +1,69 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class DoTimesExpression : LoopExpression
+    {
+        public DoTimesExpression(string stringRepresentation) : base(stringRepresentation) { }
+
+        protected override bool HasInsufficientArguments(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            return interpreter.IntegerStack.Count < 1 ||
+                   sourceStack.Count == 0 ||
+                   interpreter.IntegerStack.Top <= 0;
+        }
+
+        protected override void InitState(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            this.body = sourceStack.Pop();
+            this.destinationIndex = interpreter.IntegerStack.Pop();
+            this.currentIndex = 1;
+            this.incrementor = 1;
+        }
+
+        protected override void PushIteration(IInterpreter interpreter)
+        {
+            interpreter.ExecStack.Push(this, this.body);
+        }
+
+        protected override void PushLastIteration(IInterpreter interpreter)
+        {
+            interpreter.ExecStack.Push(this.body);
+        }
+    }
+
+    /// <summary>
+    /// Like CODE.DO*COUNT but does not push the loop counter.
+    /// This should be implemented as a macro that expands into CODE.DO*RANGE, similarly to the implementation
+    /// of CODE.DO*COUNT, except that a call to INTEGER.POP should be tacked on to the front of the loop body code
+    /// in the call to CODE.DO*RANGE.
+    /// </summary>
+    [StatefullExpression]
+    public class CodeDoTimesExpression : DoTimesExpression
+    {
+        public CodeDoTimesExpression() : base("CODE.DO*TIMES") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.CodeStack);
+        }
+    }
+
+    /// <summary>
+    /// Like EXEC.DO*COUNT but does not push the loop counter. This should be implemented as a macro that expands into EXEC.DO*RANGE,
+    /// similarly to the implementation of EXEC.DO*COUNT, except that a call to INTEGER.POP should be tacked on to the front of the
+    /// loop body code in the call to EXEC.DO*RANGE. This call to INTEGER.POP will remove the loop counter, which will have been
+    /// pushed by EXEC.DO*RANGE, prior to the execution of the loop body.
+    /// </summary>
+    [StatefullExpression]
+    public class ExecDoTimesExpression : DoTimesExpression
+    {
+        public ExecDoTimesExpression() : base("EXEC.DO*TIMES") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter, interpreter.ExecStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DuplicateExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DuplicateExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/DuplicateExpressions.cs	(revision 14392)
@@ -0,0 +1,128 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// 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>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class DuplicateExpression<T> : Expression
+    {
+        public DuplicateExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack)
+        {
+            if (stack.Count == 0)
+                return;
+
+            var clone = this.Clone(stack.Top);
+
+            stack.Push(clone);
+        }
+
+        public abstract T Clone(T original);
+    }
+
+    public class IntegerDuplicateExpression : DuplicateExpression<long>
+    {
+        public IntegerDuplicateExpression() : base("INTEGER.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+
+        public override long Clone(long value)
+        {
+            return value;
+        }
+    }
+
+    public class FloatDuplicateExpression : DuplicateExpression<double>
+    {
+        public FloatDuplicateExpression() : base("FLOAT.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+
+        public override double Clone(double value)
+        {
+            return value;
+        }
+    }
+
+    public class BooleanDuplicateExpression : DuplicateExpression<bool>
+    {
+        public BooleanDuplicateExpression() : base("BOOLEAN.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+
+        public override bool Clone(bool value)
+        {
+            return value;
+        }
+    }
+
+    public class NameDuplicateExpression : DuplicateExpression<string>
+    {
+        public NameDuplicateExpression() : base("NAME.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+
+        public override string Clone(string value)
+        {
+            return string.Copy(value);
+        }
+    }
+
+    public class ExecDuplicateExpression : DuplicateExpression<Expression>
+    {
+        private readonly Cloner cloner = new Cloner();
+        public ExecDuplicateExpression() : base("EXEC.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+
+        public override Expression Clone(Expression original)
+        {
+            return cloner.Clone(original);
+        }
+    }
+
+    public class CodeDuplicateExpression : DuplicateExpression<Expression>
+    {
+        private readonly Cloner cloner = new Cloner();
+
+        public CodeDuplicateExpression() : base("CODE.DUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack);
+        }
+
+        public override Expression Clone(Expression original)
+        {
+            return cloner.Clone(original);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ERCExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ERCExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ERCExpressions.cs	(revision 14392)
@@ -0,0 +1,74 @@
+﻿using HeuristicLab.Algorithms.PushGP.Generators;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class ERCExpression<T> : Expression
+    {
+        private readonly T value;
+        public ERCExpression(string stringRepresentation, T value) : base(stringRepresentation)
+        {
+            this.value = value;
+        }
+
+        protected void Eval(IStack<T> stack)
+        {
+            stack.Push(this.value);
+        }
+    }
+
+    public class IntegerERCExpression : ERCExpression<long>
+    {
+        public IntegerERCExpression() : base("INTEGER.ERC", IntegerGenerator.RandomInteger())
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+    }
+
+    public class FloatERCExpression : ERCExpression<double>
+    {
+        protected bool isInitialized = false;
+
+        public FloatERCExpression() : base("FLOAT.ERC", FloatGenerator.RandomFloat())
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+    }
+
+    public class BooleanERCExpression : ERCExpression<bool>
+    {
+        public BooleanERCExpression() : base("BOOLEAN.ERC", BooleanGenerator.RandomBoolean())
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+    }
+
+    public class NameERCExpression : ERCExpression<string>
+    {
+        private static IRandom random = new FastRandom();
+
+        public NameERCExpression() : base("NAME.ERC", NameGenerator.RandomName())
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/EqualsExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/EqualsExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/EqualsExpressions.cs	(revision 14392)
@@ -0,0 +1,91 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the top two items are equal, or FALSE otherwise
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class EqualsExpression<T> : Expression
+    {
+        public EqualsExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack, IStack<bool> booleanStack)
+        {
+            if (stack.Count < 2)
+                return;
+
+            var items = stack.Pop(2);
+
+            booleanStack.Push(items[0].Equals(items[1]));
+        }
+    }
+
+    public class IntegerEqualsExpression : EqualsExpression<long>
+    {
+        public IntegerEqualsExpression() : base("INTEGER.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, interpreter.BooleanStack);
+        }
+    }
+
+    public class FloatEqualsExpression : EqualsExpression<double>
+    {
+        public FloatEqualsExpression() : base("FLOAT.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, interpreter.BooleanStack);
+        }
+    }
+
+    public class BooleanEqualsExpression : EqualsExpression<bool>
+    {
+        public BooleanEqualsExpression() : base("BOOLEAN.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, interpreter.BooleanStack);
+        }
+    }
+
+    public class NameEqualsExpression : EqualsExpression<string>
+    {
+        public NameEqualsExpression() : base("NAME.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack, interpreter.BooleanStack);
+        }
+    }
+
+    public class ExecEqualsExpression : EqualsExpression<Expression>
+    {
+        public ExecEqualsExpression() : base("EXEC.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack, interpreter.BooleanStack);
+        }
+    }
+
+    public class CodeEqualsExpression : EqualsExpression<Expression>
+    {
+        public CodeEqualsExpression() : base("CODE.=")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack, interpreter.BooleanStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExecExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExecExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExecExpressions.cs	(revision 14392)
@@ -0,0 +1,248 @@
+﻿using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public class ExecExpandExpression : Expression
+    {
+        private const string prefix = "( ";
+        private const string postfix = ")";
+        private const string delimiter = " ";
+
+        public readonly Expression[] Expressions;
+        private List<Expression> treeIndex;
+
+        public static readonly Expression Empty = new ExecExpandExpression(new Expression[0]);
+
+        public ExecExpandExpression(Expression[] expressions) : base()
+        {
+            this.Expressions = expressions;
+        }
+
+        // copy constructor
+        public ExecExpandExpression(ExecExpandExpression expression, Cloner cloner) : base(expression, cloner)
+        {
+            this.Expressions = expression.Expressions;
+            this.treeIndex = expression.treeIndex;
+        }
+
+        /// <summary>
+        /// Use this method to ensure the amount of expressions is not higher than the limit configured (Configuration.MaxPointsInProgram)
+        /// </summary>
+        /// <param name="expressions"></param>
+        /// <param name="config"></param>
+        /// <returns>Returns an ExpandExpression if maxPoints smaller or equal to Configuration.MaxProgramPoints and Noop otherwise</returns>
+        public static Expression TryCreate(Expression[] expressions, Configuration config)
+        {
+            if (config.MaxPointsInProgram > expressions.Length)
+            {
+                return new ExecExpandExpression(expressions);
+            }
+            else
+            {
+                return new CodeNoopExpression();
+            }
+        }
+
+        private string GetStringRepresentation()
+        {
+            if (this.StringRepresentation == null)
+            {
+                var sb = new StringBuilder();
+
+                sb.Append(prefix);
+
+                for (var i = this.Expressions.Length - 1; i >= 0; i--)
+                {
+                    sb.Append(this.Expressions[i].ToString() + delimiter);
+                }
+
+                sb.Append(postfix);
+
+                this.StringRepresentation = sb.ToString();
+            }
+
+            return this.StringRepresentation;
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new ExecExpandExpression(this, cloner);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (obj == null || obj.GetType() != typeof(ExecExpandExpression))
+            {
+                return false;
+            }
+
+            if (ReferenceEquals(this, obj))
+            {
+                return true;
+            }
+
+            var other = obj as ExecExpandExpression;
+
+            return this.Expressions.SequenceEqual(other.Expressions);
+        }
+
+        public override string ToString()
+        {
+            return this.GetStringRepresentation();
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            interpreter.ExecStack.Push(this.Expressions);
+        }
+
+        /// <summary>
+        /// Returns the amount of elements in the whole tree
+        /// </summary>
+        /// <returns></returns>
+        public int TotalCount
+        {
+            get
+            {
+                this.BuildIndexIfNecessary();
+
+                return this.treeIndex.Count;
+            }
+        }
+
+        /// <summary>
+        /// Returns the element with the given index whereby the tree is indexed in depth first manner
+        /// </summary>
+        /// <param name="index">The index of the required element</param>
+        /// <returns>The required element</returns>
+        public Expression GetFromTree(int index)
+        {
+            this.BuildIndexIfNecessary();
+
+            return this.treeIndex[index];
+        }
+
+        private void BuildIndexIfNecessary()
+        {
+            if (this.treeIndex != null)
+                return;
+
+            this.treeIndex = new List<Expression>(this.Expressions.Length) { this };
+
+            for (var i = this.Expressions.Length - 1; i >= 0; i--)
+            {
+                var subExpression = this.Expressions[i];
+
+                if (subExpression.GetType() == typeof(ExecExpandExpression))
+                {
+                    var list = subExpression as ExecExpandExpression;
+
+                    list.BuildIndexIfNecessary();
+                    this.treeIndex.AddRange(list.treeIndex);
+                }
+                else
+                {
+                    this.treeIndex.Add(subExpression);
+                }
+
+            }
+        }
+    }
+
+    /// <summary>
+    /// If the top item of the BOOLEAN stack is TRUE then this removes the second item on the EXEC stack, leaving the first item to be
+    /// executed. If it is false then it removes the first item, leaving the second to be executed. This is similar to CODE.IF except
+    /// that it operates on the EXEC stack. This acts as a NOOP unless there are at least two items on the EXEC stack and one item on
+    /// the BOOLEAN stack.
+    /// </summary>
+    public class ExecIfExpression : Expression
+    {
+        public ExecIfExpression() : base("EXEC.IF") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.BooleanStack.Count == 0 ||
+                interpreter.ExecStack.Count < 2)
+                return;
+
+            var condition = interpreter.BooleanStack.Pop();
+
+            if (condition)
+                interpreter.ExecStack.RemoveAt(interpreter.ExecStack.Count - 2);
+            else
+                interpreter.ExecStack.RemoveTop();
+        }
+    }
+
+    /// <summary>
+    /// The Push implementation of the "Y combinator". Inserts beneath the top item of the EXEC stack a new item of the form
+    /// "( EXEC.Y <TopItem> )".
+    /// </summary>
+    public class ExecYExpression : Expression
+    {
+        public ExecYExpression() : base("EXEC.Y")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            // not enough arguments on stack
+            if (interpreter.ExecStack.Count == 0)
+                return;
+
+            var expandExpression = ExecExpandExpression.TryCreate(new[]
+            {
+                interpreter.ExecStack.Top,
+                new ExecYExpression()
+            }, interpreter.Configuration);
+
+            interpreter.ExecStack.Insert(interpreter.ExecStack.Count - 1, expandExpression);
+        }
+    }
+
+    /// <summary>
+    /// The Push implementation of the "K combinator". Removes the second item on the EXEC stack.
+    /// </summary>
+    public class ExecKExpression : Expression
+    {
+        public ExecKExpression() : base("EXEC.K") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.ExecStack.Count < 2)
+                return;
+
+            var top = interpreter.ExecStack.Pop();
+            interpreter.ExecStack.SetTop(top);
+        }
+    }
+
+    /// <summary>
+    /// 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>
+    public class ExecSExpression : Expression
+    {
+        public ExecSExpression() : base("EXEC.S") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.ExecStack.Count < 3)
+                return;
+
+            var expressions = interpreter.ExecStack.Pop(2);
+            var a = expressions[1];
+            var b = expressions[0];
+            var c = interpreter.ExecStack.Top;
+
+            interpreter.ExecStack.SetTop(ExecExpandExpression.TryCreate(new[] { c, b }, interpreter.Configuration));
+            interpreter.ExecStack.Push(c, a);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Expression.cs	(revision 14392)
@@ -1,59 +1,50 @@
-﻿using System;
-using System.Collections.Generic;
-using HeuristicLab.Algorithms.PushGP.Interpreter;
-using HeuristicLab.Algorithms.PushGP.Stack;
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Common;
 
 namespace HeuristicLab.Algorithms.PushGP.Expressions
 {
-    public abstract class Expression
+    public abstract class Expression : DeepCloneable
     {
-        public abstract bool IsCodeOp { get; }
+        public Expression() { }
+
+        public Expression(string stringRepresenation) : this(stringRepresenation, stringRepresenation.GetHashCode())
+        { }
+
+        public Expression(string stringRepresenation, int id)
+        {
+            this.StringRepresentation = stringRepresenation;
+            this.Id = id;
+        }
+
+        // copy constructor
+        public Expression(Expression original, Cloner cloner) : base(original, cloner)
+        {
+            this.StringRepresentation = original.StringRepresentation;
+            this.Id = original.Id;
+        }
+
+        protected int Id { get; set; }
+        protected string StringRepresentation { get; set; }
+
         public abstract void Eval(IInterpreter interpreter);
 
-        public void PushResult<T>(IStack<T> stack, int count, Func<T[], T> templateFunc)
+        public override string ToString()
         {
-            PushResult(stack, stack, count, templateFunc);
+            return this.StringRepresentation;
         }
 
-        public void PushResult<T, R>(IStack<T> sourceStack, IStack<R> targetStack, int count, Func<T[], R> templateFunc)
+        public override bool Equals(object obj)
         {
-            // not enough arguments on stack
-            if (sourceStack.Count < count)
-                return;
-
-            var values = sourceStack.Pop(count);
-            var result = templateFunc(values);
-
-            targetStack.Push(result);
+            return obj != null && this.GetType() == obj.GetType();
         }
 
-        public void Duplicate<T>(IStack<T> stack)
+        public override int GetHashCode()
         {
-            // not enough arguments on stack
-            if (stack.Count == 0)
-                return;
-
-            var value = stack.Top;
-            stack.Push(value);
+            return this.Id;
         }
 
-        public static void Define<T>(IStack<T> stack, IStack<string> nameStack, IDictionary<string, Expression> customExpressions, Func<T, Expression> creator)
+        public override IDeepCloneable Clone(Cloner cloner)
         {
-            // not enough arguments on stack
-            if (nameStack.Count == 0 ||
-                stack.Count == 0)
-                return;
-
-            var name = nameStack.Pop();
-            var expression = creator(stack.Top);
-
-            if (customExpressions.ContainsKey(name))
-            {
-                customExpressions[name] = expression;
-            }
-            else
-            {
-                customExpressions.Add(name, expression);
-            }
+            return this;
         }
     }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExpressionFactory.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ExpressionFactory.cs	(revision 14391)
+++ 	(revision )
@@ -1,95 +1,0 @@
-﻿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: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FloatExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FloatExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FloatExpressions.cs	(revision 14392)
@@ -0,0 +1,215 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes the sum of the top two items.
+    /// </summary>
+    public class FloatAddExpression : PushResultExpression<double>
+    {
+        public FloatAddExpression() : base("FLOAT.+")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => values[0] + values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the difference of the top two items; that is, the second item minus the top item.
+    /// </summary>
+    public class FloatSubtractExpression : PushResultExpression<double>
+    {
+        public FloatSubtractExpression() : base("FLOAT.-")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => values[0] - values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the product of the top two items.
+    /// </summary>
+    public class FloatMultiplyExpression : PushResultExpression<double>
+    {
+        public FloatMultiplyExpression() : base("FLOAT.*")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => values[0] * values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the quotient of the top two items; that is, the second item divided by the top item.
+    /// If the top item is zero this acts as a NOOP.
+    /// </summary>
+    public class FloatDivideExpression : PushResultExpression<double>
+    {
+        public FloatDivideExpression() : base("FLOAT./")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => values[0] / values[1], 0);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the second stack item modulo the top stack item. If the top item is zero this acts as a NOOP.
+    /// The modulus is computed as the remainder of the quotient, where the quotient has first been truncated toward negative infinity.
+    /// (This is taken from the definition for the generic MOD function in Common Lisp, which is described
+    /// for example at http://www.lispworks.com/reference/HyperSpec/Body/f_mod_r.htm.)
+    /// </summary>
+    public class FloatModuloExpression : PushResultExpression<double>
+    {
+        public FloatModuloExpression() : base("FLOAT.%")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => values[0] % values[1], 0);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the minimum of the top two items.
+    /// </summary>
+    public class FloatMinExpression : PushResultExpression<double>
+    {
+        public FloatMinExpression() : base("FLOAT.MIN")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => Math.Min(values[0], values[1]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes the maximum of the top two items.
+    /// </summary>
+    public class FloatMaxExpression : PushResultExpression<double>
+    {
+        public FloatMaxExpression() : base("FLOAT.MAX")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, 2, values => Math.Max(values[0], values[1]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the second item is less than the top item, or FALSE otherwise.
+    /// </summary>
+    public class FloatSmallerThanExpression : PushResultExpression<double>
+    {
+        public FloatSmallerThanExpression() : base("FLOAT.<")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                interpreter.BooleanStack,
+                2,
+                values => values[0] < values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the second item is greater than the top item, or FALSE otherwise.
+    /// </summary>
+    public class FloatGreaterThanExpression : PushResultExpression<double>
+    {
+        public FloatGreaterThanExpression() : base("FLOAT.>")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                interpreter.BooleanStack,
+                2,
+                values => values[0] > values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the sine of the top item.
+    /// </summary>
+    public class FloatSineExpression : PushResultExpression<double>
+    {
+        public FloatSineExpression() : base("FLOAT.SIN")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                1,
+                values => Math.Sin(values[0]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes the cosine of the top item.
+    /// </summary>
+    public class FloatCosineExpression : PushResultExpression<double>
+    {
+        public FloatCosineExpression() : base("FLOAT.COS") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                1,
+                values => Math.Cos(values[0]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes 1 if the top BOOLEAN is TRUE, or 0 if the top BOOLEAN is FALSE.
+    /// </summary>
+    public class FloatFromBooleanExpression : Expression
+    {
+        public FloatFromBooleanExpression() : base("FLOAT.FROMBOOLEAN") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.BooleanStack.Count == 0)
+                return;
+
+            var condition = interpreter.BooleanStack.Pop();
+            var value = condition ? 1 : 0;
+
+            interpreter.FloatStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes a floating point version of the top INTEGER.
+    /// </summary>
+    public class FloatFromIntegerExpression : Expression
+    {
+        public FloatFromIntegerExpression() : base("FLOAT.FROMINTEGER")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0)
+                return;
+
+            var value = (double)interpreter.IntegerStack.Pop();
+
+            interpreter.FloatStack.Push(value);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs	(revision 14392)
@@ -0,0 +1,86 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Empties the given stack.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class FlushExpression<T> : Expression
+    {
+        public FlushExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack)
+        {
+            stack.Clear();
+        }
+    }
+
+    public class IntegerFlushExpression : FlushExpression<long>
+    {
+        public IntegerFlushExpression() : base("INTEGER.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+    }
+
+    public class FloatFlushExpression : FlushExpression<double>
+    {
+        public FloatFlushExpression() : base("FLOAT.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+    }
+
+    public class BooleanFlushExpression : FlushExpression<bool>
+    {
+        public BooleanFlushExpression() : base("BOOLEAN.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+    }
+
+    public class NameFlushExpression : FlushExpression<string>
+    {
+        public NameFlushExpression() : base("NAME.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+    }
+
+    public class ExecFlushExpression : FlushExpression<Expression>
+    {
+        public ExecFlushExpression() : base("EXEC.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+    }
+
+    public class CodeFlushExpression : FlushExpression<Expression>
+    {
+        public CodeFlushExpression() : base("CODE.FLUSH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/IntegerExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/IntegerExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/IntegerExpressions.cs	(revision 14392)
@@ -0,0 +1,171 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes the sum of the top two items.
+    /// </summary>
+    public class IntegerAddExpression : PushResultExpression<long>
+    {
+        public IntegerAddExpression() : base("INTEGER.+") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => values[0] + values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the difference of the top two items; that is, the second item minus the top item.
+    /// </summary>
+    public class IntegerSubtractExpression : PushResultExpression<long>
+    {
+        public IntegerSubtractExpression() : base("INTEGER.-") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => values[0] - values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the product of the top two items.
+    /// </summary>
+    public class IntegerMultiplyExpression : PushResultExpression<long>
+    {
+        public IntegerMultiplyExpression() : base("INTEGER.*") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => values[0] * values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the quotient of the top two items; that is, the second item divided by the top item.
+    /// If the top item is zero this acts as a NOOP.
+    /// </summary>
+    public class IntegerDivideExpression : PushResultExpression<long>
+    {
+        public IntegerDivideExpression() : base("INTEGER./") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => values[0] / values[1], 0);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the second stack item modulo the top stack item. If the top item is zero this acts as a NOOP. The modulus is computed as the
+    /// remainder of the quotient, where the quotient has first been truncated toward negative infinity. (This is taken from the definition
+    /// for the generic MOD function in Common Lisp, which is described for example at
+    /// http://www.lispworks.com/reference/HyperSpec/Body/f_mod_r.htm.)
+    /// </summary>
+    public class IntegerModuloExpression : PushResultExpression<long>
+    {
+        public IntegerModuloExpression() : base("INTEGER.%") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => values[0] % values[1], 0);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the minimum of the top two items.
+    /// </summary>
+    public class IntegerMinExpression : PushResultExpression<long>
+    {
+        public IntegerMinExpression() : base("INTEGER.MIN") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => Math.Min(values[0], values[1]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes the maximum of the top two items.
+    /// </summary>
+    public class IntegerMaxExpression : PushResultExpression<long>
+    {
+        public IntegerMaxExpression() : base("INTEGER.MAX") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, 2, values => Math.Max(values[0], values[1]));
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the second item is less than the top item, or FALSE otherwise.
+    /// </summary>
+    public class IntegerSmallerThanExpression : PushResultExpression<long>
+    {
+        public IntegerSmallerThanExpression() : base("INTEGER.<") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.IntegerStack,
+                interpreter.BooleanStack,
+                2,
+                values => values[0] < values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes TRUE onto the BOOLEAN stack if the second item is greater than the top item, or FALSE otherwise.
+    /// </summary>
+    public class IntegerGreaterThanExpression : PushResultExpression<long>
+    {
+        public IntegerGreaterThanExpression() : base("INTEGER.>") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.IntegerStack,
+                interpreter.BooleanStack,
+                2,
+                values => values[0] > values[1]);
+        }
+    }
+
+    /// <summary>
+    /// Pushes 1 if the top BOOLEAN is TRUE, or 0 if the top BOOLEAN is FALSE.
+    /// </summary>
+    public class IntegerFromBooleanExpression : Expression
+    {
+        public IntegerFromBooleanExpression() : base("INTEGER.FROMBOOLEAN") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.BooleanStack.Count == 0)
+                return;
+
+            var condition = interpreter.BooleanStack.Pop();
+            var value = condition ? 1 : 0;
+
+            interpreter.IntegerStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes the result of truncating the top FLOAT.
+    /// </summary>
+    public class IntegerFromFloatExpression : Expression
+    {
+        public IntegerFromFloatExpression() : base("INTEGER.FROMFLOAT") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.FloatStack.Count == 0)
+                return;
+
+            var value = (int)interpreter.FloatStack.Pop();
+
+            interpreter.IntegerStack.Push(value);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/LoopExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/LoopExpression.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/LoopExpression.cs	(revision 14392)
@@ -0,0 +1,85 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class LoopExpression : Expression
+    {
+        public long destinationIndex;
+        public long currentIndex;
+        public long incrementor;
+        public bool pushCurrentIndex = false;
+        public Expression body;
+
+        public LoopExpression(string stringRepresentation) : base(stringRepresentation) { }
+
+        protected void Eval(IInterpreter interpreter, IStack<Expression> sourceStack)
+        {
+            // if not initialized
+            if (body == null)
+            {
+                if (this.HasInsufficientArguments(interpreter, sourceStack))
+                {
+                    return;
+                }
+
+                this.InitState(interpreter, sourceStack);
+
+                interpreter.ExecStack.Push(this, this.body);
+
+                return;
+            }
+
+            // if loop end reached
+            if (destinationIndex == currentIndex)
+            {
+                this.PushLastIteration(interpreter);
+                this.Clear();
+
+                return;
+            }
+
+            this.PushIteration(interpreter);
+            this.currentIndex += this.incrementor;
+        }
+
+        protected virtual void Clear()
+        {
+            this.body = null;
+        }
+
+        protected virtual void PushIteration(IInterpreter interpreter)
+        {
+            interpreter.IntegerStack.Push(this.currentIndex);
+            interpreter.ExecStack.Push(this, this.body);
+        }
+
+        protected virtual void PushLastIteration(IInterpreter interpreter)
+        {
+            interpreter.IntegerStack.Push(this.currentIndex);
+            interpreter.ExecStack.Push(this.body);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (!base.Equals(obj))
+            {
+                return false;
+            }
+
+            var other = obj as LoopExpression;
+
+            var isBodyEqual =
+                (this.body == null && other.body == null) ||
+                (this.body != null && other.body != null && this.body.Equals(other.body));
+
+            return isBodyEqual &&
+                this.currentIndex == other.currentIndex &&
+                this.destinationIndex == other.destinationIndex &&
+                this.incrementor == other.incrementor;
+        }
+
+        protected abstract bool HasInsufficientArguments(IInterpreter interpreter, IStack<Expression> sourceStack);
+        protected abstract void InitState(IInterpreter interpreter, IStack<Expression> sourceStack);
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/NameExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/NameExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/NameExpressions.cs	(revision 14392)
@@ -0,0 +1,73 @@
+﻿using System.Linq;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public class NameDefineXExecExpression : Expression
+    {
+        public NameDefineXExecExpression(string name) : base(name) { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            Expression expression;
+            if (!interpreter.IsNameQuoteFlagSet &&
+                interpreter.CustomExpressions.TryGetValue(this.StringRepresentation, out expression))
+            {
+                interpreter.ExecStack.Push(expression);
+            }
+            else
+            {
+                interpreter.NameStack.Push(this.StringRepresentation);
+                interpreter.IsNameQuoteFlagSet = false;
+            }
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (!base.Equals(obj))
+            {
+                return false;
+            }
+
+            return this.StringRepresentation.Equals(obj.ToString());
+        }
+    }
+
+    /// <summary>
+    /// Sets a flag indicating that the next name encountered will be pushed onto the NAME stack (and not have its associated value
+    /// pushed onto the EXEC stack), regardless of whether or not it has a definition. Upon encountering such a name and pushing it
+    /// onto the NAME stack the flag will be cleared (whether or not the pushed name had a definition).
+    /// </summary>
+    public class NameQuoteExpression : Expression
+    {
+        public NameQuoteExpression() : base("NAME.QUOTE") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            interpreter.IsNameQuoteFlagSet = true;
+        }
+    }
+
+    /// <summary>
+    /// Pushes a randomly selected NAME that already has a definition.
+    /// </summary>
+    public class NameRandBoundNameExpression : Expression
+    {
+        private static IRandom rand = new FastRandom();
+
+        public NameRandBoundNameExpression() : base("NAME.RANDBOUNDNAME") { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (!interpreter.CustomExpressions.Any())
+                return;
+
+            var index = rand.Next(0, interpreter.CustomExpressions.Keys.Count - 1);
+            var name = interpreter.CustomExpressions.Keys.ElementAt(index);
+
+            interpreter.NameStack.Push(name);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PopExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PopExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PopExpressions.cs	(revision 14392)
@@ -0,0 +1,92 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class PopExpression<T> : Expression
+    {
+        public PopExpression(string stringRepresentation) : base(stringRepresentation)
+        {
+        }
+
+        public void Eval(IStack<T> stack)
+        {
+            if (stack.Count == 0)
+                return;
+
+            stack.Pop();
+        }
+    }
+
+    public class IntegerPopExpression : PopExpression<long>
+    {
+        public IntegerPopExpression() : base("INTEGER.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+    }
+
+    public class FloatPopExpression : PopExpression<double>
+    {
+        public FloatPopExpression() : base("FLOAT.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+    }
+
+    public class BooleanPopExpression : PopExpression<bool>
+    {
+        public BooleanPopExpression() : base("BOOLEAN.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+    }
+
+    public class NamePopExpression : PopExpression<string>
+    {
+        public NamePopExpression() : base("NAME.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+    }
+
+    public class ExecPopExpression : PopExpression<Expression>
+    {
+        public ExecPopExpression() : base("EXEC.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+    }
+
+    public class CodePopExpression : PopExpression<Expression>
+    {
+        public CodePopExpression() : base("CODE.POP")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushExpressions.cs	(revision 14392)
@@ -0,0 +1,139 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class PushExpression<T> : Expression
+    {
+        protected readonly T value;
+
+        public PushExpression(T value) : base(value.ToString(), value.GetHashCode())
+        {
+            this.value = value;
+        }
+
+        // copy constructor
+        public PushExpression(PushExpression<T> expression, Cloner cloner) : base(expression, cloner)
+        {
+            this.value = expression.value;
+        }
+
+        protected void Eval(IStack<T> stack)
+        {
+            stack.Push(this.value);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (obj == null || !(obj is PushExpression<T>))
+            {
+                return false;
+            }
+
+            var other = obj as PushExpression<T>;
+
+            return this.value.Equals(value);
+        }
+    }
+
+    public class IntegerPushExpression : PushExpression<long>
+    {
+        public IntegerPushExpression(long value) : base(value)
+        { }
+
+        // copy constructor
+        public IntegerPushExpression(IntegerPushExpression expression, Cloner cloner) : base(expression, cloner)
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new IntegerPushExpression(this, cloner);
+        }
+    }
+
+    public class FloatPushExpression : PushExpression<double>
+    {
+        public FloatPushExpression(double value) : base(value)
+        { }
+
+        // copy constructor
+        public FloatPushExpression(FloatPushExpression expression, Cloner cloner) : base(expression, cloner)
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new FloatPushExpression(this, cloner);
+        }
+    }
+
+    public class BooleanPushExpression : PushExpression<bool>
+    {
+        public BooleanPushExpression(bool value) : base(value)
+        { }
+
+        // copy constructor
+        public BooleanPushExpression(BooleanPushExpression expression, Cloner cloner) : base(expression, cloner)
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new BooleanPushExpression(this, cloner);
+        }
+    }
+
+    public class NamePushExpression : PushExpression<string>
+    {
+        public NamePushExpression(string value) : base(value)
+        { }
+
+        // copy constructor
+        public NamePushExpression(NamePushExpression expression, Cloner cloner) : base(expression, cloner)
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new NamePushExpression(this, cloner);
+        }
+    }
+
+    public class ExecPushExpression : PushExpression<Expression>
+    {
+        public ExecPushExpression(Expression value) : base(value)
+        { }
+
+        // copy constructor
+        public ExecPushExpression(ExecPushExpression expression, Cloner cloner) : base(expression, cloner)
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new ExecPushExpression(this, cloner);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushResultExpression.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushResultExpression.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/PushResultExpression.cs	(revision 14392)
@@ -0,0 +1,38 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class PushResultExpression<T> : Expression
+    {
+        public PushResultExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        protected void Eval(IStack<T> stack, int count, Func<T[], T> templateFunc)
+        {
+            if (stack.Count < count)
+                return;
+
+            stack.PushResult(count, templateFunc);
+        }
+
+        protected void Eval(IStack<T> stack, int count, Func<T[], T> templateFunc, T ignoreValue)
+        {
+            if (stack.Count < count || stack.Top.Equals(ignoreValue))
+                return;
+
+            stack.PushResult(count, templateFunc);
+        }
+
+        protected void Eval<R>(IStack<T> stack, IStack<R> resultStack, int count, Func<T[], R> templateFunc)
+        {
+            if (stack.Count < count)
+                return;
+
+            var items = stack.Pop(count);
+            var result = templateFunc(items);
+
+            resultStack.Push(result);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RandExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RandExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RandExpressions.cs	(revision 14392)
@@ -0,0 +1,97 @@
+﻿using HeuristicLab.Algorithms.PushGP.Generators;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes a random NAME.
+    /// </summary>
+    public class NameRandExpression : Expression
+    {
+        public NameRandExpression() : base("NAME.RAND")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var name = NameGenerator.RandomName();
+
+            interpreter.NameStack.Push(name);
+        }
+    }
+
+    /// <summary>
+    /// Pushes a random integer.
+    /// </summary>
+    public class IntegerRandExpression : Expression
+    {
+        public IntegerRandExpression() : base("INTEGER.RAND")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var value = IntegerGenerator.RandomInteger(
+                interpreter.Configuration.MinRandomInteger,
+                interpreter.Configuration.MaxRandomInteger);
+
+            interpreter.IntegerStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes a random float.
+    /// </summary>
+    public class FloatRandExpression : Expression
+    {
+        public FloatRandExpression() : base("FLOAT.RAND")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var value = FloatGenerator.RandomFloat(
+                interpreter.Configuration.MinRandomFloat,
+                interpreter.Configuration.MaxRandomFloat);
+
+            interpreter.FloatStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes a random boolean.
+    /// </summary>
+    public class BooleanRandExpression : Expression
+    {
+        public BooleanRandExpression() : base("BOOLEAN.RAND")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            var value = BooleanGenerator.RandomBoolean();
+
+            interpreter.BooleanStack.Push(value);
+        }
+    }
+
+    /// <summary>
+    /// Pushes random expressions onto the code stack.
+    /// </summary>
+    public class CodeRandExpression : Expression
+    {
+        public CodeRandExpression() : base("CODE.RAND")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            if (interpreter.IntegerStack.Count == 0 ||
+                interpreter.IntegerStack.Top < 1)
+                return;
+
+            var size = (int)(interpreter.IntegerStack.Pop() % interpreter.Configuration.MaxPointsInRandomExpression);
+            var expression = interpreter.CodeGenerator.RandomCode(size);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RotateExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RotateExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/RotateExpressions.cs	(revision 14392)
@@ -0,0 +1,85 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class RotateExpression<T> : Expression
+    {
+        public RotateExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack)
+        {
+            if (stack.Count < 3)
+                return;
+
+            stack.Swap(3);
+        }
+    }
+
+    public class IntegerRotateExpression : RotateExpression<long>
+    {
+        public IntegerRotateExpression() : base("INTEGER.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+    }
+
+    public class FloatRotateExpression : RotateExpression<double>
+    {
+        public FloatRotateExpression() : base("FLOAT.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+    }
+
+    public class BooleanRotateExpression : RotateExpression<bool>
+    {
+        public BooleanRotateExpression() : base("BOOLEAN.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+    }
+
+    public class NameRotateExpression : RotateExpression<string>
+    {
+        public NameRotateExpression() : base("NAME.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+    }
+
+    public class ExecRotateExpression : RotateExpression<Expression>
+    {
+        public ExecRotateExpression() : base("EXEC.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+    }
+
+    public class CodeRotateExpression : RotateExpression<Expression>
+    {
+        public CodeRotateExpression() : base("CODE.ROT")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SetExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SetExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SetExpressions.cs	(revision 14392)
@@ -0,0 +1,69 @@
+﻿using System;
+using System.Collections.Generic;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Binds the top of stack to the NAME on top of the NAME stack.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class SetExpressions<T> : Expression
+    {
+        public SetExpressions(string stringRepresentation) : base(stringRepresentation)
+        {
+        }
+
+        public void Eval(IStack<T> stack, IStack<string> nameStack, IDictionary<string, Expression> customExpressions, Func<T, Expression> creator)
+        {
+            if (stack.Count == 0 || nameStack.Count == 0)
+                return;
+
+            var name = nameStack.Pop();
+            var value = stack.Pop();
+            var expression = creator(value);
+
+            if (customExpressions.ContainsKey(name))
+            {
+                customExpressions[name] = expression;
+            }
+            else
+            {
+                customExpressions.Add(name, expression);
+            }
+        }
+    }
+
+    public class IntegerSetExpression : SetExpressions<long>
+    {
+        public IntegerSetExpression() : base("INTEGER.SET")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.IntegerStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new IntegerPushExpression(v));
+        }
+    }
+
+    public class FloatSetExpression : SetExpressions<double>
+    {
+        public FloatSetExpression() : base("FLOAT.SET")
+        {
+        }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(
+                interpreter.FloatStack,
+                interpreter.NameStack,
+                interpreter.CustomExpressions,
+                v => new FloatPushExpression(v));
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ShoveExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ShoveExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/ShoveExpressions.cs	(revision 14392)
@@ -0,0 +1,94 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    public abstract class ShoveExpression<T> : Expression
+    {
+        public ShoveExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack, IStack<long> integerStack, int count = 1)
+        {
+            if (integerStack.Count == 0)
+                return;
+
+            if (integerStack.Top > stack.Count - count ||
+                integerStack.Top < 0 ||
+                stack.Count < 2)
+                return;
+
+            var index = integerStack.Pop();
+            var item = stack.Pop();
+
+            // TODO: What if index > int.MaxValue ?
+            stack.Insert((int)index, item);
+        }
+    }
+
+    public class IntegerShoveExpression : ShoveExpression<long>
+    {
+        public IntegerShoveExpression() : base("INTEGER.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, interpreter.IntegerStack, 2);
+        }
+    }
+
+    public class FloatShoveExpression : ShoveExpression<double>
+    {
+        public FloatShoveExpression() : base("FLOAT.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class BooleanShoveExpression : ShoveExpression<bool>
+    {
+        public BooleanShoveExpression() : base("BOOLEAN.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class NameShoveExpression : ShoveExpression<string>
+    {
+        public NameShoveExpression() : base("NAME.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class ExecShoveExpression : ShoveExpression<Expression>
+    {
+        public ExecShoveExpression() : base("EXEC.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class CodeShoveExpression : ShoveExpression<Expression>
+    {
+        public CodeShoveExpression() : base("CODE.SHOVE")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack, interpreter.IntegerStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/StackdepthExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/StackdepthExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/StackdepthExpressions.cs	(revision 14392)
@@ -0,0 +1,93 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Pushes the stack depth onto the INTEGER stack (thereby increasing it!).
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class StackdepthExpression<T> : Expression
+    {
+        public StackdepthExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack, IStack<long> integerStack, bool incremental = false)
+        {
+            var count = stack.Count;
+
+            if (incremental)
+            {
+                count += 1;
+            }
+
+            integerStack.Push(count);
+        }
+    }
+
+    public class IntegerStackdepthExpression : StackdepthExpression<long>
+    {
+        public IntegerStackdepthExpression() : base("INTEGER.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, interpreter.IntegerStack, true);
+        }
+    }
+
+    public class FloatStackdepthExpression : StackdepthExpression<double>
+    {
+        public FloatStackdepthExpression() : base("FLOAT.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class BooleanStackdepthExpression : StackdepthExpression<bool>
+    {
+        public BooleanStackdepthExpression() : base("BOOLEAN.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class NameStackdepthExpression : StackdepthExpression<string>
+    {
+        public NameStackdepthExpression() : base("NAME.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class ExecStackdepthExpression : StackdepthExpression<Expression>
+    {
+        public ExecStackdepthExpression() : base("EXEC.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class CodeStackdepthExpression : StackdepthExpression<Expression>
+    {
+        public CodeStackdepthExpression() : base("CODE.STACKDEPTH")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack, interpreter.IntegerStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SwapExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SwapExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/SwapExpressions.cs	(revision 14392)
@@ -0,0 +1,89 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// Swaps the top two values.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class SwapExpression<T> : Expression
+    {
+        public SwapExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack)
+        {
+            if (stack.Count < 2)
+                return;
+
+            stack.Swap(2);
+        }
+    }
+
+    public class IntegerSwapExpression : SwapExpression<long>
+    {
+        public IntegerSwapExpression() : base("INTEGER.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack);
+        }
+    }
+
+    public class FloatSwapExpression : SwapExpression<double>
+    {
+        public FloatSwapExpression() : base("FLOAT.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack);
+        }
+    }
+
+    public class BooleanSwapExpression : SwapExpression<bool>
+    {
+        public BooleanSwapExpression() : base("BOOLEAN.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack);
+        }
+    }
+
+    public class NameSwapExpression : SwapExpression<string>
+    {
+        public NameSwapExpression() : base("NAME.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack);
+        }
+    }
+
+    public class ExecSwapExpression : SwapExpression<Expression>
+    {
+        public ExecSwapExpression() : base("EXEC.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack);
+        }
+    }
+
+    public class CodeSwapExpression : SwapExpression<Expression>
+    {
+        public CodeSwapExpression() : base("CODE.SWAP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankDuplicateExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankDuplicateExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankDuplicateExpressions.cs	(revision 14392)
@@ -0,0 +1,100 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// 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, and the indexing is done after the index is removed.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class YankDuplicateExpression<T> : Expression
+    {
+        public YankDuplicateExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack, IStack<long> integerStack, int count = 1)
+        {
+            if (integerStack.Count == 0)
+                return;
+
+            var index = integerStack.Top;
+
+            if (index > stack.Count - count ||
+                index < 0 ||
+                stack.Count < 2)
+                return;
+
+            integerStack.Pop();
+            var item = stack.ElementAt((int)index);
+
+            stack.Push(item);
+        }
+    }
+
+    public class IntegerYankDuplicateExpression : YankDuplicateExpression<long>
+    {
+        public IntegerYankDuplicateExpression() : base("INTEGER.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, interpreter.IntegerStack, 2);
+        }
+    }
+
+    public class FloatYankDuplicateExpression : YankDuplicateExpression<double>
+    {
+        public FloatYankDuplicateExpression() : base("FLOAT.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class BooleanYankDuplicateExpression : YankDuplicateExpression<bool>
+    {
+        public BooleanYankDuplicateExpression() : base("BOOLEAN.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class NameYankDuplicateExpression : YankDuplicateExpression<string>
+    {
+        public NameYankDuplicateExpression() : base("NAME.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class ExecYankDuplicateExpression : YankDuplicateExpression<Expression>
+    {
+        public ExecYankDuplicateExpression() : base("EXEC.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class CodeYankDuplicateExpression : YankDuplicateExpression<Expression>
+    {
+        public CodeYankDuplicateExpression() : base("CODE.YANKDUP")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack, interpreter.IntegerStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankExpressions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankExpressions.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/YankExpressions.cs	(revision 14392)
@@ -0,0 +1,98 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Expressions
+{
+    /// <summary>
+    /// 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, and the indexing is done after the index is removed.
+    /// </summary>
+    /// <typeparam name="T">Stacktype</typeparam>
+    public abstract class YankExpression<T> : Expression
+    {
+        public YankExpression(string stringRepresentation) : base(stringRepresentation)
+        { }
+
+        public void Eval(IStack<T> stack, IStack<long> integerStack, int count = 1)
+        {
+            if (integerStack.Count == 0)
+                return;
+
+            var index = integerStack.Top;
+
+            if (index > stack.Count - count ||
+                index < 0 ||
+                stack.Count < 2)
+                return;
+
+            integerStack.Pop();
+            stack.Yank((int)index);
+        }
+    }
+
+    public class IntegerYankExpression : YankExpression<long>
+    {
+        public IntegerYankExpression() : base("INTEGER.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.IntegerStack, interpreter.IntegerStack, 2);
+        }
+    }
+
+    public class FloatYankExpression : YankExpression<double>
+    {
+        public FloatYankExpression() : base("FLOAT.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.FloatStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class BooleanYankExpression : YankExpression<bool>
+    {
+        public BooleanYankExpression() : base("BOOLEAN.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.BooleanStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class NameYankExpression : YankExpression<string>
+    {
+        public NameYankExpression() : base("NAME.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.NameStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class ExecYankExpression : YankExpression<Expression>
+    {
+        public ExecYankExpression() : base("EXEC.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.ExecStack, interpreter.IntegerStack);
+        }
+    }
+
+    public class CodeYankExpression : YankExpression<Expression>
+    {
+        public CodeYankExpression() : base("CODE.YANK")
+        { }
+
+        public override void Eval(IInterpreter interpreter)
+        {
+            this.Eval(interpreter.CodeStack, interpreter.IntegerStack);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/BooleanGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/BooleanGenerator.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/BooleanGenerator.cs	(revision 14392)
@@ -0,0 +1,15 @@
+﻿using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Generators
+{
+    public static class BooleanGenerator
+    {
+        private static IRandom rand = new FastRandom();
+
+        public static bool RandomBoolean()
+        {
+            return rand.NextDouble() > 0.5 ? true : false;
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/CodeGenerator.cs	(revision 14392)
@@ -1,37 +1,60 @@
-﻿using System.Collections.Generic;
+﻿using System;
+using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using HeuristicLab.Core;
 using HeuristicLab.Random;
 
 namespace HeuristicLab.Algorithms.PushGP.Generators
 {
-    public static class CodeGenerator
+    /// <summary>
+    /// The following is the standard Push random code generation algorithm, which is used for the CODE.RAND instruction.
+    /// It may also be useful for the initialization of programs in evolutionary computation systems, and it is used for this purpose in PushGP.
+    /// It produces a uniform distribution of sizes and what seems to be a reasonable distribution of shapes, in a reasonable amount of time.
+    /// </summary>
+    /// <see cref="http://faculty.hampshire.edu/lspector/push3-description.html#RandomCode"/>
+    public class CodeGenerator
     {
-        private static FastRandom random = new FastRandom();
-        public static IEnumerable<Expression> RandomCode(int maxPoints)
+        private static IRandom random = new FastRandom();
+        private readonly IInterpreter interpreter;
+
+        public CodeGenerator(IInterpreter interpreter)
         {
-            var actualPoints = random.Next(1, maxPoints);
-
-            return RandomCodeWithSize(actualPoints).ToArray();
+            this.interpreter = interpreter;
         }
 
-        private static IEnumerable<Expression> RandomCodeWithSize(int points)
+        /// <summary>
+        /// Generates a random program with a given max size
+        /// </summary>
+        /// <param name="maxPoints"></param>
+        /// <returns>Returns an ExpandExpression if maxPoints smaller or equal to Configuration.MaxProgramPoints and Noop otherwise</returns>
+        public Expression RandomProgram(int maxPoints)
+        {
+            return ExecExpandExpression.TryCreate(interpreter.CodeGenerator.RandomCode(maxPoints).ToArray(), interpreter.Configuration);
+        }
+
+        public IEnumerable<Expression> RandomCode(int maxPoints)
+        {
+            var actualPoints = random.Next(1, Math.Max(1, maxPoints));
+
+            return RandomCodeWithSize(actualPoints);
+        }
+
+        private IEnumerable<Expression> RandomCodeWithSize(int points)
         {
             if (points == 1)
             {
-                // 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);
-
-                return new[] { ExpressionFactory.Create(opCode) };
+                var index = random.Next(0, ExpressionTable.Count + this.interpreter.CustomExpressions.Count - 2);
+                return new[] { this.CreateExpression(index) };
             }
             else
             {
                 var sizesThisLevel = Decompose(points - 1, points - 1);
-
                 return sizesThisLevel.SelectMany(size => RandomCodeWithSize(size)).Shuffle(random);
             }
         }
 
-        private static IEnumerable<int> Decompose(int number, int maxParts)
+        private IEnumerable<int> Decompose(int number, int maxParts)
         {
             if (number == 1 || maxParts == 1)
@@ -42,8 +65,14 @@
             {
                 var thisPart = random.Next(1, number - 1);
-
                 return new[] { thisPart }.Concat(Decompose(number - thisPart, maxParts - 1));
             }
         }
+
+        private Expression CreateExpression(int index)
+        {
+            return (index >= 0 && index < ExpressionTable.Count)
+                ? ExpressionTable.GetExpression(index)
+                : new NameDefineXExecExpression(this.interpreter.CustomExpressions.ElementAt(index - (ExpressionTable.Count - 1)).Key);
+        }
     }
 }
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/Configuration.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/Configuration.cs	(revision 14391)
+++ 	(revision )
@@ -1,41 +1,0 @@
-﻿namespace HeuristicLab.Algorithms.PushGP.Generators
-{
-    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; }
-
-        /// <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; }
-
-        /// <summary>
-        /// The minimum FLOAT that will be produced as an ephemeral random FLOAT constant or from a call to FLOAT.RAND.
-        /// </summary>
-        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 MaxRandomFloat { 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; }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/FloatGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/FloatGenerator.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/FloatGenerator.cs	(revision 14392)
@@ -0,0 +1,15 @@
+﻿using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Generators
+{
+    public class FloatGenerator
+    {
+        private static IRandom rand = new FastRandom();
+
+        public static double RandomFloat(double min = double.MinValue, double max = double.MaxValue)
+        {
+            return rand.NextDouble() * (max - min) + min;
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/IntegerGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/IntegerGenerator.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/IntegerGenerator.cs	(revision 14392)
@@ -0,0 +1,15 @@
+﻿using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Generators
+{
+    public static class IntegerGenerator
+    {
+        private static IRandom rand = new FastRandom();
+
+        public static long RandomInteger(int min = int.MinValue, int max = int.MaxValue)
+        {
+            return rand.Next(min, max);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/NameGenerator.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/NameGenerator.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Generators/NameGenerator.cs	(revision 14392)
@@ -0,0 +1,47 @@
+﻿using System;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.PushGP.Generators
+{
+    public class NameGenerator
+    {
+        public const int DefaultRandomNameLength = 10;
+        private static IRandom rand = new FastRandom();
+        private static char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
+
+        private int index = 0;
+
+        public string GetNextString()
+        {
+            var length = index < chars.Length ? 1 : (int)(Math.Log(index, chars.Length)) + 1;
+            var result = new char[length];
+            var tmp = index;
+            index++;
+
+            for (var i = length; i > 0; i--)
+            {
+                var a = (int)Math.Pow(chars.Length, i - 1);
+                var b = tmp / a;
+
+                result[length - i] = chars[b];
+
+                tmp -= a * b;
+            }
+
+            return new string(result);
+        }
+
+        public static string RandomName(int length = DefaultRandomNameLength)
+        {
+            var name = new char[length];
+
+            for (var i = 0; i < length; i++)
+            {
+                name[i] = chars[rand.Next(chars.Length)];
+            }
+
+            return new string(name);
+        }
+    }
+}
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 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj	(revision 14392)
@@ -53,39 +53,45 @@
   <ItemGroup>
     <Compile Include="Exporter\Exporter.cs" />
-    <Compile Include="Expressions\Boolean\BooleanPushExpression.cs" />
-    <Compile Include="Expressions\Code\CodeDoExpression.cs" />
-    <Compile Include="Expressions\Code\CodeDefineExpression.cs" />
-    <Compile Include="Expressions\Code\CodeIfExpression.cs" />
-    <Compile Include="Expressions\Code\CodeNoopExpression.cs" />
-    <Compile Include="Expressions\Code\CodeQuoteExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecDefineExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecYExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecDoRangeExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecIfExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecPushExpression.cs" />
-    <Compile Include="Expressions\Exec\ExecExpandExpression.cs" />
-    <Compile Include="Expressions\ExpressionFactory.cs" />
+    <Compile Include="Expressions\BooleanExpressions.cs" />
+    <Compile Include="Expressions\CodeExpressions.cs" />
+    <Compile Include="Expressions\DoCountExpressions.cs" />
+    <Compile Include="Expressions\DoTimesExpressions.cs" />
+    <Compile Include="Expressions\ERCExpressions.cs" />
+    <Compile Include="Expressions\DoRangeExpressions.cs" />
+    <Compile Include="Expressions\LoopExpression.cs" />
+    <Compile Include="Expressions\PushResultExpression.cs" />
+    <Compile Include="Expressions\EqualsExpressions.cs" />
+    <Compile Include="Expressions\RandExpressions.cs" />
+    <Compile Include="Expressions\SetExpressions.cs" />
+    <Compile Include="Expressions\YankDuplicateExpressions.cs" />
+    <Compile Include="Expressions\YankExpressions.cs" />
+    <Compile Include="Expressions\StackdepthExpressions.cs" />
+    <Compile Include="Expressions\ShoveExpressions.cs" />
+    <Compile Include="Expressions\RotateExpressions.cs" />
+    <Compile Include="Expressions\SwapExpressions.cs" />
+    <Compile Include="Expressions\FlushExpressions.cs" />
+    <Compile Include="Expressions\FloatExpressions.cs" />
+    <Compile Include="Expressions\IntegerExpressions.cs" />
+    <Compile Include="Expressions\DefineExpressions.cs" />
+    <Compile Include="Expressions\DuplicateExpressions.cs" />
+    <Compile Include="Expressions\PopExpressions.cs" />
+    <Compile Include="Expressions\PushExpressions.cs" />
+    <Compile Include="Expressions\ExecExpressions.cs" />
     <Compile Include="Expressions\Expression.cs" />
-    <Compile Include="Expressions\Float\FloatPushExpression.cs" />
-    <Compile Include="Expressions\Integer\IntegerPushExpression.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="Expressions\NameExpressions.cs" />
+    <Compile Include="StateFullExpressionAttribute.cs" />
+    <Compile Include="Generators\BooleanGenerator.cs" />
+    <Compile Include="Generators\FloatGenerator.cs" />
+    <Compile Include="Generators\IntegerGenerator.cs" />
+    <Compile Include="Generators\NameGenerator.cs" />
     <Compile Include="Interpreter\Configuration.cs" />
     <Compile Include="Generators\CodeGenerator.cs" />
-    <Compile Include="Generators\Configuration.cs" />
-    <Compile Include="OpCode.cs" />
-    <Compile Include="OpCodeExtensions.cs" />
     <Compile Include="Parser\Parser.cs" />
     <Compile Include="Stack\IStack.cs" />
-    <Compile Include="Interpreter\Interpreter.cs" />
+    <Compile Include="Interpreter\PushGPInterpreter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Interpreter\IInterpreter.cs" />
     <Compile Include="Stack\PushGPStack.cs" />
-    <Compile Include="Parser\SymbolTable.cs" />
-    <Compile Include="Symbols.cs" />
+    <Compile Include="ExpressionTable.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 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP.csproj.user	(revision 14392)
@@ -2,5 +2,5 @@
 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <ProjectView>ShowAllFiles</ProjectView>
+    <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 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Configuration.cs	(revision 14392)
@@ -4,5 +4,5 @@
 namespace HeuristicLab.Algorithms.PushGP.Interpreter
 {
-    public class Configuration : Generators.Configuration
+    public class Configuration
     {
         public Configuration()
@@ -14,14 +14,20 @@
             this.IsNameStackEnabled = true;
 
-            this.EvalPushLimit = uint.MaxValue;
-            this.MaxPointsInProgram = uint.MaxValue;
-            this.MaxPointsInRandomExpression = uint.MaxValue;
+            this.EvalPushLimit = 1024;
+            this.MaxPointsInProgram = 4096;
+            this.MaxPointsInRandomExpression = 4096;
 
             this.TopLevelPushCode = true;
-            this.TopLevelPopCode = true;
+            this.TopLevelPopCode = false;
 
             this.RandomSeedMax = 30081;
             this.RandomSeedMin = 0;
             this.RandomSeed = null;
+
+            this.MinRandomInteger = -128;
+            this.MaxRandomInteger = 128;
+            this.MinRandomFloat = -128D;
+            this.MaxRandomFloat = 128D;
+            this.NewErcNameProbability = 0.5;
         }
 
@@ -32,5 +38,5 @@
         public bool IsNameStackEnabled { get; set; }
 
-        public IList<OpCode> AllowedInclassions { get; set; }
+        public IList<string> AllowedInstructions { get; set; }
 
         public IList<Expression> PredefinedExpressions { get; set; }
@@ -38,5 +44,5 @@
         /// <summary>
         /// This is the maximum allowed number of "executions" in a single top-level call to the interpreter.
-        /// The execution of a single Push inclassion counts as one execution, as does the processing of a single literal,
+        /// The execution of a single Push instruction 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
@@ -48,11 +54,11 @@
         /// <summary>
         /// This is the maximum size of an item on the CODE stack, expressed as a number of points.
-        /// 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.
+        /// 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.
         /// </summary>
         public uint MaxPointsInProgram { get; set; }
 
         /// <summary>
-        /// The maximum number of points in an expression produced by the CODE.RAND inclassion.
+        /// The maximum number of points in an expression produced by the CODE.RAND instruction.
         /// </summary>
         public uint MaxPointsInRandomExpression { get; set; }
@@ -69,4 +75,31 @@
         public bool TopLevelPopCode { 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 int 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 int 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 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 MaxRandomFloat { 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; }
+
         public ushort RandomSeedMax { get; set; }
         public ushort RandomSeedMin { 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 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/IInterpreter.cs	(revision 14392)
@@ -3,4 +3,5 @@
 using System.Threading.Tasks;
 using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Generators;
 using HeuristicLab.Algorithms.PushGP.Stack;
 
@@ -15,6 +16,11 @@
         IStack<long> IntegerStack { get; }
         IStack<double> FloatStack { get; }
+        IDictionary<string, Expression> CustomExpressions { get; }
 
-        IDictionary<string, Expression> CustomExpressions { get; }
+        Configuration Configuration { get; }
+
+        CodeGenerator CodeGenerator { get; }
+
+        bool IsNameQuoteFlagSet { get; set; }
 
         void Interpret(string code);
@@ -22,5 +28,5 @@
         void Interpret(Expression program);
         Task InterpretAsync(Expression program, bool paused = false, CancellationToken token = default(CancellationToken));
-        Task AbortAndReset();
+        Task AbortAndResetAsync();
         Task AbortAsync();
         Task PauseAsync();
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Interpreter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/Interpreter.cs	(revision 14391)
+++ 	(revision )
@@ -1,241 +1,0 @@
-﻿using System;
-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 class PushGPInterpreter : IInterpreter
-    {
-        private Task currentTask;
-
-        public PushGPInterpreter(Configuration config = null)
-        {
-            this.Configuration = config ?? new Configuration();
-
-            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()
-        {
-            this.IsAborted = false;
-            this.IsPaused = false;
-            this.currentTask = null;
-
-            this.Clear();
-        }
-
-        public void Clear()
-        {
-            this.ExecStack.Clear();
-            this.CodeStack.Clear();
-            this.NameStack.Clear();
-            this.BooleanStack.Clear();
-            this.IntegerStack.Clear();
-            this.FloatStack.Clear();
-
-            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();
-            this.Reset();
-        }
-
-        public async Task PauseAsync()
-        {
-            if (this.IsPaused || this.IsCompleted)
-                return;
-
-            this.IsPaused = true;
-
-            if (this.currentTask != null)
-            {
-                await this.currentTask;
-            }
-        }
-
-        public Task ResumeAsync()
-        {
-            if (this.IsPaused || !this.IsAborted)
-            {
-                this.IsPaused = false;
-                return this.InterpreteAsync();
-            }
-
-            return this.currentTask;
-        }
-
-        public void Step()
-        {
-            if (CanStep)
-            {
-                DoStep();
-
-                if (IsCompleted && this.Configuration.TopLevelPopCode)
-                {
-                    this.CodeStack.Pop();
-                }
-            }
-        }
-
-        public static Expression Encode(string code)
-        {
-            return Parser.Parse(code);
-        }
-
-        public static Task<Expression> EncodeAsync(string code, CancellationToken token = default(CancellationToken))
-        {
-            return Task.Run(() => Encode(code), token);
-        }
-
-        public static string Decode(Expression expression)
-        {
-            return string.Concat(expression.ToString());
-        }
-
-        public static Task<string> DecodeAsync(Expression expression, CancellationToken token = default(CancellationToken))
-        {
-            return Task.Run(() => Decode(expression), token);
-        }
-
-        public void PrintStacks()
-        {
-            this.PrintStack("EXEC", this.ExecStack);
-            this.PrintStack("CODE", this.CodeStack);
-            this.PrintStack("NAME", this.NameStack);
-            this.PrintStack("BOOLEAN", this.BooleanStack);
-            this.PrintStack("FLOAT", this.FloatStack);
-            this.PrintStack("INTEGER", this.IntegerStack);
-        }
-
-        private void PrintStack<T>(string name, IStack<T> stack)
-        {
-            Console.WriteLine(string.Format(
-                "--- {0} ---\n{1}\n---------------------------------------------------",
-                name,
-                stack));
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/PushGPInterpreter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/PushGPInterpreter.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Interpreter/PushGPInterpreter.cs	(revision 14392)
@@ -0,0 +1,247 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Generators;
+using HeuristicLab.Algorithms.PushGP.Stack;
+
+namespace HeuristicLab.Algorithms.PushGP.Interpreter
+{
+    public class PushGPInterpreter : IInterpreter
+    {
+        private Task currentTask;
+
+
+        public PushGPInterpreter(Configuration config = null)
+        {
+            this.Configuration = config ?? new Configuration();
+
+            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>();
+
+            this.CodeGenerator = new CodeGenerator(this);
+        }
+
+        public Configuration Configuration { get; private set; }
+
+        public int ExecCounter { 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 && ExecCounter < Configuration.EvalPushLimit; } }
+        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 CodeGenerator CodeGenerator { get; private set; }
+
+        public bool IsNameQuoteFlagSet { get; set; }
+
+        public void Reset()
+        {
+            this.IsAborted = false;
+            this.IsPaused = false;
+            this.currentTask = null;
+
+            this.Clear();
+        }
+
+        public void Clear()
+        {
+            this.ExecCounter = 0;
+
+            this.ExecStack.Clear();
+            this.CodeStack.Clear();
+            this.NameStack.Clear();
+            this.BooleanStack.Clear();
+            this.IntegerStack.Clear();
+            this.FloatStack.Clear();
+
+            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)
+        {
+            /* 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);
+
+            if (this.Configuration.TopLevelPushCode)
+            {
+                this.CodeStack.Insert(0, program);
+            }
+
+            // run top expression
+            this.ExecStack.Pop().Eval(this);
+
+            this.Interpret();
+        }
+
+        private void Interpret()
+        {
+            while (this.IsRunning)
+            {
+                this.DoStep();
+                this.ExecCounter++;
+            }
+
+            this.Finally();
+        }
+
+        private void Finally()
+        {
+            if (this.IsCompleted && this.Configuration.TopLevelPopCode && this.CodeStack.Count > 0)
+            {
+                this.CodeStack.Pop();
+            }
+        }
+
+        private void DoStep()
+        {
+            this.ExecStack.Pop().Eval(this);
+        }
+
+        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 AbortAndResetAsync()
+        {
+            await this.AbortAsync();
+            this.Reset();
+        }
+
+        public async Task PauseAsync()
+        {
+            if (this.IsPaused || this.IsCompleted)
+                return;
+
+            this.IsPaused = true;
+
+            if (this.currentTask != null)
+            {
+                await this.currentTask;
+            }
+        }
+
+        public Task ResumeAsync()
+        {
+            if (this.IsPaused || !this.IsAborted)
+            {
+                this.IsPaused = false;
+                return this.InterpreteAsync();
+            }
+
+            return this.currentTask;
+        }
+
+        public void Step()
+        {
+            if (this.CanStep)
+            {
+                this.DoStep();
+                this.Finally();
+            }
+        }
+
+        public void Step(int count)
+        {
+            for (var i = 0; i < count; i++)
+            {
+                this.Step();
+            }
+        }
+
+        public static Expression Encode(string code)
+        {
+            return Parser.Parse(code);
+        }
+
+        public static Task<Expression> EncodeAsync(string code, CancellationToken token = default(CancellationToken))
+        {
+            return Task.Run(() => Encode(code), token);
+        }
+
+        public static string Decode(Expression expression)
+        {
+            return string.Concat(expression.ToString());
+        }
+
+        public static Task<string> DecodeAsync(Expression expression, CancellationToken token = default(CancellationToken))
+        {
+            return Task.Run(() => Decode(expression), token);
+        }
+
+        public void PrintStacks()
+        {
+            this.PrintStack("EXEC", this.ExecStack);
+            this.PrintStack("CODE", this.CodeStack);
+            this.PrintStack("NAME", this.NameStack);
+            this.PrintStack("BOOLEAN", this.BooleanStack);
+            this.PrintStack("FLOAT", this.FloatStack);
+            this.PrintStack("INTEGER", this.IntegerStack);
+        }
+
+        private void PrintStack<T>(string name, IStack<T> stack)
+        {
+            Console.WriteLine(string.Format(
+                "--- {0} ---\n{1}\n---------------------------------------------------",
+                name,
+                stack));
+        }
+    }
+}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs	(revision 14391)
+++ 	(revision )
@@ -1,900 +1,0 @@
-﻿namespace HeuristicLab.Algorithms.PushGP
-{
-    public enum OpCode : byte
-    {
-        #region Boolean
-        /// <summary>
-        /// BOOLEAN.=:
-        /// Pushes TRUE if the top two BOOLEANs are equal, or FALSE otherwise
-        /// </summary>
-        BooleanEquals,
-
-        /// <summary>
-        /// BOOLEAN.AND:
-        /// Pushes the logical AND of the top two BOOLEANs
-        /// </summary>
-        BooleanAnd,
-
-        /// <summary>
-        /// BOOLEAN.DEFINE:
-        /// 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,
-
-        /// <summary>
-        /// BOOLEAN.DUP:
-        /// 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>
-        /// BOOLEAN.FLUSH:
-        /// Empties the BOOLEAN stack.
-        /// </summary>
-        BooleanFlush,
-
-        /// <summary>
-        /// BOOLEAN.FROMFLOAT:
-        /// Pushes FALSE if the top FLOAT is 0.0, or TRUE otherwise.
-        /// </summary>
-        BooleanFromFloat,
-
-        /// <summary>
-        /// BOOLEAN.FROMINTEGER:
-        /// Pushes FALSE if the top INTEGER is 0, or TRUE otherwise.
-        /// </summary>
-        BooleanFromInteger,
-
-        /// <summary>
-        /// BOOLEAN.NOT:
-        /// Pushes the logical NOT of the top BOOLEAN.
-        /// </summary>
-        BooleanNot,
-
-        /// <summary>
-        /// BOOLEAN.OR:
-        /// Pushes the logical OR of the top two BOOLEANs.
-        /// </summary>
-        BooleanOr,
-
-        /// <summary>
-        /// BOOLEAN.POP:
-        /// Pops the BOOLEAN stack.
-        /// </summary>
-        BooleanPop,
-
-        /// <summary>
-        /// Pushes a boolean literal to the BOOLEAN stack.
-        /// </summary>
-        BooleanPush,
-
-        /// <summary>
-        /// BOOLEAN.RAND:
-        /// Pushes a random BOOLEAN.
-        /// </summary>
-        BooleanRand,
-
-        /// <summary>
-        /// BOOLEAN.ROT
-        ///  Rotates the top three items on the BOOLEAN stack, pulling the third item out and pushing it on top. This is equivalent to "2 BOOLEAN.YANK".
-        /// </summary>
-        BooleanRot,
-
-        /// <summary>
-        /// BOOLEAN.SHOVE:
-        /// Inserts the top BOOLEAN "deep" in the stack, at the position indexed by the top INTEGER.
-        /// </summary>
-        BooleanShove,
-
-        /// <summary>
-        /// BOOLEAN.STACKDEPTH
-        /// Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        BooleanStackDepth,
-
-        /// <summary>
-        /// BOOLEAN.SWAP:
-        /// Swaps the top two BOOLEANs.
-        /// </summary>
-        BooleanSwap,
-
-        /// <summary>
-        /// BOOLEAN.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.
-        /// </summary>
-        BooleanYank,
-
-        /// <summary>
-        /// BOOLEAN.YANKDUP:
-        /// 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>
-        BooleanYankDuplicate,
-        #endregion Boolean
-
-        #region Code
-        /// <summary>
-        /// CODE.=:
-        /// Pushes TRUE if the top two pieces of CODE are equal, or FALSE otherwise.
-        /// </summary>
-        CodeEquals,
-
-        CodePush,
-
-        /// <summary>
-        /// CODE.APPEND:
-        /// 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,
-
-        /// <summary>
-        /// CODE.ATOM:
-        /// 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,
-
-        /// <summary>
-        /// CODE.CAR
-        /// Pushes the first item of the list on top of the CODE stack. For example, if the top piece of code is "( A B )" then this pushes "A" (after popping the argument). If the code on top of the stack is not a list then this has no effect. The name derives from the similar Lisp function; a more generic name would be "FIRST".
-        /// </summary>
-        CodeCar,
-
-        /// <summary>
-        /// CODE.CDR:
-        /// Pushes a version of the list from the top of the CODE stack without its first element. For example, if the top piece of code is "( A B )" then this pushes "( B )" (after popping the argument). If the code on top of the stack is not a list then this pushes the empty list ("( )"). The name derives from the similar Lisp function; a more generic name would be "REST".
-        /// </summary>
-        CodeCdr,
-
-        /// <summary>
-        /// CODE.CONS:
-        /// Pushes the result of "consing" (in the Lisp sense) the second stack item onto the first stack item (which is coerced to a list if necessary). For example, if the top piece of code is "( A B )" and the second piece of code is "X" then this pushes "( X A B )" (after popping the argument).
-        /// </summary>
-        CodeCons,
-
-        /// <summary>
-        /// CODE:CONTAINS:
-        /// Pushes the "container" of the second CODE stack item within the first CODE stack item onto the CODE stack. If second item contains the first anywhere (i.e. in any nested list) then the container is the smallest sub-list that contains but is not equal to the first instance. For example, if the top piece of code is "( B ( C ( A ) ) ( D ( A ) ) )" and the second piece of code is "( A )" then this pushes ( C ( A ) ). Pushes an empty list if there is no such container.
-        /// </summary>
-        CodeContainer,
-
-        /// <summary>
-        /// CODE.CONTAINS:
-        /// Pushes TRUE on the BOOLEAN stack if the second CODE stack item contains the first CODE stack item anywhere (e.g. in a sub-list).
-        /// </summary>
-        CodeContains,
-
-        /// <summary>
-        /// CODE.DEFINE:
-        /// 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,
-
-        /// <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 inclassion).
-        /// </summary>
-        CodeDefinition,
-
-        /// <summary>
-        /// 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. 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.
-        /// 4. Push the result.
-        /// </summary>
-        CodeDiscrepancy,
-
-        /// <summary>
-        /// CODE.DO:
-        /// Recursively invokes the interpreter on the program on top of the CODE stack. After evaluation the CODE stack is popped; normally this pops the program that was just executed, but if the expression itself manipulates the stack then this final pop may end up popping something else.
-        /// </summary>
-        CodeDo,
-
-        /// <summary>
-        /// CODE.DO*:
-        /// Like CODE.DO but pops the stack before, rather than after, the recursive execution.
-        /// </summary>
-        CodeDoX,
-
-        /// <summary>
-        /// CODE.DO*COUNT:
-        /// 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>
-        CodeDoXCount,
-
-        /// <summary>
-        /// CODE.DO*RANGE:
-        /// 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,
-
-        /// <summary>
-        /// CODE.DO*TIMES:
-        /// Like CODE.DO*COUNT but does not push the loop counter. This should be implemented as a macro that expands into CODE.DO*RANGE, similarly to the implementation of CODE.DO*COUNT, except that a call to INTEGER.POP should be tacked on to the front of the loop body code in the call to CODE.DO*RANGE. This call to INTEGER.POP will remove the loop counter, which will have been pushed by CODE.DO*RANGE, prior to the execution of the loop body.
-        /// </summary>
-        CodeDoXTimes,
-
-        /// <summary>
-        /// CODE.DUP:
-        /// 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/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,
-
-        /// <summary>
-        /// CODE.FLUSH:
-        /// Empties the CODE stack.
-        /// </summary>
-        CodeFlush,
-
-        /// <summary>
-        /// CODE.FROMBOOLEAN:
-        /// Pops the BOOLEAN stack and pushes the popped item (TRUE or FALSE) onto the CODE stack.
-        /// </summary>
-        CodeFromBoolean,
-
-        /// <summary>
-        /// CODE.FROMFLOAT:
-        /// Pops the FLOAT stack and pushes the popped item onto the CODE stack.
-        /// </summary>
-        CodeFromFloat,
-
-        /// <summary>
-        /// CODE.FROMINTEGER:
-        /// Pops the INTEGER stack and pushes the popped integer onto the CODE stack.
-        /// </summary>
-        CodeFromInteger,
-
-        /// <summary>
-        /// CODE.FROMNAME:
-        /// Pops the NAME stack and pushes the popped item onto the CODE stack.
-        /// </summary>
-        CodeFromName,
-
-        /// <summary>
-        /// CODE.IF:
-        /// If the top item of the BOOLEAN stack is TRUE this recursively executes the second item of the CODE stack; otherwise it recursively executes the first item of the CODE stack. Either way both elements of the CODE stack (and the BOOLEAN value upon which the decision was made) are popped.
-        /// </summary>
-        CodeIf,
-
-        /// <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.
-        /// </summary>
-        CodeInsert,
-
-        /// <summary>
-        /// CODE.INSTRUCTIONS:
-        /// Pushes a list of all active inclassions in the interpreter's current configuration.
-        /// </summary>
-        CodeInclassions,
-
-        /// <summary>
-        /// CODE.LENGTH:
-        /// Pushes the length of the top item on the CODE stack onto the INTEGER stack. If the top item is not a list then this pushes a 1. If the top item is a list then this pushes the number of items in the top level of the list; that is, nested lists contribute only 1 to this count, no matter what they contain.
-        /// </summary>
-        CodeLength,
-
-        /// <summary>
-        /// CODE.LIST: Pushes a list of the top two items of the CODE stack onto the CODE stack.
-        /// </summary>
-        CodeList,
-
-        /// <summary>
-        /// CODE.MEMBER:
-        /// Pushes TRUE onto the BOOLEAN stack if the second item of the CODE stack is a member of the first item (which is coerced to a list if necessary). Pushes FALSE onto the BOOLEAN stack otherwise.
-        /// </summary>
-        CodeMember,
-
-        /// <summary>
-        /// CODE.NOOP: Does nothing.
-        /// </summary>
-        CodeNoop,
-
-        /// <summary>
-        /// CODE:NTH:
-        /// Pushes the nth element of the expression on top of the CODE stack (which is coerced to a list first if necessary). If the expression is an empty list then the result is an empty list. N is taken from the INTEGER stack and is taken modulo the length of the expression into which it is indexing.
-        /// </summary>
-        CodeNth,
-
-        /// <summary>
-        /// CODE.NTHCDR:
-        /// Pushes the nth "CDR" (in the Lisp sense) of the expression on top of the CODE stack (which is coerced to a list first if necessary). If the expression is an empty list then the result is an empty list. N is taken from the INTEGER stack and is taken modulo the length of the expression into which it is indexing. A "CDR" of a list is the list without its first element.
-        /// </summary>
-        CodeNthCdr,
-
-        /// <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.
-        /// </summary>
-        CodeQuote,
-
-        /// <summary>
-        /// CODE.RAND: Pushes a newly-generated random program onto the CODE stack. The limit for the size of the expression is taken from the INTEGER stack; to ensure that it is in the appropriate range this is taken modulo the value of the MAX-POINTS-IN-RANDOM-EXPRESSIONS parameter and the absolute value of the result is used.
-        /// </summary>
-        CodeRand,
-
-        /// <summary>
-        /// CODE.ROT:
-        /// Rotates the top three items on the CODE stack, pulling the third item out and pushing it on top. This is equivalent to "2 CODE.YANK".
-        /// </summary>
-        CodeRot,
-
-        /// <summary>
-        /// CODE.SHOVE:
-        /// Inserts the top piece of CODE "deep" in the stack, at the position indexed by the top INTEGER.
-        /// </summary>
-        CodeShove,
-
-        /// <summary>
-        /// 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,
-
-        /// <summary>
-        /// CODE.STACKDEPTH: Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        CodeStackDepth,
-
-        /// <summary>
-        /// CODE.SUBST: Pushes the result of substituting the third item on the code stack for the second item in the first item. As of this writing this is implemented only in the Lisp implementation, within which it relies on the Lisp "subst" function. As such, there are several problematic possibilities; for example "dotted-lists" can result in certain cases with empty-list arguments. If any of these problematic possibilities occurs the stack is left unchanged.
-        /// </summary>
-        CodeSubst,
-
-        /// <summary>
-        /// CODE.SWAP:
-        /// Swaps the top two pieces of CODE.
-        /// </summary>
-        CodeSwap,
-
-        /// <summary>
-        /// CODE.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.
-        /// </summary>
-        CodeYank,
-
-        /// <summary>
-        /// CODE.YANKDUP:
-        /// 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>
-        CodeYankDuplicate,
-        #endregion Code
-
-        #region Exec
-        ExecExpand,
-
-        ExecPush,
-
-        /// <summary>
-        /// EXEC.=:
-        /// Pushes TRUE if the top two items on the EXEC stack are equal, or FALSE otherwise.
-        /// </summary>
-        ExecEquals,
-
-        /// <summary>
-        /// EXEC.DEFINE:
-        /// 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,
-
-        /// <summary>
-        /// EXEC.DO*COUNT:
-        /// 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>
-        ExecDoXCount,
-
-        /// <summary>
-        /// EXEC.DO*RANGE:
-        /// 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,
-
-        /// <summary>
-        /// EXEC.DO*TIMES:
-        /// Like EXEC.DO*COUNT but does not push the loop counter. This should be implemented as a macro that expands into EXEC.DO*RANGE, similarly to the implementation of EXEC.DO*COUNT, except that a call to INTEGER.POP should be tacked on to the front of the loop body code in the call to EXEC.DO*RANGE. This call to INTEGER.POP will remove the loop counter, which will have been pushed by EXEC.DO*RANGE, prior to the execution of the loop body.
-        /// </summary>
-        ExecDoXTimes,
-
-        /// <summary>
-        /// EXEC.DUP:
-        /// 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" inclassion.
-        /// </summary>
-        ExecFlush,
-
-        /// <summary>
-        /// EXEC.IF:
-        /// If the top item of the BOOLEAN stack is TRUE then this removes the second item on the EXEC stack, leaving the first item to be executed. If it is false then it removes the first item, leaving the second to be executed. This is similar to CODE.IF except that it operates on the EXEC stack. This acts as a NOOP unless there are at least two items on the EXEC stack and one item on the BOOLEAN stack.
-        /// </summary>
-        ExecIf,
-
-        /// <summary>
-        /// EXEC.K:
-        /// The Push implementation of the "K combinator". Removes the second item on the EXEC stack.
-        /// </summary>
-        ExecK,
-
-        /// <summary>
-        /// EXEC.POP: Pops the EXEC stack. This may be thought of as a "DONT" inclassion.
-        /// </summary>
-        ExecPop,
-
-        /// <summary>
-        /// EXEC.ROT:
-        /// Rotates the top three items on the EXEC stack, pulling the third item out and pushing it on top. This is equivalent to "2 EXEC.YANK".
-        /// </summary>
-        ExecRot,
-
-        /// <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" inclassion.
-        /// </summary>
-        ExecShove,
-
-        /// <summary>
-        /// EXEC.STACKDEPTH:
-        /// Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        ExecStackDepth,
-
-        /// <summary>
-        /// EXEC.SWAP:
-        /// Swaps the top two items on the EXEC stack.
-        /// </summary>
-        ExecSwap,
-
-        /// <summary>
-        /// EXEC.Y:
-        /// The Push implementation of the "Y combinator". Inserts beneath the top item of the EXEC stack a new item of the form "( EXEC.Y <TopItem> )".
-        /// </summary>
-        ExecY,
-
-        /// <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" inclassion.
-        /// </summary>
-        ExecYank,
-
-        /// <summary>
-        /// EXEC.YANKDUP:
-        /// 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>
-        ExecYankDuplicate,
-        #endregion Exec
-
-        #region Float
-        /// <summary>
-        /// FLOAT.%:
-        /// Pushes the second stack item modulo the top stack item. If the top item is zero this acts as a NOOP. The modulus is computed as the remainder of the quotient, where the quotient has first been truncated toward negative infinity. (This is taken from the definition for the generic MOD function in Common Lisp, which is described for example at
-        /// <see cref="http://www.lispworks.com/reference/HyperSpec/Body/f_mod_r.htm">HyperSpec</see>.)
-        /// </summary>
-        FloatModulo,
-
-        /// <summary>
-        /// FLOAT.*:
-        /// Pushes the product of the top two items.
-        /// </summary>
-        FloatMultiply,
-
-        /// <summary>
-        /// FLOAT.+:
-        /// Pushes the sum of the top two items.
-        /// </summary>
-        FloatAdd,
-
-        /// <summary>
-        /// FLOAT.-:
-        /// Pushes the difference of the top two items; that is, the second item minus the top item.
-        /// </summary>
-        FloatSubtract,
-
-        /// <summary>
-        /// FLOAT./:
-        /// Pushes the quotient of the top two items; that is, the second item divided by the top item. If the top item is zero this acts as a NOOP.
-        /// </summary>
-        FloatDivide,
-
-        /// <summary>
-        /// FLOAT.&lt;:
-        /// Pushes TRUE onto the BOOLEAN stack if the second item is less than the top item, or FALSE otherwise.
-        /// </summary>
-        FloatSmallerThan,
-
-        /// <summary>
-        /// FLOAT.=:
-        /// Pushes TRUE onto the BOOLEAN stack if the top two items are equal, or FALSE otherwise.
-        /// </summary>
-        FloatEquals,
-
-        /// <summary>
-        /// FLOAT.&gt;:
-        /// Pushes TRUE onto the BOOLEAN stack if the second item is greater than the top item, or FALSE otherwise.
-        /// </summary>
-        FloatGreaterThan,
-
-        /// <summary>
-        /// FLOAT.COS:
-        /// Pushes the cosine of the top item.
-        /// </summary>
-        FloatCos,
-
-        /// <summary>
-        /// FLOAT.DEFINE:
-        /// 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,
-
-        /// <summary>
-        /// FLOAT.DUP:
-        /// 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>
-        /// FLOAT.FLUSH:
-        /// Empties the FLOAT stack.
-        /// </summary>
-        FloatFlush,
-
-        /// <summary>
-        /// FLOAT.FROMBOOLEAN:
-        /// Pushes 1.0 if the top BOOLEAN is TRUE, or 0.0 if the top BOOLEAN is FALSE.
-        /// </summary>
-        FloatFromBoolean,
-
-        /// <summary>
-        /// FLOAT.FROMINTEGER:
-        /// Pushes a floating point version of the top INTEGER.
-        /// </summary>
-        FloatFromInteger,
-
-        /// <summary>
-        /// FLOAT.MAX:
-        /// Pushes the maximum of the top two items.
-        /// </summary>
-        FloatMax,
-
-        /// <summary>
-        /// FLOAT.MIN:
-        /// Pushes the minimum of the top two items.
-        /// </summary>
-        FloatMin,
-
-        /// <summary>
-        /// FLOAT.POP:
-        /// Pops the FLOAT stack.
-        /// </summary>
-        FloatPop,
-
-        /// <summary>
-        /// Pushes a floating point value to the FLOAT stack.
-        /// </summary>
-        FloatPush,
-
-        /// <summary>
-        /// FLOAT.RAND:
-        /// Pushes a newly generated random FLOAT that is greater than or equal to MIN-RANDOM-FLOAT and less than or equal to MAX-RANDOM-FLOAT.
-        /// </summary>
-        FloatRand,
-
-        /// <summary>
-        /// FLOAT.ROT:
-        /// Rotates the top three items on the FLOAT stack, pulling the third item out and pushing it on top. This is equivalent to "2 FLOAT.YANK".
-        /// </summary>
-        FloatRot,
-
-        /// <summary>
-        /// FLOAT.SHOVE:
-        /// Inserts the top FLOAT "deep" in the stack, at the position indexed by the top INTEGER.
-        /// </summary>
-        FloatShove,
-
-        /// <summary>
-        /// FLOAT.SIN:
-        /// Pushes the sine of the top item.
-        /// </summary>
-        FloatSin,
-
-        /// <summary>
-        /// FLOAT.STACKDEPTH:
-        /// Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        FloatStackDepth,
-
-        /// <summary>
-        /// FLOAT.SWAP:
-        /// Swaps the top two BOOLEANs.
-        /// </summary>
-        FloatSwap,
-
-        /// <summary>
-        /// FLOAT.TAN:
-        /// Pushes the tangent of the top item.
-        /// </summary>
-        FloatTan,
-
-        /// <summary>
-        /// FLOAT.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.
-        /// </summary>
-        FloatYank,
-
-        /// <summary>
-        /// FLOAT.YANKDUP:
-        /// 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>
-        FloatYankDuplicate,
-
-        #endregion Float
-
-        #region Integer
-
-        /// <summary>
-        /// FLOAT.%:
-        /// Pushes the second stack item modulo the top stack item. If the top item is zero this acts as a NOOP. The modulus is computed as the remainder of the quotient, where the quotient has first been truncated toward negative infinity. (This is taken from the definition for the generic MOD function in Common Lisp, which is described for example at
-        /// <see cref="http://www.lispworks.com/reference/HyperSpec/Body/f_mod_r.htm">HyperSpec</see>.)
-        /// </summary>
-        IntegerModulo,
-
-        /// <summary>
-        /// INTEGER.*:
-        /// Pushes the product of the top two items.
-        /// </summary>
-        IntegerMultiply,
-
-        /// <summary>
-        /// INTEGER.+:
-        /// Pushes the sum of the top two items.
-        /// </summary>
-        IntegerAdd,
-
-        /// <summary>
-        /// INTEGER.-:
-        /// Pushes the difference of the top two items; that is, the second item minus the top item.
-        /// </summary>
-        IntegerSubtract,
-
-        /// <summary>
-        /// INTEGER./:
-        /// Pushes the quotient of the top two items; that is, the second item divided by the top item. If the top item is zero this acts as a NOOP.
-        /// </summary>
-        IntegerDivide,
-
-        /// <summary>
-        /// INTEGER.&lt;:
-        /// Pushes TRUE onto the BOOLEAN stack if the second item is less than the top item, or FALSE otherwise.
-        /// </summary>
-        IntegerSmallerThan,
-
-        /// <summary>
-        /// INTEGER.=:
-        /// Pushes TRUE onto the BOOLEAN stack if the top two items are equal, or FALSE otherwise.
-        /// </summary>
-        IntegerEquals,
-
-        /// <summary>
-        /// INTEGER.&gt;:
-        /// Pushes TRUE onto the BOOLEAN stack if the second item is greater than the top item, or FALSE otherwise.
-        /// </summary>
-        IntegerGreaterThan,
-
-        /// <summary>
-        /// INTEGER.DEFINE:
-        /// 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,
-
-        /// <summary>
-        /// INTEGER.DUP:
-        /// 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>
-        /// INTEGER.FLUSH:
-        /// Empties the INTEGER stack.
-        /// </summary>
-        IntegerFlush,
-
-        /// <summary>
-        /// INTEGER.FROMBOOLEAN:
-        /// Pushes 1.0 if the top BOOLEAN is TRUE, or 0.0 if the top BOOLEAN is FALSE.
-        /// </summary>
-        IntegerFromBoolean,
-
-        /// <summary>
-        /// INTEGER.FROMFLOAT:
-        /// Pushes the result of truncating the top FLOAT.
-        /// </summary>
-        IntegerFromFloat,
-
-        /// <summary>
-        /// INTEGER.MAX:
-        /// Pushes the maximum of the top two items.
-        /// </summary>
-        IntegerMax,
-
-        /// <summary>
-        /// INTEGER.MIN:
-        /// Pushes the minimum of the top two items.
-        /// </summary>
-        IntegerMin,
-
-        /// <summary>
-        /// INTEGER.POP:
-        /// Pops the INTEGER stack.
-        /// </summary>
-        IntegerPop,
-
-        /// <summary>
-        /// Pushes a integer literal to the INTEGER stack
-        /// </summary>
-        IntegerPush,
-
-        /// <summary>
-        /// INTEGER.RAND:
-        /// Pushes a newly generated random INTEGER that is greater than or equal to MIN-RANDOM-INTEGER and less than or equal to MAX-RANDOM-INTEGER.
-        /// </summary>
-        IntegerRand,
-
-        /// <summary>
-        /// INTEGER.ROT:
-        /// Rotates the top three items on the INTEGER stack, pulling the third item out and pushing it on top. This is equivalent to "2 INTEGER.YANK".
-        /// </summary>
-        IntegerRot,
-
-        /// <summary>
-        /// INTEGER.SHOVE:
-        /// Inserts the top INTEGER "deep" in the stack, at the position indexed by the top INTEGER.
-        /// </summary>
-        IntegerShove,
-
-        /// <summary>
-        /// INTEGER.STACKDEPTH:
-        /// Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        IntegerStackDepth,
-
-        /// <summary>
-        /// INTEGER.SWAP:
-        /// Swaps the top two BOOLEANs.
-        /// </summary>
-        IntegerSwap,
-
-        /// <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.
-        /// </summary>
-        IntegerYank,
-
-        /// <summary>
-        /// INTEGER.YANKDUP:
-        /// 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>
-        IntegerYankDuplicate,
-
-        #endregion Integer
-
-        #region Name
-
-        NamePush,
-
-        /// <summary>
-        /// Pushes a floating point value to the FLOAT stack.
-        /// </summary>
-        NameDefineXExec,
-
-        /// <summary>
-        /// NAME.=:
-        /// Pushes TRUE if the top two NAMEs are equal, or FALSE otherwise.
-        /// </summary>
-        NameEquals,
-
-        /// <summary>
-        /// NAME.DUP:
-        /// 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>
-        /// NAME.FLUSH:
-        /// Empties the NAME stack.
-        /// </summary>
-        NameFlush,
-
-        /// <summary>
-        /// NAME.POP: Pops the NAME stack.
-        /// </summary>
-        NamePop,
-
-        /// <summary>
-        /// NAME.QUOTE:
-        /// Sets a flag indicating that the next name encountered will be pushed onto the NAME stack (and not have its associated value pushed onto the EXEC stack), regardless of whether or not it has a definition. Upon encountering such a name and pushing it onto the NAME stack the flag will be cleared (whether or not the pushed name had a definition).
-        /// </summary>
-        NameQuote,
-
-        /// <summary>
-        /// NAME.RAND:
-        /// Pushes a newly generated random NAME.
-        /// </summary>
-        NameRand,
-
-        /// <summary>
-        /// NAME.RANDBOUNDNAME:
-        /// Pushes a randomly selected NAME that already has a definition.
-        /// </summary>
-        NameRandBoundName,
-
-        /// <summary>
-        /// NAME.ROT:
-        /// Rotates the top three items on the NAME stack, pulling the third item out and pushing it on top. This is equivalent to "2 NAME.YANK".
-        /// </summary>
-        NameRot,
-
-        /// <summary>
-        /// NAME.SHOVE:
-        /// Inserts the top NAME "deep" in the stack, at the position indexed by the top INTEGER.
-        /// </summary>
-        NameShove,
-
-        /// <summary>
-        /// NAME.STACKDEPTH:
-        /// Pushes the stack depth onto the INTEGER stack.
-        /// </summary>
-        NameStackDepth,
-
-        /// <summary>
-        /// NAME.SWAP:
-        /// Swaps the top two NAMEs.
-        /// </summary>
-        NameSwap,
-
-        /// <summary>
-        /// NAME.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.
-        /// </summary>
-        NameYank,
-
-        /// <summary>
-        /// NAME.YANKDUP:
-        /// 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>
-        NameYankDuplicate,
-        #endregion Name
-    }
-}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCodeExtensions.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCodeExtensions.cs	(revision 14391)
+++ 	(revision )
@@ -1,11 +1,0 @@
-﻿using System;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.PushGP
-{
-    public static class OpCodeExtensions
-    {
-        public const byte Min = 0;
-        public readonly static byte Max = Enum.GetValues(typeof(OpCode)).Cast<byte>().Last();
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/Parser.cs	(revision 14392)
@@ -2,10 +2,4 @@
 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
@@ -51,7 +45,5 @@
                 {
                     endIndex = i;
-                    return expressions.Count != 0
-                        ? new ExecExpandExpression(expressions.ToArray())
-                        : new CodeNoopExpression() as Expression;
+                    return new ExecExpandExpression(expressions.ToArray());
                 }
 
@@ -65,8 +57,7 @@
 
                 // expression
-                OpCode opCode;
-                if (SymbolTable.TryGetOpCode(symbol, out opCode))
+                if (ExpressionTable.TryGetStatelessExpression(symbol, out expression) ||
+                    ExpressionTable.TryGetStatefullExpression(symbol, out expression))
                 {
-                    expression = ExpressionFactory.Create(opCode);
                     expressions.Insert(0, expression);
                     continue;
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/SymbolTable.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Parser/SymbolTable.cs	(revision 14391)
+++ 	(revision )
@@ -1,178 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.PushGP
-{
-    public static class SymbolTable
-    {
-        private static Dictionary<string, OpCode> symbolTable = new Dictionary<string, OpCode>
-        {
-            #region Code
-            { 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
-            { 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
-            { 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
-            { 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
-            { 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
-            { 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
-        };
-
-        public static OpCode GetOpCode(string operationName)
-        {
-            OpCode opCode;
-            if (symbolTable.TryGetValue(operationName, out opCode)) return opCode;
-            else throw new NotSupportedException("Operation not supported: " + operationName);
-        }
-
-        public static bool TryGetOpCode(string operationName, out OpCode opCode)
-        {
-            return symbolTable.TryGetValue(operationName, out opCode);
-        }
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/IStack.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/IStack.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/IStack.cs	(revision 14392)
@@ -1,3 +1,4 @@
-﻿using System.Collections.Generic;
+﻿using System;
+using System.Collections.Generic;
 
 namespace HeuristicLab.Algorithms.PushGP.Stack
@@ -5,26 +6,29 @@
     public interface IStack<T> : IEnumerable<T>, ICollection<T>
     {
+        void Swap(int count);
+        void Yank(int index);
         bool IsEmpty { get; }
         void Push(T item);
-
         void Push(params T[] items);
-
         void Push(IEnumerable<T> items);
-
+        void PushResult(int count, Func<T[], T> templateFunc);
         void Insert(int index, T item);
-
         void Insert(int index, params T[] items);
-
         void Insert(int index, IEnumerable<T> items);
-
+        T ReverseElementAt(int offset);
+        void SetTop(T value);
+        void RemoveTop();
+        void Remove(int count);
+        void RemoveAt(int index);
+        void RemoveAt(int index, int count);
         T Pop();
-
         T[] Pop(int count);
-
         bool TryPop(out T item);
-
         T ElementAt(int index);
-
         T Top { get; }
+        T TopOrDefault { get; }
+        T Bottom { get; }
+        T BottomOrDefault { get; }
+        T this[int key] { get; set; }
     }
 }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Stack/PushGPStack.cs	(revision 14392)
@@ -2,5 +2,4 @@
 using System.Collections;
 using System.Collections.Generic;
-using System.Text;
 
 namespace HeuristicLab.Algorithms.PushGP.Stack
@@ -17,5 +16,5 @@
     {
         private readonly List<T> data;
-        private const string delimiter = " ";
+        private const string Delimiter = " ";
 
         public PushGPStack(int capacity = 0)
@@ -25,15 +24,12 @@
 
         public T Top { get { return this.data[Count - 1]; } }
+        public T TopOrDefault { get { return Count > 0 ? this.data[Count - 1] : default(T); } }
+        public T Bottom { get { return this.data[0]; } }
+        public T BottomOrDefault { get { return Count > 0 ? this.data[0] : default(T); } }
         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
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
+        public bool IsReadOnly { get { return false; } }
 
         public void Add(T item)
@@ -65,4 +61,41 @@
         {
             return this.data[index];
+        }
+
+
+        public T ReverseElementAt(int offset)
+        {
+            return this.data[this.Count - 1 - offset];
+        }
+
+        public void SetTop(T value)
+        {
+            this.data[Count - 1] = value;
+        }
+
+        public T this[int key]
+        {
+            get { return this.data[key]; }
+            set { this.data[key] = value; }
+        }
+
+        public void Swap(int count)
+        {
+            var top = this.Top;
+            var bottomIndex = this.Count - count;
+
+            for (var i = this.Count - 1; i > bottomIndex; i--)
+            {
+                this.data[i] = this.data[i - 1];
+            }
+
+            this.data[bottomIndex] = top;
+        }
+
+        public void Yank(int index)
+        {
+            var item = this.ElementAt(index);
+            this.data.RemoveAt(index);
+            this.data.Add(item);
         }
 
@@ -78,15 +111,10 @@
         {
             var startIndex = Count - count;
-            var items = this.data.GetRange(startIndex, count);
-
-            this.data.RemoveRange(startIndex, count);
-
-            // is faster than remove range??
-            for (var i = this.Count - 1; i > startIndex - 1; i--)
-            {
-                this.data.RemoveAt(i);
-            }
-
-            return items.ToArray();
+
+            var items = new T[count];
+            this.data.CopyTo(startIndex, items, 0, count);
+            this.Remove(count);
+
+            return items;
         }
 
@@ -96,9 +124,28 @@
         }
 
+        public void Push(object[] items)
+        {
+            for (var i = 0; i < items.Length; i++)
+            {
+                this.data.Add((T)items[i]);
+            }
+        }
+
+        public void PushResult(int count, Func<T[], T> templateFunc)
+        {
+            var startIndex = Count - count;
+            var items = new T[count];
+
+            this.data.CopyTo(startIndex, items, 0, count);
+            this.Remove(count - 1);
+
+            this.data[Count - 1] = templateFunc(items);
+        }
+
         public void Push(params T[] items)
         {
-            foreach (var item in items)
-            {
-                this.data.Add(item);
+            for (var i = 0; i < items.Length; i++)
+            {
+                this.data.Add(items[i]);
             }
         }
@@ -138,4 +185,27 @@
         }
 
+        public void RemoveTop()
+        {
+            this.data.RemoveAt(this.Count - 1);
+        }
+
+        public void Remove(int count)
+        {
+            for (var i = 0; i < count; i++)
+            {
+                this.data.RemoveAt(Count - 1);
+            }
+        }
+
+        public void RemoveAt(int index)
+        {
+            this.data.RemoveAt(index);
+        }
+
+        public void RemoveAt(int index, int count)
+        {
+            this.data.RemoveRange(index, count);
+        }
+
         public bool TryPop(out T item)
         {
@@ -159,19 +229,5 @@
         public override string ToString()
         {
-            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();
+            return string.Join(Delimiter, this.data);
         }
     }
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/StateFullExpressionAttribute.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/StateFullExpressionAttribute.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/StateFullExpressionAttribute.cs	(revision 14392)
@@ -0,0 +1,11 @@
+﻿using System;
+
+namespace HeuristicLab.Algorithms.PushGP
+{
+    /// <summary>
+    /// Marker attribute so the expression table knows which expression must be index during initialization
+    /// </summary>
+    public class StatefullExpressionAttribute : Attribute
+    {
+    }
+}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Symbols.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Symbols.cs	(revision 14391)
+++ 	(revision )
@@ -1,173 +1,0 @@
-﻿namespace HeuristicLab.Algorithms.PushGP
-{
-    public static class Symbols
-    {
-        #region Code
-        public const string CodePush = "CODE.PUSH";
-        public const string CodeIf = "CODE.IF";
-        public const string CodeDefine = "CODE.DEFINE";
-        public const string CodeDuplicate = "CODE.DUP";
-        public const string CodeQuote = "CODE.QUOTE";
-        public const string CodeDo = "CODE.DO";
-
-        public const string CodeEquals = "CODE.=";
-        public const string CodeAppend = "CODE.APPEND";
-        public const string CodeAtom = "CODE.ATOM";
-        public const string CodeCar = "CODE.CAR";
-        public const string CodeCdr = "CODE.CDR";
-        public const string CodeCons = "CODE.CONS";
-        public const string CodeContainer = "CODE.CONTAINER";
-        public const string CodeContains = "CODE.CONTAINS";
-        public const string CodeDefinition = "CODE.DEFINITION";
-        public const string CodeDiscrepancy = "CODE.DISCREPANCY";
-        public const string CodeDoX = "CODE.DO*";
-        public const string CodeDoXCount = "CODE.DO*COUNT";
-        public const string CodeDoXRange = "CODE.DO*RANGE";
-        public const string CodeDoXTimes = "CODE.DO*TIMES";
-        public const string CodeExtract = "CODE.EXTRACT";
-        public const string CodeFlush = "CODE.FLUSH";
-        public const string CodeFromFloat = "CODE.FROMFLOAT";
-        public const string CodeFromInteger = "CODE.FROMINTEGER";
-        public const string CodeFromName = "CODE.FROMNAME";
-        public const string CodeInsert = "CODE.INSERT";
-        public const string CodeInstructions = "CODE.INSTRUCTIONS";
-        public const string CodeLength = "CODE.LENGTH";
-        public const string CodeList = "CODE.LIST";
-        public const string CodeMember = "CODE.MEMBER";
-        public const string CodeNoop = "CODE.NOOP";
-        public const string CodeNth = "CODE.NTH";
-        public const string CodeNthCdr = "CODE.NTHCDR";
-        public const string CodeNull = "CODE.NULL";
-        public const string CodePosition = "CODE.POSITION";
-        public const string CodeRand = "CODE.RAND";
-        public const string CodeRot = "CODE.ROT";
-        public const string CodeShove = "CODE.SHOVE";
-        public const string CodeSize = "CODE.SIZE";
-        public const string CodeStackDepth = "CODE.STACKDEPTH";
-        public const string CodeSubst = "CODE.SUBST";
-        public const string CodeSwap = "CODE.SWAP";
-        public const string CodeYank = "CODE.YANK";
-        public const string CodeYankDuplicate = "CODE.YANKDUP";
-        #endregion Code
-
-        #region Exec
-        public const string ExecExpand = "EXEC.EXPAND";
-        public const string ExecPush = "EXEC.PUSH";
-        public const string ExecIf = "EXEC.IF";
-        public const string ExecDefine = "EXEC.DEFINE";
-        public const string ExecDuplicate = "EXEC.DUP";
-        public const string ExecPop = "EXEC.POP";
-        public const string ExecY = "EXEC.Y";
-        public const string ExecDoXRange = "EXEC.DO*RANGE";
-
-        public const string ExecEquals = "EXEC.=";
-        public const string ExecDoXCount = "EXEC.DO*COUNT";
-        public const string ExecDoXTimes = "EXEC.DO*TIMES";
-        public const string ExecFlush = "EXEC.FLUSH";
-        public const string ExecK = "EXEC.K";
-        public const string ExecRot = "EXEC.ROT";
-        public const string ExecS = "EXEC.S";
-        public const string ExecShove = "EXEC.SHOVE";
-        public const string ExecStackDepth = "EXEC.StackDepth";
-        public const string ExecSwap = "EXEC.SWAP";
-        public const string ExecYank = "EXEC.YANK";
-        public const string ExecYankDuplicate = "EXEC.YANKDUP";
-        #endregion Exec
-
-        #region Name
-        public const string NamePop = "NAME.POP";
-        public const string NameDuplicate = "NAME.DUP";
-
-        public const string NameEquals = "NAME.=";
-        public const string NameFlush = "NAME.FLUSH";
-        public const string NameQuote = "NAME.QUOTE";
-        public const string NameRand = "NAME.RAND";
-        public const string NameRandBoundName = "NaME.RANDBOUNDNAME";
-        public const string NameRot = "NAME.ROT";
-        public const string NameShove = "NAME.SHOVE";
-        public const string NameStackDepth = "NAME.STACKDEPTH";
-        public const string NameSwap = "NAME.SWAP";
-        public const string NameYank = "NAME.YANK";
-        public const string NameYankDuplicate = "NAME.YANKDUP";
-        #endregion Name
-
-        #region Boolean
-        public const string BooleanDefine = "BOOLEAN.DEFINE";
-        public const string BooleanPush = "BOOLEAN.PUSH";
-        public const string BooleanPop = "BOOLEAN.POP";
-        public const string BooleanDuplicate = "BOOLEAN.DUP";
-        public const string BooleanAnd = "BOOLEAN.AND";
-        public const string BooleanOr = "BOOLEAN.OR";
-
-        public const string BooleanEquals = "BOOLEAN.=";
-        public const string BooleanFlush = "BOOLEAN.FLUSH";
-        public const string BooleanFromFloat = "BOOLEAN.FROMFLOAT";
-        public const string BooleanFromInteger = "BOOLEAN.FROMINTEGER";
-        public const string BooleanNot = "BOOLEAN.NOT";
-        public const string BooleanRand = "BOOLEAN.RAND";
-        public const string BooleanRot = "BOOLEAN.ROT";
-        public const string BooleanShove = "BOOLEAN.SHOVE";
-        public const string BooleanStackDepth = "BOOLEAN.STACKDEPTH";
-        public const string BooleanSwap = "BOOLEAN.SWAP";
-        public const string BooleanYank = "BOOLEAN.YANK";
-        public const string BooleanYankDuplicate = "BOOLEAN.YANKDUP";
-        #endregion Boolean
-
-        #region Integer
-        public const string IntegerDuplicate = "INTEGER.DUP";
-        public const string IntegerPop = "INTEGER.POP";
-        public const string IntegerDefine = "INTEGER.DEFINE";
-        public const string IntegerAdd = "INTEGER.+";
-        public const string IntegerSubtract = "INTEGER.-";
-        public const string IntegerMultiply = "INTEGER.*";
-        public const string IntegerDivide = "INTEGER./";
-        public const string IntegerSmallerThan = "INTEGER.<";
-        public const string IntegerGreaterThan = "INTEGER.>";
-        public const string IntegerEquals = "INTEGER.=";
-        public const string IntegerMin = "INTEGER.MIN";
-        public const string IntegerMax = "INTEGER.MAX";
-
-        public const string IntegerModulo = "INTEGER.%";
-        public const string IntegerFlush = "INTEGER.FLUSH";
-        public const string IntegerFromBoolean = "INTEGER.FROMBOOLEAN";
-        public const string IntegerFromFloat = "INTEGER.FROMFLOAT";
-        public const string IntegerRand = "INTEGER.RAND";
-        public const string IntegerRot = "INTEGER.ROT";
-        public const string IntegerShove = "INTEGER.SHOVE";
-        public const string IntegerStackDepth = "INTEGER.STACKDPETH";
-        public const string IntegerSwap = "INTEGER.SWAP";
-        public const string IntegerYank = "INTEGER.YANK";
-        public const string IntegerYankDuplicate = "INTEGER.YANKDUP";
-        #endregion Integer
-
-        #region Float
-        public const string FloatDuplicate = "FLOAT.DUP";
-        public const string FloatPop = "FLOAT.POP";
-        public const string FloatDefine = "FLOAT.DEFINE";
-        public const string FloatAdd = "FLOAT.+";
-        public const string FloatSubtract = "FLOAT.-";
-        public const string FloatMultiply = "FLOAT.*";
-        public const string FloatDivide = "FLOAT./";
-        public const string FloatSmallerThan = "FLOAT.<";
-        public const string FloatGreaterThan = "FLOAT.>";
-        public const string FloatEquals = "FLOAT.=";
-        public const string FloatMin = "FLOAT.MIN";
-        public const string FloatMax = "FLOAT.MAX";
-
-        public const string FloatCos = "FLOAT.COS";
-        public const string FloatSin = "FLOAT.SIN";
-        public const string FloatTan = "FLOAT.TAN";
-        public const string FloatModulo = "FLOAT.%";
-        public const string FloatFlush = "FLOAT.FLUSH";
-        public const string FloatFromBoolean = "FLOAT.FROMBOOLEAN";
-        public const string FloatFromInteger = "FLOAT.FROMINTEGER";
-        public const string FloatRand = "FLOAT.RAND";
-        public const string FloatRot = "FLOAT.ROT";
-        public const string FloatShove = "FLOAT.SHOVE";
-        public const string FloatStackDepth = "FLOAT.STACKDPETH";
-        public const string FloatSwap = "FLOAT.SWAP";
-        public const string FloatYank = "FLOAT.YANK";
-        public const string FloatYankDuplicate = "FLOAT.YANKDUP";
-        #endregion Float
-    }
-}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/ArtificialDataDescriptor.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/ArtificialDataDescriptor.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/ArtificialDataDescriptor.cs	(revision 14392)
@@ -0,0 +1,13 @@
+﻿using System.Collections.Generic;
+using HeuristicLab.Problems.Instances;
+
+namespace HeuristicLab.BenchmarkSuite
+{
+    public abstract class ArtificialDataDescriptor : IDataDescriptor
+    {
+        public abstract string Description { get; }
+        public abstract string Name { get; }
+
+        protected abstract IEnumerable<Example> GenerateExamples();
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs	(revision 14392)
@@ -0,0 +1,31 @@
+﻿using System.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.BenchmarkSuite
+{
+    public abstract class BenchmarkSuiteDataDescritpor<T> : ArtificialDataDescriptor
+    {
+        protected static IRandom rand = new FastRandom();
+
+        protected abstract IEnumerable<T> GenerateTraining();
+        protected abstract IEnumerable<T> GenerateTest();
+
+        protected abstract IEnumerable<Example> GenerateExamples(IEnumerable<T> trainingAndTest);
+
+        protected override IEnumerable<Example> GenerateExamples()
+        {
+            var training = GenerateTraining();
+
+            training = training.Shuffle(rand);
+
+            var test = GenerateTest();
+
+            var all = new List<T>();
+            all.AddRange(training);
+            all.AddRange(test);
+
+            return GenerateExamples(all);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Example.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Example.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Example.cs	(revision 14392)
@@ -0,0 +1,8 @@
+﻿namespace HeuristicLab.BenchmarkSuite
+{
+    public class Example
+    {
+        public string Input { get; set; }
+        public string Output { get; set; }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj	(revision 14392)
@@ -0,0 +1,101 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.BenchmarkSuite</RootNamespace>
+    <AssemblyName>HeuristicLab.BenchmarkSuite</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </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.Problems.Instances-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-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" />
+  </ItemGroup>
+  <Choose>
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+      </ItemGroup>
+    </When>
+    <Otherwise>
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+      </ItemGroup>
+    </Otherwise>
+  </Choose>
+  <ItemGroup>
+    <Compile Include="ArtificialDataDescriptor.cs" />
+    <Compile Include="BenchmarkSuiteDataDescriptor.cs" />
+    <Compile Include="Example.cs" />
+    <Compile Include="Problems\CountOdds.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Data\" />
+  </ItemGroup>
+  <Choose>
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+      </ItemGroup>
+    </When>
+  </Choose>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Problems/CountOdds.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Problems/CountOdds.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Problems/CountOdds.cs	(revision 14392)
@@ -0,0 +1,145 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.BenchmarkSuite.Problems
+{
+    public class CountOdds : BenchmarkSuiteDataDescritpor<List<int>>
+    {
+        public const int MaxOdd = 999;
+        public const int MaxEven = 1000;
+        public const int MaxRandom = 1000;
+        public const int MinRandom = 1000;
+        public const int MaxVectorLength = 50;
+
+        public override string Description { get { return String.Empty; } }
+
+        public override string Name { get { return "Count Odds"; } }
+
+        protected override IEnumerable<Example> GenerateExamples(IEnumerable<List<int>> inputData)
+        {
+            foreach (var input in inputData)
+            {
+                yield return new Example()
+                {
+                    Input = string.Format("[{0}]", string.Join(", ", input)),
+                    Output = input.Count(x => x % 2 == 1).ToString()
+                };
+            }
+        }
+
+        protected override IEnumerable<List<int>> GenerateTest()
+        {
+            foreach (var list in this.GetHardcodedTrainingSamples())
+                yield return list;
+
+            foreach (var list in this.GetAllOdd(n: 100))
+                yield return list;
+
+            foreach (var list in this.GetAllEven(n: 100))
+                yield return list;
+
+            foreach (var list in this.GetRandom(n: 1800))
+                yield return list;
+        }
+
+        protected override IEnumerable<List<int>> GenerateTraining()
+        {
+            foreach (var list in this.GetHardcodedTrainingSamples())
+                yield return list;
+
+            foreach (var list in this.GetAllOdd(n: 9))
+                yield return list;
+
+            foreach (var list in this.GetAllEven(n: 9))
+                yield return list;
+
+            foreach (var list in this.GetRandom(n: 150))
+                yield return list;
+        }
+
+        private IEnumerable<List<int>> GetAllOdd(int n)
+        {
+            for (var i = 0; i < n; i++)
+            {
+                var length = rand.Next(0, MaxVectorLength);
+                var vector = new List<int>(length);
+
+                for (var j = 0; j < length; j++)
+                {
+                    vector.Add(rand.Next(0, MaxOdd) * 2 - MaxOdd);
+                }
+
+                yield return vector;
+            }
+        }
+
+        private IEnumerable<List<int>> GetAllEven(int n)
+        {
+            for (var i = 0; i < n; i++)
+            {
+                var length = rand.Next(0, MaxVectorLength);
+                var vector = new List<int>(length);
+
+                for (var j = 0; j < length; j++)
+                {
+                    vector.Add(rand.Next(0, MaxEven) * 2 - MaxEven);
+                }
+
+                yield return vector;
+            }
+        }
+
+        private IEnumerable<List<int>> GetRandom(int n)
+        {
+            for (var i = 0; i < n; i++)
+            {
+                var length = rand.Next(0, MaxVectorLength);
+                var vector = new List<int>(length);
+
+                for (var j = 0; j < length; j++)
+                {
+                    vector.Add(rand.Next(MinRandom, MaxRandom));
+                }
+
+                yield return vector;
+            }
+        }
+
+        private IEnumerable<List<int>> GetHardcodedTrainingSamples()
+        {
+            yield return new List<int>() { };
+            yield return new List<int>() { -10 };
+            yield return new List<int>() { -9 };
+            yield return new List<int>() { -8 };
+            yield return new List<int>() { -7 };
+            yield return new List<int>() { -6 };
+            yield return new List<int>() { -5 };
+            yield return new List<int>() { -4 };
+            yield return new List<int>() { -3 };
+            yield return new List<int>() { -2 };
+            yield return new List<int>() { -1 };
+            yield return new List<int>() { -0 };
+            yield return new List<int>() { 1 };
+            yield return new List<int>() { 2 };
+            yield return new List<int>() { 3 };
+            yield return new List<int>() { 4 };
+            yield return new List<int>() { 5 };
+            yield return new List<int>() { 6 };
+            yield return new List<int>() { 7 };
+            yield return new List<int>() { 8 };
+            yield return new List<int>() { 9 };
+            yield return new List<int>() { 10 };
+            yield return new List<int>() { -947 };
+            yield return new List<int>() { -450 };
+            yield return new List<int>() { 303 };
+            yield return new List<int>() { 886 };
+            yield return new List<int>() { 0, 0 };
+            yield return new List<int>() { 0, 1 };
+            yield return new List<int>() { 7, 1 };
+            yield return new List<int>() { -9, -1 };
+            yield return new List<int>() { -11, 40 };
+            yield return new List<int>() { 944, 77 };
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Properties/AssemblyInfo.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Properties/AssemblyInfo.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.BenchmarkSuite/Properties/AssemblyInfo.cs	(revision 14392)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.BenchmarkSuite")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab.BenchmarkSuite")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("22b5c087-cfc7-4d40-86c6-32fcf2ca921e")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Example.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Example.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Example.cs	(revision 14392)
@@ -0,0 +1,8 @@
+﻿namespace HeuristicLab.Tests.Benchmark
+{
+    public class Example<Tin, Tout>
+    {
+        public Tin Input { get; set; }
+        public Tout Output { get; set; }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/ExampleConverter.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/ExampleConverter.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/ExampleConverter.cs	(revision 14392)
@@ -0,0 +1,38 @@
+﻿using System;
+using System.Linq;
+
+namespace HeuristicLab.Tests.Benchmark
+{
+    public static class ExampleConverter
+    {
+        private const char ArrayValueSeparator = ' ';
+
+        private static readonly char[] arraySymbolTrim = new[] { '[', ']' };
+
+        public static Converter<string, long> Integer = new Converter<string, long>(GetInteger);
+        public static Converter<string, long[]> Integers = new Converter<string, long[]>(GetIntegers);
+
+        public static long GetInteger(string str)
+        {
+            return long.Parse(str);
+        }
+
+        public static long[] GetIntegers(string str)
+        {
+            var values = str
+                .Trim(arraySymbolTrim)
+                .Split(ArrayValueSeparator)
+                .Where(s => !string.IsNullOrWhiteSpace(s))
+                .ToList();
+
+            var result = new long[values.Count];
+
+            for (var i = 0; i < result.Length; i++)
+            {
+                result[i] = GetInteger(values[i]);
+            }
+
+            return result;
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/CountOdds.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/CountOdds.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/CountOdds.cs	(revision 14392)
@@ -0,0 +1,72 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using HeuristicLab.Algorithms.PushGP.Interpreter;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Benchmark.Problem
+{
+    [TestClass]
+    public class CountOdds : Problem<long[], long>
+    {
+        public const string ProblemFileName = "examples-count-odds.csv";
+
+        public CountOdds()
+        {
+            this.Examples = this.GetExamples(ProblemFileName, ExampleConverter.Integers, ExampleConverter.Integer);
+        }
+
+        [TestMethod]
+        public void RandomWalk()
+        {
+            var interpreter = new PushGPInterpreter(new Configuration
+            {
+                EvalPushLimit = 10000
+            });
+
+            var limit = 1000;
+            var iterations = 3000;
+            var best = double.MaxValue;
+
+            for (var i = 0; i < iterations; i++)
+            {
+                var program = interpreter.CodeGenerator.RandomProgram(limit);
+
+                var results = new List<long>();
+
+                foreach (var example in this.Examples)
+                {
+                    if (example.Input.Length > 0)
+                    {
+                        interpreter.IntegerStack.Push(example.Input);
+                    }
+
+                    interpreter.Interpret(program);
+
+                    if (!interpreter.IntegerStack.IsEmpty)
+                    {
+                        var value = Math.Abs(example.Output - interpreter.IntegerStack.Top);
+
+                        results.Add(Math.Min(value, 1000));
+                    }
+                }
+
+
+                if (!results.Any())
+                    continue;
+
+                var avg = results.Average();
+
+                if (avg < best)
+                {
+                    best = avg;
+                }
+
+                interpreter.Clear();
+            }
+
+            Debug.WriteLine("Best: {0}", best);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/Problem.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/Problem.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Benchmark/Problem/Problem.cs	(revision 14392)
@@ -0,0 +1,70 @@
+﻿using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+
+namespace HeuristicLab.Tests.Benchmark.Problem
+{
+    public class Problem<Tin, Tout>
+    {
+        public const char ExampleSeparator = ',';
+        public const string ArchiveFileName = "BenchmarkExamples.zip";
+
+        private static string instanceArchiveName = GetResourceName(ArchiveFileName);
+
+        protected List<Example<Tin, Tout>> Examples { get; set; }
+
+        protected List<Example<Tin, Tout>> GetExamples(string problemName, Converter<string, Tin> inputConverter, Converter<string, Tout> outputConverter)
+        {
+            using (var file = GetType().Assembly.GetManifestResourceStream(instanceArchiveName))
+            using (var archive = new ZipArchive(file, ZipArchiveMode.Read))
+            {
+                var entry = archive.Entries.SingleOrDefault(x => x.Name == problemName);
+
+                using (var reader = new StreamReader(entry.Open()))
+                {
+                    var examples = new List<Example<Tin, Tout>>();
+
+                    // skip training headline
+                    if (reader.Peek() >= 0)
+                    {
+                        reader.ReadLine();
+                    }
+
+                    while (reader.Peek() >= 0)
+                    {
+                        var line = reader.ReadLine();
+
+                        // return
+                        if (line.StartsWith("test"))
+                        {
+                            break;
+                        }
+
+                        var values = line.Split(ExampleSeparator);
+
+                        examples.Add(new Example<Tin, Tout>
+                        {
+                            Input = inputConverter(values[0]),
+                            Output = outputConverter(values[1])
+                        });
+                    }
+
+                    return examples;
+                }
+            }
+        }
+
+        private static string GetResourceName(string fileName)
+        {
+            return Assembly
+                .GetExecutingAssembly()
+                .GetManifestResourceNames()
+                .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success)
+                .SingleOrDefault();
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 14391)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 14392)
@@ -8,5 +8,5 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>HeuristicLab.Tests</RootNamespace>
-    <AssemblyName>HeuristicLab.Tests</AssemblyName>
+    <AssemblyName>F</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
@@ -38,5 +38,14 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.IO.Compression" />
   </ItemGroup>
   <Choose>
@@ -53,13 +62,17 @@
   </Choose>
   <ItemGroup>
-    <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="Benchmark\Example.cs" />
+    <Compile Include="Benchmark\ExampleConverter.cs" />
+    <Compile Include="Benchmark\Problem\CountOdds.cs" />
+    <Compile Include="Benchmark\Problem\Problem.cs" />
+    <Compile Include="Interpreter\Expressions\CommonTests.cs" />
+    <Compile Include="Interpreter\Expressions\ExampleTests.cs" />
+    <Compile Include="Interpreter\Expressions\NameExpressionTests.cs" />
+    <Compile Include="Interpreter\Expressions\FloatExpressionTests.cs" />
+    <Compile Include="Interpreter\Expressions\BooleanExpressionTests.cs" />
+    <Compile Include="Interpreter\Expressions\ExecExpressionTests.cs" />
+    <Compile Include="Interpreter\Expressions\CodeExpressionTests.cs" />
+    <Compile Include="Interpreter\Expressions\IntegerExpressionTests.cs" />
+    <Compile Include="Interpreter\InterpreterTest.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
@@ -71,6 +84,7 @@
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Problems\Data\" />
+    <EmbeddedResource Include="Benchmark\Data\BenchmarkExamples.zip" />
   </ItemGroup>
+  <ItemGroup />
   <Choose>
     <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj.user
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj.user	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj.user	(revision 14392)
@@ -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.Tests/Interpreter/Expressions/BooleanExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/BooleanExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/BooleanExpressionTests.cs	(revision 14392)
@@ -0,0 +1,115 @@
+﻿using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class BooleanExpressionTests : CommonTests<bool>
+    {
+        protected override string TypeName { get { return "BOOLEAN"; } }
+        protected override IStack<bool> Stack { get { return interpreter.BooleanStack; } }
+
+        [TestMethod]
+        public void TestAnd()
+        {
+            interpreter.BooleanStack.Push(true, false);
+            interpreter.Interpret(new BooleanAndExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestAndWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("AND", 1);
+        }
+
+        [TestMethod]
+        public void TestOr()
+        {
+            interpreter.BooleanStack.Push(true, false);
+            interpreter.Interpret(new BooleanOrExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestOrWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("OR", 1);
+        }
+
+        [TestMethod]
+        public void TestNot()
+        {
+            interpreter.BooleanStack.Push(true);
+            interpreter.Interpret(new BooleanNotExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNotWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("NOT");
+        }
+
+        [TestMethod]
+        public void TestFromFloat()
+        {
+            interpreter.FloatStack.Push(2.0);
+            interpreter.Interpret(new BooleanFromFloatExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromFloatWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMFLOAT");
+        }
+
+        [TestMethod]
+        public void TestFromInteger()
+        {
+            interpreter.IntegerStack.Push(2);
+            interpreter.Interpret(new BooleanFromIntegerExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromIntegerWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMINTEGER");
+        }
+
+        protected override bool[] GetValues(int count)
+        {
+            var values = new bool[count];
+
+            for (var i = 0; i < count; i++)
+            {
+                values[i] = i % 2 == 0;
+            }
+
+            return values;
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(booleanStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CodeExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CodeExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CodeExpressionTests.cs	(revision 14392)
@@ -0,0 +1,915 @@
+﻿using HeuristicLab.Algorithms.PushGP;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Generators;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class CodeExpressionTests : CommonTests<Expression>
+    {
+        protected override string TypeName { get { return "CODE"; } }
+        protected override IStack<Expression> Stack { get { return interpreter.CodeStack; } }
+
+        private CodeGenerator cg;
+        public CodeExpressionTests()
+        {
+            this.cg = new CodeGenerator(interpreter);
+        }
+
+        [TestMethod]
+        public void TestAppendLists()
+        {
+            var first = Parser.Parse("( A )");
+            var second = Parser.Parse("( B )");
+            var result = Parser.Parse("( A B )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeAppendExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestAppendListAndLiteral()
+        {
+            var first = Parser.Parse("( A )");
+            var second = Parser.Parse("5");
+            var result = Parser.Parse("( A 5 )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeAppendExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestAppendLiterals()
+        {
+            var first = Parser.Parse("4");
+            var second = Parser.Parse("5");
+            var result = Parser.Parse("( 4 5 )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeAppendExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestAtomList()
+        {
+            var first = Parser.Parse("( A )");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeAtomExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestAtomLiteral()
+        {
+            var first = Parser.Parse("5");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeAtomExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestAtomSingleInstruction()
+        {
+            var first = Parser.Parse("INTEGER.+");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeAtomExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestCarList()
+        {
+            var first = Parser.Parse("( A B C )");
+            var result = Parser.Parse("A");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeCarExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestCarNoList()
+        {
+            var first = Parser.Parse("5");
+            var result = Parser.Parse("5");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeCarExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestCdrList()
+        {
+            var first = Parser.Parse("( A B C )");
+            var result = Parser.Parse("( B C )");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestCdrNoList()
+        {
+            var first = Parser.Parse("5");
+            var result = Parser.Parse("( )");
+
+            interpreter.CodeStack.Push(first);
+            interpreter.Interpret(new CodeCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestCons()
+        {
+            var first = Parser.Parse("( B C )");
+            var second = Parser.Parse("A");
+            var result = Parser.Parse("( A B C )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeConsExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestContainsTrue()
+        {
+            var first = Parser.Parse("A");
+            var second = Parser.Parse("( A B C )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeContainsExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestContainsFalse()
+        {
+            var first = Parser.Parse("D");
+            var second = Parser.Parse("( A B C )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeContainsExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestContainer()
+        {
+            var first = Parser.Parse("( A )");
+            var second = Parser.Parse("( B ( C ( A ) ) ( D ( A ) ) )");
+            var result = Parser.Parse("( C ( A ) )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeContainerExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestDefinition()
+        {
+            var code = Parser.Parse("( A )");
+
+            interpreter.CustomExpressions.Add("Test", code);
+            interpreter.NameStack.Push("Test");
+
+            interpreter.Interpret(new CodeDefinitionExpression());
+
+            Assert.AreEqual(code, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestDefinitionWithoutMatchingName()
+        {
+            var code = Parser.Parse("( A )");
+            var program = new CodeDefinitionExpression();
+
+            interpreter.CustomExpressions.Add("Test1", code);
+            interpreter.NameStack.Push("Test2");
+            interpreter.Interpret(program);
+
+            this.TestStackCounts(nameStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDiscrepancy()
+        {
+            var first = Parser.Parse("( A B )");
+            var second = Parser.Parse("( B C )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeDiscrepancyExpression());
+
+            Assert.AreEqual(2, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDiscrepancyAllEqual()
+        {
+            var first = Parser.Parse("( A B )");
+            var second = Parser.Parse("( B A )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeDiscrepancyExpression());
+
+            Assert.AreEqual(0, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDiscrepancyComplex()
+        {
+            var first = Parser.Parse("( A A B C D A )");
+            var second = Parser.Parse("( A A B D E )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeDiscrepancyExpression());
+
+            Assert.AreEqual(3, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDiscrepancWithLists()
+        {
+            var first = Parser.Parse("( ( A ) A ( B ) C D A )");
+            var second = Parser.Parse("( A ( A ) B D E )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeDiscrepancyExpression());
+
+            Assert.AreEqual(5, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDo()
+        {
+            var prog = Parser.Parse("( 10 )");
+
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoExpression());
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoX()
+        {
+            var prog = Parser.Parse("( 10 )");
+
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoXExpression());
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoCount()
+        {
+            var prog = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoCountExpression());
+
+            Assert.AreEqual(6, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoCountWithNegativeCounter()
+        {
+            var prog = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(-1);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoCountExpression());
+
+            Assert.AreEqual(-1, interpreter.IntegerStack.Top);
+            this.TestStackCounts(codeStack: 1, integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoRange()
+        {
+            var prog = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(3, 5);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoRangeExpression());
+
+            Assert.AreEqual(12, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoRangeWithEqualIndecators()
+        {
+            var prog = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(3, 3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoRangeExpression());
+
+            Assert.AreEqual(3, interpreter.IntegerStack.Top);
+            this.TestStackCounts(codeStack: 1, integerStack: 2);
+        }
+
+        [TestMethod]
+        public void TestDoRangeWithNegativeIndecators()
+        {
+            var prog = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(-3, -5);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoRangeExpression());
+
+            Assert.AreEqual(-12, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoTimes()
+        {
+            var prog = Parser.Parse("( INTEGER.DUP INTEGER.+ )");
+
+            interpreter.IntegerStack.Push(2, 3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoTimesExpression());
+
+            Assert.AreEqual(32, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDoTimesWithNegativeCounter()
+        {
+            var prog = Parser.Parse("( INTEGER.DUP INTEGER.+ )");
+
+            interpreter.IntegerStack.Push(2, -3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeDoTimesExpression());
+
+            Assert.AreEqual(-3, interpreter.IntegerStack.Top);
+            this.TestStackCounts(codeStack: 1, integerStack: 2);
+        }
+
+        [TestMethod]
+        public void TestNestedDoRange()
+        {
+            interpreter.Interpret("( 0 2 CODE.QUOTE ( 1 INTEGER.+ 0 3 CODE.QUOTE ( 1 INTEGER.+ INTEGER.* ) CODE.DO*RANGE INTEGER.+ ) CODE.DO*RANGE )");
+
+            Assert.AreEqual(144, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNestedDoCount()
+        {
+            interpreter.Interpret("( 2 CODE.QUOTE ( 1 INTEGER.+ 3 CODE.QUOTE ( 1 INTEGER.+ INTEGER.* ) CODE.DO*COUNT INTEGER.+ ) CODE.DO*COUNT )");
+
+            Assert.AreEqual(144, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNestedDoTimes()
+        {
+            interpreter.Interpret("( 3 CODE.QUOTE ( 2 3 CODE.QUOTE ( 2 INTEGER.* ) CODE.DO*TIMES INTEGER.+ ) CODE.DO*TIMES )");
+
+            Assert.AreEqual(128, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestExtract()
+        {
+            var prog = Parser.Parse("( A ( B C ( D ) E ) F )");
+            var result = Parser.Parse("( D )");
+
+            interpreter.IntegerStack.Push(5);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeExtractExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestExtractInteger()
+        {
+            var prog = Parser.Parse("( A ( 5 C ( 4.2 ) INTEGER.+ ) FALSE )");
+            var result = Parser.Parse("5");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeExtractExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestExtractFloat()
+        {
+            var prog = Parser.Parse("( A ( 5 C ( 4.2 ) INTEGER.+ ) FALSE )");
+            var result = Parser.Parse("4.2");
+
+            interpreter.IntegerStack.Push(6);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeExtractExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestExtractBoolean()
+        {
+            var prog = Parser.Parse("( A ( 5 C ( 4.2 ) INTEGER.+ ) FALSE )");
+            var result = Parser.Parse("FALSE");
+
+            interpreter.IntegerStack.Push(8);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeExtractExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestExtractInstruction()
+        {
+            var prog = Parser.Parse("( A ( 5 C ( 4.2 ) INTEGER.+ ) FALSE )");
+            var result = Parser.Parse("INTEGER.+");
+
+            interpreter.IntegerStack.Push(7);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeExtractExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestFromBoolean()
+        {
+            var result = Parser.Parse("FALSE");
+            interpreter.BooleanStack.Push(false);
+            interpreter.Interpret(new CodeFromBooleanExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestFromFloat()
+        {
+            var result = Parser.Parse("4.1");
+            interpreter.FloatStack.Push(4.1);
+            interpreter.Interpret(new CodeFromFloatExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestFromInteger()
+        {
+            var result = Parser.Parse("4");
+            interpreter.IntegerStack.Push(4);
+            interpreter.Interpret(new CodeFromIntegerExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestFromName()
+        {
+            var result = Parser.Parse("A");
+            interpreter.NameStack.Push("A");
+            interpreter.Interpret(new CodeFromNameExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestIfTrue()
+        {
+            var first = Parser.Parse("FALSCH");
+            var second = Parser.Parse("WAHR");
+
+            interpreter.BooleanStack.Push(true);
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeIfExpression());
+
+            Assert.AreEqual("WAHR", interpreter.NameStack.Top);
+            this.TestStackCounts(nameStack: 1);
+        }
+
+        [TestMethod]
+        public void TestIfFalse()
+        {
+            var first = Parser.Parse("FALSCH");
+            var second = Parser.Parse("WAHR");
+
+            interpreter.BooleanStack.Push(false);
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeIfExpression());
+
+            Assert.AreEqual("FALSCH", interpreter.NameStack.Top);
+            this.TestStackCounts(nameStack: 1);
+        }
+
+        [TestMethod]
+        public void TestInsert()
+        {
+            var first = Parser.Parse("( A ( B ) C D )");
+            var second = Parser.Parse("( E )");
+            var result = Parser.Parse("( A ( B ) ( E ) D )");
+
+            interpreter.IntegerStack.Push(2);
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeInsertExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestInsertWithNegativeN()
+        {
+            var first = Parser.Parse("( A ( B ) C D )");
+            var second = Parser.Parse("( E )");
+            var result = Parser.Parse("( A ( B ) ( E ) D )");
+
+            interpreter.IntegerStack.Push(-2);
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeInsertExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestInsertWithTooBigN()
+        {
+            var first = Parser.Parse("( A ( B ) C D )");
+            var second = Parser.Parse("( E )");
+            var result = Parser.Parse("( A ( B ) ( E ) D )");
+
+            interpreter.IntegerStack.Push(10);
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeInsertExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestList()
+        {
+            var first = Parser.Parse("A");
+            var second = Parser.Parse("( B )");
+            var result = Parser.Parse("( A ( B ) )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeListExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestMemberTrue()
+        {
+            var first = Parser.Parse("( A B ( B ) C ");
+            var second = Parser.Parse("( B )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeMemberExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMemberFalse()
+        {
+            var first = Parser.Parse("( A B C ");
+            var second = Parser.Parse("( B )");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeMemberExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMemberIfNoList()
+        {
+            var first = Parser.Parse("B");
+            var second = Parser.Parse("B");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodeMemberExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNoop()
+        {
+            interpreter.Interpret(new CodeNoopExpression());
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthIfNoList()
+        {
+            var prog = Parser.Parse("A");
+            var result = Parser.Parse("A");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthIfEmpty()
+        {
+            var prog = Parser.Parse("( )");
+            var result = Parser.Parse("( )");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNth()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthWithTooBigN()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(13);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthWithNegativeN()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(-3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthCdr()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(2);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthCdrWithTooBigN()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(10);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthCdrWithNegativeN()
+        {
+            var prog = Parser.Parse("( A B C D E )");
+            var result = Parser.Parse("D");
+
+            interpreter.IntegerStack.Push(-2);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthCdrIfEmpty()
+        {
+            var prog = Parser.Parse("( )");
+            var result = Parser.Parse("( )");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNthCdrIfNoList()
+        {
+            var prog = Parser.Parse("A");
+            var result = Parser.Parse("A");
+
+            interpreter.IntegerStack.Push(3);
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNthCdrExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestNullTrue()
+        {
+            var prog = Parser.Parse("( )");
+
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNullExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNullFalse()
+        {
+            var prog = Parser.Parse("A");
+
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeNullExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestPosition()
+        {
+            var first = Parser.Parse("( A B C D )");
+            var second = Parser.Parse("C");
+
+            interpreter.CodeStack.Push(second, first);
+            interpreter.Interpret(new CodePositionExpression());
+
+            Assert.AreEqual(2, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestQuote()
+        {
+            var result = Parser.Parse("A");
+
+            interpreter.Interpret("( CODE.QUOTE A )");
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestSize()
+        {
+            var prog = Parser.Parse("( A ( B ( C ) ) ( D ) INTEGER.+ )");
+
+            interpreter.CodeStack.Push(prog);
+            interpreter.Interpret(new CodeSizeExpression());
+
+            Assert.AreEqual(4, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSubstitude()
+        {
+            var first = Parser.Parse("( A B C D A B C D )");
+            var second = Parser.Parse("E");
+            var third = Parser.Parse("A");
+            var result = Parser.Parse("( E B C D E B C D )");
+
+            interpreter.CodeStack.Push(third, second, first);
+            interpreter.Interpret(new CodeSubstitutionExpression());
+
+            Assert.AreEqual(result, interpreter.CodeStack.Top);
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        protected override Expression[] GetValues(int count)
+        {
+            var values = new Expression[count];
+
+            for (var i = 0; i < count; i++)
+            {
+                values[i] = new CodeNoopExpression();
+            }
+
+            return values;
+        }
+
+        protected override Expression[] Get2Different()
+        {
+            return new Expression[]
+            {
+                new CodeNoopExpression(),
+                new CodeNullExpression()
+            };
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(codeStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CommonTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CommonTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CommonTests.cs	(revision 14392)
@@ -0,0 +1,274 @@
+﻿using HeuristicLab.Algorithms.PushGP;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+
+    public abstract class CommonTests<T> : InterpreterTest
+    {
+        protected const string FullInstructionNameFormat = "{0}.{1}";
+        protected abstract string TypeName { get; }
+        protected abstract IStack<T> Stack { get; }
+
+        protected abstract T[] GetValues(int count);
+
+        protected virtual T[] Get2Different()
+        {
+            return this.GetValues(2);
+        }
+
+        protected virtual void Test(Expression expression)
+        {
+            this.interpreter.Interpret(expression);
+        }
+
+        protected abstract void CheckOtherStacksAreEmpty();
+
+        [TestMethod]
+        public virtual void TestEqualsTrue()
+        {
+            var values = this.GetValues(1);
+            var merged = new[] { values[0], values[0] };
+
+            this.Stack.Push(merged);
+
+            var isBooleanStack = interpreter.BooleanStack.Count == 2;
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".="));
+
+            if (isBooleanStack)
+            {
+                Assert.AreEqual(1, this.Stack.Count);
+            }
+            else
+            {
+                Assert.AreEqual(0, this.Stack.Count);
+            }
+
+            Assert.IsTrue(interpreter.BooleanStack.Top);
+        }
+
+        [TestMethod]
+        public virtual void TestEqualsFalse()
+        {
+            var values = this.Get2Different();
+            this.Stack.Push(values);
+            var isBooleanStack = interpreter.BooleanStack.Count == 2;
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".="));
+
+            if (isBooleanStack)
+            {
+                Assert.AreEqual(1, this.Stack.Count);
+            }
+            else
+            {
+                Assert.AreEqual(0, this.Stack.Count);
+            }
+
+            Assert.IsFalse(interpreter.BooleanStack.Top);
+        }
+
+        [TestMethod]
+        public virtual void TestEqualsWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("=", 1);
+        }
+
+        [TestMethod]
+        public virtual void TestPop()
+        {
+            var values = this.GetValues(2);
+            this.Stack.Push(values);
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".POP"));
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestSwap()
+        {
+            var values = this.GetValues(3);
+            this.Stack.Push(values);
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".SWAP"));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+            Assert.AreEqual(values[2], this.Stack[1]);
+            Assert.AreEqual(values[1], this.Stack[2]);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestSwapWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("SWAP", 1);
+        }
+
+
+        [TestMethod]
+        public virtual void TestRotate()
+        {
+            var values = this.GetValues(4);
+            this.Stack.Push(values);
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".ROT"));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+            Assert.AreEqual(values[3], this.Stack[1]);
+            Assert.AreEqual(values[1], this.Stack[2]);
+            Assert.AreEqual(values[2], this.Stack[3]);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestRotateWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("ROT", 2);
+        }
+
+        [TestMethod]
+        public virtual void TestShove()
+        {
+            var values = this.GetValues(3);
+            this.Stack.Push(values);
+
+            interpreter.IntegerStack.Push(1);
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".SHOVE"));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+            Assert.AreEqual(values[2], this.Stack[1]);
+            Assert.AreEqual(values[1], this.Stack[2]);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestShoveWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("SHOVE", 1);
+        }
+
+        [TestMethod]
+        public virtual void TestShoveWithNegativeIndex()
+        {
+            this.TestWithNegativeIndex("SHOVE");
+        }
+
+        [TestMethod]
+        public virtual void TestYank()
+        {
+            var values = this.GetValues(3);
+            this.Stack.Push(values);
+
+            interpreter.IntegerStack.Push(1);
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".YANK"));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+            Assert.AreEqual(values[2], this.Stack[1]);
+            Assert.AreEqual(values[1], this.Stack[2]);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestYankWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("YANK", 1);
+        }
+
+        [TestMethod]
+        public virtual void TestYankWithNegativeIndex()
+        {
+            this.TestWithNegativeIndex("YANK");
+        }
+
+        [TestMethod]
+        public virtual void TestYankDuplicate()
+        {
+            var values = this.GetValues(3);
+            this.Stack.Push(values);
+
+            interpreter.IntegerStack.Push(1);
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".YANKDUP"));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+            Assert.AreEqual(values[1], this.Stack[1]);
+            Assert.AreEqual(values[2], this.Stack[2]);
+            Assert.AreEqual(values[1], this.Stack[3]);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public virtual void TestYankDuplicateWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("YANKDUP", 1);
+        }
+
+        [TestMethod]
+        public virtual void TestYankDuplicateWithNegativeIndex()
+        {
+            this.TestWithNegativeIndex("YANKDUP");
+        }
+
+        [TestMethod]
+        public virtual void TestStackdpeth()
+        {
+            var values = this.GetValues(3);
+            this.Stack.Push(values);
+
+            this.Test(ExpressionTable.GetStatelessExpression(this.TypeName + ".STACKDEPTH"));
+
+            // if stack is integer stack
+            if (this.Stack.Count != values.Length)
+            {
+                Assert.AreEqual(4, this.Stack.Count);
+                this.CheckOtherStacksAreEmpty();
+            }
+            else
+            {
+                Assert.AreEqual(3, this.Stack.Count);
+                Assert.AreEqual(values.Length, interpreter.IntegerStack.Top);
+            }
+        }
+
+        protected void TestWithInsufficientArguments(string instructionName, int argCount = 0)
+        {
+            for (var i = 0; i < argCount + 1; i++)
+            {
+                var values = this.GetValues(i);
+                this.Stack.Push(values);
+
+                var fullInstructionname = string.Format(FullInstructionNameFormat, this.TypeName, instructionName);
+                this.Test(ExpressionTable.GetStatelessExpression(fullInstructionname));
+
+                for (var j = 0; j < i; j++)
+                {
+                    Assert.AreEqual(values[j], this.Stack[j]);
+                }
+
+                this.CheckOtherStacksAreEmpty();
+                interpreter.Clear();
+            }
+        }
+
+        protected void TestWithNegativeIndex(string instructionName)
+        {
+            var values = this.GetValues(1);
+            this.Stack.Push(values);
+
+            interpreter.IntegerStack.Push(-1);
+
+            var fullInstructionname = string.Format(FullInstructionNameFormat, this.TypeName, instructionName);
+            this.Test(ExpressionTable.GetStatelessExpression(fullInstructionname));
+
+            Assert.AreEqual(values[0], this.Stack[0]);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExampleTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExampleTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExampleTests.cs	(revision 14392)
@@ -0,0 +1,258 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.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.Configuration.TopLevelPushCode = true;
+
+            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.Count == 1);
+            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(2, 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/Interpreter/Expressions/ExecExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExecExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExecExpressionTests.cs	(revision 14392)
@@ -0,0 +1,139 @@
+﻿using HeuristicLab.Algorithms.PushGP;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class ExecExpressionTests : CommonTests<Expression>
+    {
+        protected override string TypeName { get { return "EXEC"; } }
+
+        protected override IStack<Expression> Stack { get { return interpreter.ExecStack; } }
+
+        protected override void Test(Expression expression)
+        {
+            this.interpreter.InterpretAsync(expression, true).Wait();
+        }
+
+        [TestMethod]
+        public void TestIfTrue()
+        {
+            interpreter.BooleanStack.Push(true);
+            interpreter.Interpret("( EXEC.IF WAHR FALSCH )");
+
+            Assert.AreEqual("WAHR", interpreter.NameStack.Top);
+            this.TestStackCounts(nameStack: 1);
+        }
+
+        [TestMethod]
+        public void TestIfFalse()
+        {
+            interpreter.BooleanStack.Push(false);
+            interpreter.Interpret("( EXEC.IF WAHR FALSCH )");
+
+            Assert.AreEqual("FALSCH", interpreter.NameStack.Top);
+            this.TestStackCounts(nameStack: 1);
+        }
+
+        [TestMethod]
+        public void TestK()
+        {
+            var first = Parser.Parse("A");
+            var second = Parser.Parse("B");
+            var third = Parser.Parse("C");
+
+            interpreter.ExecStack.Push(third, second, first);
+            this.Test(new ExecKExpression());
+
+            Assert.AreEqual(first, interpreter.ExecStack.Top);
+            Assert.AreEqual(third, interpreter.ExecStack.Bottom);
+            this.TestStackCounts(execStack: 2);
+        }
+
+        [TestMethod]
+        public void TestS()
+        {
+            var first = Parser.Parse("A");
+            var second = Parser.Parse("B");
+            var third = Parser.Parse("C");
+            var result = Parser.Parse("( B C )");
+
+            interpreter.ExecStack.Push(third, second, first);
+            this.Test(new ExecSExpression());
+
+            Assert.AreEqual(result, interpreter.ExecStack.ReverseElementAt(2));
+            Assert.AreEqual(third, interpreter.ExecStack.ReverseElementAt(1));
+            Assert.AreEqual(first, interpreter.ExecStack.Top);
+            this.TestStackCounts(execStack: 3);
+        }
+
+        [TestMethod]
+        public void TestY()
+        {
+            var first = Parser.Parse("A");
+            var result = Parser.Parse("( EXEC.Y A )");
+
+            interpreter.ExecStack.Push(first);
+            this.Test(new ExecYExpression());
+
+            Assert.AreEqual(first, interpreter.ExecStack.Top);
+            Assert.AreEqual(result, interpreter.ExecStack.ReverseElementAt(1));
+            this.TestStackCounts(execStack: 2);
+        }
+
+        [TestMethod]
+        public void TestNestedDoRange()
+        {
+            interpreter.Interpret("( 0 2 EXEC.DO*RANGE ( 1 INTEGER.+ 0 3 EXEC.DO*RANGE ( 1 INTEGER.+ INTEGER.* ) INTEGER.+ )");
+
+            Assert.AreEqual(144, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNestedDoCount()
+        {
+            interpreter.Interpret("( 2 EXEC.DO*COUNT ( 1 INTEGER.+ 3 EXEC.DO*COUNT ( 1 INTEGER.+ INTEGER.* ) INTEGER.+ )");
+
+            Assert.AreEqual(144, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestNestedDoTimes()
+        {
+            interpreter.Interpret("( 3 EXEC.DO*TIMES ( 2 3 EXEC.DO*TIMES ( 2 INTEGER.* ) INTEGER.+ )");
+
+            Assert.AreEqual(128, interpreter.IntegerStack.Top);
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        protected override Expression[] GetValues(int count)
+        {
+            var values = new Expression[count];
+
+            for (var i = 0; i < count; i++)
+            {
+                values[i] = new CodeNoopExpression();
+            }
+
+            return values;
+        }
+
+        protected override Expression[] Get2Different()
+        {
+            return new Expression[]
+            {
+                new CodeNoopExpression(),
+                new CodeNullExpression()
+            };
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(execStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/FloatExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/FloatExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/FloatExpressionTests.cs	(revision 14392)
@@ -0,0 +1,264 @@
+﻿using System;
+using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class FloatExpressionTests : CommonTests<double>
+    {
+        private const double delta = 0.00001;
+        protected override string TypeName { get { return "FLOAT"; } }
+        protected override IStack<double> Stack { get { return interpreter.FloatStack; } }
+
+        [TestMethod]
+        public void TestAdd()
+        {
+            interpreter.FloatStack.Push(5.3, 5.3);
+            interpreter.Interpret(new FloatAddExpression());
+
+            Assert.AreEqual(10.6, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestAddWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("+", 1);
+        }
+
+        [TestMethod]
+        public void TestSubtract()
+        {
+            interpreter.FloatStack.Push(10.2, 5.3);
+            interpreter.Interpret(new FloatSubtractExpression());
+
+            Assert.AreEqual(4.9, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSubractWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("-", 1);
+        }
+
+        [TestMethod]
+        public void TestMultiply()
+        {
+            interpreter.FloatStack.Push(9.9, 3.3);
+            interpreter.Interpret(new FloatMultiplyExpression());
+
+            Assert.AreEqual(32.67, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMultiplyWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("*", 1);
+        }
+
+        [TestMethod]
+        public void TestDivide()
+        {
+            interpreter.FloatStack.Push(9.9, 3.3);
+            interpreter.Interpret(new FloatDivideExpression());
+
+            Assert.AreEqual(3.0, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDivideWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("/", 1);
+        }
+
+        [TestMethod]
+        public void TestModulo()
+        {
+            interpreter.FloatStack.Push(11.6, 5.3);
+            interpreter.Interpret(new FloatModuloExpression());
+
+            Assert.AreEqual(1, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestModuloWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("%", 1);
+        }
+
+        [TestMethod]
+        public void TestMin()
+        {
+            interpreter.FloatStack.Push(10.2, 5.3);
+            interpreter.Interpret(new FloatMinExpression());
+
+            Assert.AreEqual(5.3, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMinWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("MIN", 1);
+        }
+
+        [TestMethod]
+        public void TestMax()
+        {
+            interpreter.FloatStack.Push(10.3, 5.3);
+            interpreter.Interpret(new FloatMaxExpression());
+
+            Assert.AreEqual(10.3, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMaxWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("MAX", 1);
+        }
+
+        [TestMethod]
+        public void TestSmallerThan()
+        {
+            interpreter.FloatStack.Push(10.2, 5.3);
+            interpreter.Interpret(new FloatSmallerThanExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSmallerThanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("<", 1);
+        }
+
+        [TestMethod]
+        public void TestGreaterThan()
+        {
+            interpreter.FloatStack.Push(10.2, 5.3);
+            interpreter.Interpret(new FloatGreaterThanExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestGreaterThanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments(">", 1);
+        }
+
+        [TestMethod]
+        public void TestFromBooleanTrue()
+        {
+            interpreter.BooleanStack.Push(true);
+            interpreter.Interpret(new FloatFromBooleanExpression());
+
+            Assert.AreEqual(1d, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromBooleanFalse()
+        {
+            interpreter.BooleanStack.Push(false);
+            interpreter.Interpret(new FloatFromBooleanExpression());
+
+            Assert.AreEqual(0d, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromBooleanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMBOOLEAN");
+        }
+
+        [TestMethod]
+        public void TestFromInteger()
+        {
+            interpreter.IntegerStack.Push(5);
+            interpreter.Interpret(new FloatFromIntegerExpression());
+
+            Assert.AreEqual(5d, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromIntegerWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMINTEGER");
+        }
+
+        [TestMethod]
+        public void TestSine()
+        {
+            interpreter.FloatStack.Push(Math.PI / 2);
+            interpreter.Interpret(new FloatSineExpression());
+
+            Assert.AreEqual(1, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSineWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("SIN");
+        }
+
+        [TestMethod]
+        public void TestCosine()
+        {
+            interpreter.FloatStack.Push(Math.PI);
+            interpreter.Interpret(new FloatCosineExpression());
+
+            Assert.AreEqual(-1, interpreter.FloatStack.Top, delta);
+
+            this.TestStackCounts(floatStack: 1);
+        }
+
+        [TestMethod]
+        public void TestCosineWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("COS");
+        }
+
+        protected override double[] GetValues(int count)
+        {
+            var values = new double[count];
+
+            for (var i = 0; i < count; i++)
+            {
+                values[i] = i * 0.9;
+            }
+
+            return values;
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(floatStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/IntegerExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/IntegerExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/IntegerExpressionTests.cs	(revision 14392)
@@ -0,0 +1,228 @@
+﻿using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class IntegerExpressionTests : CommonTests<long>
+    {
+        protected override string TypeName { get { return "INTEGER"; } }
+        protected override IStack<long> Stack { get { return interpreter.IntegerStack; } }
+
+        [TestMethod]
+        public void TestAdd()
+        {
+            interpreter.IntegerStack.Push(5, 5);
+            interpreter.Interpret(new IntegerAddExpression());
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestAddWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("+", 1);
+        }
+
+        [TestMethod]
+        public void TestSubtract()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerSubtractExpression());
+
+            Assert.AreEqual(5, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSubtractWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("-", 1);
+        }
+
+        [TestMethod]
+        public void TestMultiply()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerMultiplyExpression());
+
+            Assert.AreEqual(50, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMultiplyWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("*", 1);
+        }
+
+        [TestMethod]
+        public void TestDivide()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerDivideExpression());
+
+            Assert.AreEqual(2, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestDivideWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("/", 1);
+        }
+
+        [TestMethod]
+        public void TestModulo()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerModuloExpression());
+
+            Assert.AreEqual(0, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestModuloWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("%", 1);
+        }
+
+        [TestMethod]
+        public void TestMin()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerMinExpression());
+
+            Assert.AreEqual(5, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMinWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("MIN", 1);
+        }
+
+        [TestMethod]
+        public void TestMax()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerMaxExpression());
+
+            Assert.AreEqual(10, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestMaxWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("MAX", 1);
+        }
+
+        [TestMethod]
+        public void TestSmallerThan()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerSmallerThanExpression());
+
+            Assert.AreEqual(false, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestSmallerThanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("<", 1);
+        }
+
+        [TestMethod]
+        public void TestGreaterThan()
+        {
+            interpreter.IntegerStack.Push(10, 5);
+            interpreter.Interpret(new IntegerGreaterThanExpression());
+
+            Assert.AreEqual(true, interpreter.BooleanStack.Top);
+
+            this.TestStackCounts(booleanStack: 1);
+        }
+
+        [TestMethod]
+        public void TestGreaterThanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments(">", 1);
+        }
+
+        [TestMethod]
+        public void TestFromBooleanTrue()
+        {
+            interpreter.BooleanStack.Push(true);
+            interpreter.Interpret(new IntegerFromBooleanExpression());
+
+            Assert.AreEqual(1, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromBooleanWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMBOOLEAN");
+        }
+
+        [TestMethod]
+        public void TestFromBooleanFalse()
+        {
+            interpreter.BooleanStack.Push(false);
+            interpreter.Interpret(new IntegerFromBooleanExpression());
+
+            Assert.AreEqual(0, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromFloat()
+        {
+            interpreter.FloatStack.Push(1.5);
+            interpreter.Interpret(new IntegerFromFloatExpression());
+
+            Assert.AreEqual(1, interpreter.IntegerStack.Top);
+
+            this.TestStackCounts(integerStack: 1);
+        }
+
+        [TestMethod]
+        public void TestFromFloatWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("FROMFLOAT");
+        }
+
+        protected override long[] GetValues(int count)
+        {
+            var values = new long[count];
+
+            for (long i = 0; i < count; i++)
+            {
+                values[i] = i;
+            }
+
+            return values;
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(integerStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/NameExpressionTests.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/NameExpressionTests.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/Expressions/NameExpressionTests.cs	(revision 14392)
@@ -0,0 +1,73 @@
+﻿using HeuristicLab.Algorithms.PushGP.Expressions;
+using HeuristicLab.Algorithms.PushGP.Generators;
+using HeuristicLab.Algorithms.PushGP.Stack;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter.Expressions
+{
+    [TestClass]
+    public class NameExpressionTests : CommonTests<string>
+    {
+
+        protected override string TypeName { get { return "NAME"; } }
+        protected override IStack<string> Stack { get { return interpreter.NameStack; } }
+
+        [TestMethod]
+        public void TestRand()
+        {
+            interpreter.Interpret(new NameRandExpression());
+
+            Assert.IsTrue(interpreter.NameStack.Count == 1);
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestRandomBound()
+        {
+            interpreter.CustomExpressions.Add("c1", new CodeNoopExpression());
+            interpreter.CustomExpressions.Add("c2", new CodeNoopExpression());
+            interpreter.CustomExpressions.Add("c3", new CodeNoopExpression());
+
+            interpreter.Interpret(new NameRandBoundNameExpression());
+
+            Assert.IsTrue(interpreter.CustomExpressions.Keys.Contains(interpreter.NameStack.Top));
+
+            this.CheckOtherStacksAreEmpty();
+        }
+
+        [TestMethod]
+        public void TestRandomBoundWithInsufficientArguments()
+        {
+            this.TestWithInsufficientArguments("RANDBOUNDNAME");
+        }
+
+        [TestMethod]
+        public void TestQuote()
+        {
+            interpreter.Interpret(new NameQuoteExpression());
+
+            Assert.IsTrue(interpreter.IsNameQuoteFlagSet);
+
+            this.TestStackCounts();
+        }
+
+        protected override string[] GetValues(int count)
+        {
+            var ng = new NameGenerator();
+            var values = new string[count];
+
+            for (var i = 0; i < count; i++)
+            {
+                values[i] = ng.GetNextString();
+            }
+
+            return values;
+        }
+
+        protected override void CheckOtherStacksAreEmpty()
+        {
+            this.TestStackCounts(nameStack: null);
+        }
+    }
+}
Index: /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/InterpreterTest.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/InterpreterTest.cs	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/Interpreter/InterpreterTest.cs	(revision 14392)
@@ -0,0 +1,52 @@
+﻿using HeuristicLab.Algorithms.PushGP.Interpreter;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests.Interpreter
+{
+    public class InterpreterTest
+    {
+        protected PushGPInterpreter interpreter;
+
+        [TestInitialize]
+        public void BeforeTest()
+        {
+            interpreter = new PushGPInterpreter(new Configuration
+            {
+                TopLevelPushCode = false
+            });
+        }
+
+        protected void TestStackCounts(int? execStack = 0, int? codeStack = 0, int? nameStack = 0, int? booleanStack = 0, int? floatStack = 0, int? integerStack = 0)
+        {
+            if (execStack.HasValue)
+            {
+                Assert.AreEqual(execStack, interpreter.ExecStack.Count);
+            }
+
+            if (codeStack.HasValue)
+            {
+                Assert.AreEqual(codeStack, interpreter.CodeStack.Count);
+            }
+
+            if (nameStack.HasValue)
+            {
+                Assert.AreEqual(nameStack, interpreter.NameStack.Count);
+            }
+
+            if (booleanStack.HasValue)
+            {
+                Assert.AreEqual(booleanStack, interpreter.BooleanStack.Count);
+            }
+
+            if (floatStack.HasValue)
+            {
+                Assert.AreEqual(floatStack, interpreter.FloatStack.Count);
+            }
+
+            if (integerStack.HasValue)
+            {
+                Assert.AreEqual(integerStack, interpreter.IntegerStack.Count);
+            }
+        }
+    }
+}
Index: anches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/InterpreterTest.cs
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Tests/InterpreterTest.cs	(revision 14391)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿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/PushGp.sln
===================================================================
--- /branches/PushGP/HeuristicLab.Algorithms.PushGP/PushGp.sln	(revision 14392)
+++ /branches/PushGP/HeuristicLab.Algorithms.PushGP/PushGp.sln	(revision 14392)
@@ -0,0 +1,40 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.PushGP", "HeuristicLab.Algorithms.PushGP\HeuristicLab.Algorithms.PushGP.csproj", "{368D1303-470C-4F31-91F2-0FAD379DAA45}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.PushGP.Cli", "HeuristicLab.Algorithms.PushGP.Cli\HeuristicLab.Algorithms.PushGP.Cli.csproj", "{293FD718-99E9-4F6A-A0EC-343C92D0B03E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Tests", "HeuristicLab.Tests\HeuristicLab.Tests.csproj", "{117B7D68-ED7D-4350-996B-9CA15259E107}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.BenchmarkSuite", "HeuristicLab.BenchmarkSuite\HeuristicLab.BenchmarkSuite.csproj", "{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{368D1303-470C-4F31-91F2-0FAD379DAA45}.Release|Any CPU.Build.0 = Release|Any CPU
+		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{293FD718-99E9-4F6A-A0EC-343C92D0B03E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{117B7D68-ED7D-4350-996B-9CA15259E107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{117B7D68-ED7D-4350-996B-9CA15259E107}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{117B7D68-ED7D-4350-996B-9CA15259E107}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{117B7D68-ED7D-4350-996B-9CA15259E107}.Release|Any CPU.Build.0 = Release|Any CPU
+		{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{22B5C087-CFC7-4D40-86C6-32FCF2CA921E}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
