예제 #1
0
 public void Test()
 {
     string code = "(+ 7 10 (* 2 8))";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToFloat());
 }
예제 #2
0
 public void Test(string code, float extected)
 {
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     float result = func.TryEvaluateToFloat();
     Debug.WriteLine(func.BuildParseTree().ToCode() + " => " + result);
     result.Should().Be(extected);
 }
예제 #3
0
 public void BoolTest()
 {
     string code = "(And True False)";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToBool());
 }
예제 #4
0
 public void Test(string code, float extected)
 {
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     float result = func.TryEvaluateToFloat();
     Debug.WriteLine(func.BuildParseTree().ToCode() + " => " + result);
     result.Should().Be(extected);
 }
예제 #5
0
 public void BoolTest()
 {
     string code = "(And True False)";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToBool());
 }
예제 #6
0
 public void Test3()
 {
     string code = "5";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     func.Should().BeOfType<IntConstant<Blackboard>>();
 }
예제 #7
0
 public void Test2()
 {
     string code = "(* 2 Pi (+ A B))";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToFloat());
 }
예제 #8
0
 public void Test3()
 {
     string code = "5";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     func.Should().BeOfType<IntConstant<Blackboard>>();
 }