Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 6808)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 6809)
@@ -247,5 +247,5 @@
 
       ILGenerator il = testFun.GetILGenerator();
-      CompileInstructions(il, state);
+      CompileInstructions(il, state, dataset);
       il.Emit(System.Reflection.Emit.OpCodes.Conv_R8);
       il.Emit(System.Reflection.Emit.OpCodes.Ret);
@@ -257,5 +257,5 @@
     }
 
-    private void CompileInstructions(ILGenerator il, InterpreterState state) {
+    private void CompileInstructions(ILGenerator il, InterpreterState state, Dataset ds) {
       Instruction currentInstr = state.NextInstruction();
       int nArgs = currentInstr.nArguments;
@@ -264,8 +264,8 @@
         case OpCodes.Add: {
             if (nArgs > 0) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             for (int i = 1; i < nArgs; i++) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Add);
             }
@@ -274,13 +274,13 @@
         case OpCodes.Sub: {
             if (nArgs == 1) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Neg);
               return;
             }
             if (nArgs > 0) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             for (int i = 1; i < nArgs; i++) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Sub);
             }
@@ -289,8 +289,8 @@
         case OpCodes.Mul: {
             if (nArgs > 0) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             for (int i = 1; i < nArgs; i++) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Mul);
             }
@@ -300,13 +300,13 @@
             if (nArgs == 1) {
               il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0);
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Div);
               return;
             }
             if (nArgs > 0) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             for (int i = 1; i < nArgs; i++) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Div);
             }
@@ -314,7 +314,7 @@
           }
         case OpCodes.Average: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             for (int i = 1; i < nArgs; i++) {
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
               il.Emit(System.Reflection.Emit.OpCodes.Add);
             }
@@ -324,21 +324,21 @@
           }
         case OpCodes.Cos: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, cos);
             return;
           }
         case OpCodes.Sin: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, sin);
             return;
           }
         case OpCodes.Tan: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, tan);
             return;
           }
         case OpCodes.Power: {
-            CompileInstructions(il, state);
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, round);
             il.Emit(System.Reflection.Emit.OpCodes.Call, power);
@@ -346,7 +346,7 @@
           }
         case OpCodes.Root: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0); // 1 / round(...)
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, round);
             il.Emit(System.Reflection.Emit.OpCodes.Div);
@@ -355,10 +355,10 @@
           }
         case OpCodes.Exp: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, exp);
             return;
           }
         case OpCodes.Log: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, log);
             return;
@@ -367,12 +367,12 @@
             Label end = il.DefineLabel();
             Label c1 = il.DefineLabel();
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
             il.Emit(System.Reflection.Emit.OpCodes.Brfalse, c1);
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Br, end);
             il.MarkLabel(c1);
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.MarkLabel(end);
             return;
@@ -381,10 +381,10 @@
             Label falseBranch = il.DefineLabel();
             Label end = il.DefineLabel();
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             for (int i = 1; i < nArgs; i++) {
               il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
               il.Emit(System.Reflection.Emit.OpCodes.Cgt);
               il.Emit(System.Reflection.Emit.OpCodes.Brfalse, falseBranch);
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
@@ -403,5 +403,5 @@
             Label end = il.DefineLabel();
             Label resultBranch = il.DefineLabel();
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             for (int i = 1; i < nArgs; i++) {
               Label nextArgBranch = il.DefineLabel();
@@ -413,5 +413,5 @@
               il.MarkLabel(nextArgBranch);
               il.Emit(System.Reflection.Emit.OpCodes.Pop);
-              CompileInstructions(il, state);
+              CompileInstructions(il, state, ds);
             }
             il.MarkLabel(resultBranch);
@@ -428,5 +428,5 @@
           }
         case OpCodes.NOT: {
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
@@ -439,6 +439,7 @@
           }
         case OpCodes.GT: {
-            CompileInstructions(il, state);
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
+            CompileInstructions(il, state, ds);
+
             il.Emit(System.Reflection.Emit.OpCodes.Cgt); // 1 (>) / 0 (otherwise)
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
@@ -449,6 +450,6 @@
           }
         case OpCodes.LT: {
-            CompileInstructions(il, state);
-            CompileInstructions(il, state);
+            CompileInstructions(il, state, ds);
+            CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Clt);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
@@ -459,8 +460,34 @@
           }
         case OpCodes.TimeLag: {
-            throw new NotImplementedException();
+            LaggedTreeNode laggedTreeNode = (LaggedTreeNode)currentInstr.dynamicNode;
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row -= lag
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, laggedTreeNode.Lag);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row += lag
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, laggedTreeNode.Lag);
+            il.Emit(System.Reflection.Emit.OpCodes.Sub);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            return;
           }
         case OpCodes.Integral: {
-            throw new NotImplementedException();
+            int savedPc = state.ProgramCounter;
+            LaggedTreeNode laggedTreeNode = (LaggedTreeNode)currentInstr.dynamicNode;
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row -= lag
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, laggedTreeNode.Lag);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            CompileInstructions(il, state, ds);
+            for (int l = laggedTreeNode.Lag; l < 0; l++) {
+              il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row += lag
+              il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_1);
+              il.Emit(System.Reflection.Emit.OpCodes.Add);
+              il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+              state.ProgramCounter = savedPc;
+              CompileInstructions(il, state, ds);
+              il.Emit(System.Reflection.Emit.OpCodes.Add);
+            }
+            return;
           }
 
@@ -470,5 +497,41 @@
         // y' = 1/8h (f_i + 2f_i-1, -2 f_i-3 - f_i-4)
         case OpCodes.Derivative: {
-            throw new NotImplementedException();
+            int savedPc = state.ProgramCounter;
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row --
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_M1);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            state.ProgramCounter = savedPc;
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // f_0 + 2 * f_1
+            il.Emit(System.Reflection.Emit.OpCodes.Mul);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row -=2
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_2);
+            il.Emit(System.Reflection.Emit.OpCodes.Sub);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            state.ProgramCounter = savedPc;
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // f_0 + 2 * f_1 - 2 * f_3
+            il.Emit(System.Reflection.Emit.OpCodes.Mul);
+            il.Emit(System.Reflection.Emit.OpCodes.Sub);
+
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row --
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_M1);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            state.ProgramCounter = savedPc;
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Sub); // f_0 + 2 * f_1 - 2 * f_3 - f_4
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 8.0); // / 8
+            il.Emit(System.Reflection.Emit.OpCodes.Div);
+
+            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // row +=4
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_4);
+            il.Emit(System.Reflection.Emit.OpCodes.Add);
+            il.Emit(System.Reflection.Emit.OpCodes.Starg, 0);
+            return;
           }
         case OpCodes.Call: {
@@ -479,4 +542,6 @@
           }
         case OpCodes.Variable: {
+            var nanResult = il.DefineLabel();
+            var normalResult = il.DefineLabel();
             VariableTreeNode varNode = (VariableTreeNode)currentInstr.dynamicNode;
             il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array
@@ -484,10 +549,24 @@
             il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref);
             il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // sampleIndex
+            il.Emit(System.Reflection.Emit.OpCodes.Dup);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0);
+            il.Emit(System.Reflection.Emit.OpCodes.Blt, nanResult);
+            il.Emit(System.Reflection.Emit.OpCodes.Dup);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, ds.Rows);
+            il.Emit(System.Reflection.Emit.OpCodes.Bge, nanResult);
             il.Emit(System.Reflection.Emit.OpCodes.Call, listGetValue);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, varNode.Weight); // load weight
             il.Emit(System.Reflection.Emit.OpCodes.Mul);
+            il.Emit(System.Reflection.Emit.OpCodes.Br, normalResult);
+            il.MarkLabel(nanResult);
+            il.Emit(System.Reflection.Emit.OpCodes.Pop); // sample index
+            il.Emit(System.Reflection.Emit.OpCodes.Pop); // column reference
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, double.NaN);
+            il.MarkLabel(normalResult);
             return;
           }
         case OpCodes.LagVariable: {
+            var nanResult = il.DefineLabel();
+            var normalResult = il.DefineLabel();
             LaggedVariableTreeNode varNode = (LaggedVariableTreeNode)currentInstr.dynamicNode;
             il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array
@@ -497,7 +576,19 @@
             il.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); // sampleIndex
             il.Emit(System.Reflection.Emit.OpCodes.Add); // row = sampleIndex + sampleOffset
+            il.Emit(System.Reflection.Emit.OpCodes.Dup);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0);
+            il.Emit(System.Reflection.Emit.OpCodes.Blt, nanResult);
+            il.Emit(System.Reflection.Emit.OpCodes.Dup);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, ds.Rows);
+            il.Emit(System.Reflection.Emit.OpCodes.Bge, nanResult);
             il.Emit(System.Reflection.Emit.OpCodes.Call, listGetValue);
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, varNode.Weight); // load weight
             il.Emit(System.Reflection.Emit.OpCodes.Mul);
+            il.Emit(System.Reflection.Emit.OpCodes.Br, normalResult);
+            il.MarkLabel(nanResult);
+            il.Emit(System.Reflection.Emit.OpCodes.Pop); // sample index
+            il.Emit(System.Reflection.Emit.OpCodes.Pop); // column reference
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, double.NaN);
+            il.MarkLabel(normalResult);
             return;
           }
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs	(revision 6808)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs	(revision 6809)
@@ -43,5 +43,5 @@
     public override IDeepCloneable Clone(Cloner cloner) { return new TimeLag(this, cloner); }
 
-    public TimeLag() : base("TimeLag", "Represents a symblol whose evaluation is shifted.") { }
+    public TimeLag() : base("TimeLag", "Represents a symbol whose evaluation is shifted.") { }
   }
 }
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs	(revision 6808)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs	(revision 6809)
@@ -110,5 +110,14 @@
         { 1.0, 1.0, 1.0 },
         { 2.0, 2.0, 2.0 },
-        { 3.0, 1.0, 2.0 }
+        { 3.0, 1.0, 2.0 },
+        { 4.0, 1.0, 1.0 },
+        { 5.0, 2.0, 2.0 },
+        { 6.0, 1.0, 2.0 },
+        { 7.0, 1.0, 1.0 },
+        { 8.0, 2.0, 2.0 },
+        { 9.0, 1.0, 2.0 },
+        { 10.0, 1.0, 1.0 },
+        { 11.0, 2.0, 2.0 },
+        { 12.0, 1.0, 2.0 }
       });
 
@@ -124,5 +133,14 @@
         { 1.0, 1.0, 1.0 },
         { 2.0, 2.0, 2.0 },
-        { 3.0, 1.0, 2.0 }
+        { 3.0, 1.0, 2.0 },
+        { 4.0, 1.0, 1.0 },
+        { 5.0, 2.0, 2.0 },
+        { 6.0, 1.0, 2.0 },
+        { 7.0, 1.0, 1.0 },
+        { 8.0, 2.0, 2.0 },
+        { 9.0, 1.0, 2.0 },
+        { 10.0, 1.0, 1.0 },
+        { 11.0, 2.0, 2.0 },
+        { 12.0, 1.0, 2.0 }
       });
 
@@ -297,4 +315,28 @@
       Evaluate(interpreter, ds, "(lagVariable 1.0 a 0) ", 2, ds.GetDoubleValue("A", 2));
       Evaluate(interpreter, ds, "(lagVariable 1.0 a 1) ", 0, ds.GetDoubleValue("A", 1));
+
+      // integral
+      Evaluate(interpreter, ds, "(integral -1.0 (variable 1.0 a)) ", 1, ds.GetDoubleValue("A", 0) + ds.GetDoubleValue("A", 1));
+      Evaluate(interpreter, ds, "(integral -1.0 (lagVariable 1.0 a 1)) ", 1, ds.GetDoubleValue("A", 1) + ds.GetDoubleValue("A", 2));
+      Evaluate(interpreter, ds, "(integral -2.0 (variable 1.0 a)) ", 2, ds.GetDoubleValue("A", 0) + ds.GetDoubleValue("A", 1) + ds.GetDoubleValue("A", 2));
+      Evaluate(interpreter, ds, "(integral -1.0 (* (variable 1.0 a) (variable 1.0 b)))", 1, ds.GetDoubleValue("A", 0) * ds.GetDoubleValue("B", 0) + ds.GetDoubleValue("A", 1) * ds.GetDoubleValue("B", 1));
+      Evaluate(interpreter, ds, "(integral -2.0 3.0)", 1, 9.0);
+
+      // derivative
+      // (f_0 + 2 * f_1 - 2 * f_3 - f_4) / 8; // h = 1
+      Evaluate(interpreter, ds, "(diff (variable 1.0 a)) ", 5, (ds.GetDoubleValue("A", 5) + 2 * ds.GetDoubleValue("A", 4) - 2 * ds.GetDoubleValue("A", 2) - ds.GetDoubleValue("A", 1)) / 8.0);
+      Evaluate(interpreter, ds, "(diff (variable 1.0 b)) ", 5, (ds.GetDoubleValue("B", 5) + 2 * ds.GetDoubleValue("B", 4) - 2 * ds.GetDoubleValue("B", 2) - ds.GetDoubleValue("B", 1)) / 8.0);
+      Evaluate(interpreter, ds, "(diff (* (variable 1.0 a) (variable 1.0 b)))", 5, +
+        (ds.GetDoubleValue("A", 5) * ds.GetDoubleValue("B", 5) +
+        2 * ds.GetDoubleValue("A", 4) * ds.GetDoubleValue("B", 4) -
+        2 * ds.GetDoubleValue("A", 2) * ds.GetDoubleValue("B", 2) -
+        ds.GetDoubleValue("A", 1) * ds.GetDoubleValue("B", 1)) / 8.0);
+      Evaluate(interpreter, ds, "(diff -2.0 3.0)", 5, 0.0);
+
+      // timelag
+      Evaluate(interpreter, ds, "(lag -1.0 (lagVariable 1.0 a 2)) ", 1, ds.GetDoubleValue("A", 2));
+      Evaluate(interpreter, ds, "(lag -2.0 (lagVariable 1.0 a 2)) ", 2, ds.GetDoubleValue("A", 2));
+      Evaluate(interpreter, ds, "(lag -1.0 (* (lagVariable 1.0 a 1) (lagVariable 1.0 b 2)))", 1, ds.GetDoubleValue("A", 1) * ds.GetDoubleValue("B", 2));
+      Evaluate(interpreter, ds, "(lag -2.0 3.0)", 1, 3.0);
     }
 
@@ -305,4 +347,6 @@
       double actual = interpreter.GetSymbolicExpressionTreeValues(tree, ds, Enumerable.Range(index, 1)).First();
 
+      Assert.IsFalse(double.IsNaN(actual) && !double.IsNaN(expected));
+      Assert.IsFalse(!double.IsNaN(actual) && double.IsNaN(expected));
       Assert.AreEqual(expected, actual, 1.0E-12, expr);
     }
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicExpressionImporter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicExpressionImporter.cs	(revision 6808)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicExpressionImporter.cs	(revision 6809)
@@ -29,8 +29,10 @@
   internal class SymbolicExpressionImporter {
     private const string VARSTART = "VAR";
-    private const string LAGGEDVARSTART = "LAG";
+    private const string LAGGEDVARSTART = "LAGVARIABLE";
+    private const string INTEGRALSTART = "INTEG";
     private const string DEFUNSTART = "DEFUN";
     private const string ARGSTART = "ARG";
     private const string INVOKESTART = "CALL";
+    private const string TIMELAGSTART = "LAG";
     private Dictionary<string, Symbol> knownSymbols = new Dictionary<string, Symbol>() 
       {
@@ -53,4 +55,5 @@
         {"OR", new Or()},
         {"NOT", new Not()},
+        {"DIFF", new Derivative()},
         {"PROG", new ProgramRootSymbol()},
         {"MAIN", new StartSymbol()},
@@ -61,4 +64,6 @@
     LaggedVariable laggedVariable = new LaggedVariable();
     Defun defun = new Defun();
+    TimeLag timeLag = new TimeLag();
+    Integral integral = new Integral();
 
     ProgramRootSymbol programRootSymbol = new ProgramRootSymbol();
@@ -100,4 +105,10 @@
         } else if (tokens.Peek().StringValue.StartsWith(LAGGEDVARSTART)) {
           tree = ParseLaggedVariable(tokens);
+        } else if (tokens.Peek().StringValue.StartsWith(TIMELAGSTART)) {
+          tree = ParseTimeLag(tokens);
+          tree.AddSubtree(ParseSexp(tokens));
+        } else if (tokens.Peek().StringValue.StartsWith(INTEGRALSTART)) {
+          tree = ParseIntegral(tokens);
+          tree.AddSubtree(ParseSexp(tokens));
         } else if (tokens.Peek().StringValue.StartsWith(DEFUNSTART)) {
           tree = ParseDefun(tokens);
@@ -152,4 +163,20 @@
     }
 
+    private ISymbolicExpressionTreeNode ParseTimeLag(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "LAG");
+      LaggedTreeNode t = (LaggedTreeNode)timeLag.CreateTreeNode();
+      t.Lag = (int)tokens.Dequeue().DoubleValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseIntegral(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "INTEGRAL");
+      LaggedTreeNode t = (LaggedTreeNode)integral.CreateTreeNode();
+      t.Lag = (int)tokens.Dequeue().DoubleValue;
+      return t;
+    }
+
     private ISymbolicExpressionTreeNode ParseVariable(Queue<Token> tokens) {
       Token varTok = tokens.Dequeue();
