]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation3.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Transformation3.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation3.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation3.scl
new file mode 100644 (file)
index 0000000..f9b995c
--- /dev/null
@@ -0,0 +1,32 @@
+import "StandardLibrary"
+
+mapping relation Fib Integer Integer
+
+rule FibRecurrence where
+    @when
+    Fib ?n (?a + ?b)
+    ?n >= 2
+    
+    @where
+    Fib (?n-1) ?b
+    Fib (?n-2) ?a
+
+rule Init where
+    @when
+    Fib ?x 1
+    ?x < 2
+    
+rule Seed where
+    @where
+    Fib 20 ?hmm
+
+rule PrintIt where
+    @when
+    Fib ?n ?a
+    
+    @to
+    Execute (print "\(?n) -> \(?a)")
+
+main = transformation OneShotForward where
+--
+()