summaryrefslogtreecommitdiff
path: root/book/examples/chapter8
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-11-22 15:48:52 +0000
committeraarne <aarne@chalmers.se>2010-11-22 15:48:52 +0000
commit67176f1520d8ac68a00b5266092fcd31a82f4bd8 (patch)
tree6309b8ccfedb458fec7f9772e01b496975e0389f /book/examples/chapter8
parent76ba03b545600054176612201de78dca16eb65e1 (diff)
completed book examples
Diffstat (limited to 'book/examples/chapter8')
-rw-r--r--book/examples/chapter8/GeometryEng.gf2
-rw-r--r--book/examples/chapter8/Graftal.gf7
-rw-r--r--book/examples/chapter8/Sierpinski.gf16
3 files changed, 24 insertions, 1 deletions
diff --git a/book/examples/chapter8/GeometryEng.gf b/book/examples/chapter8/GeometryEng.gf
index 36d840303..e2e22776e 100644
--- a/book/examples/chapter8/GeometryEng.gf
+++ b/book/examples/chapter8/GeometryEng.gf
@@ -1,4 +1,4 @@
---# -path=alltenses
+--# -path=.:present
concrete GeometryEng of Geometry = LogicEng **
open SyntaxEng, ParadigmsEng in {
diff --git a/book/examples/chapter8/Graftal.gf b/book/examples/chapter8/Graftal.gf
new file mode 100644
index 000000000..e85b9b2f7
--- /dev/null
+++ b/book/examples/chapter8/Graftal.gf
@@ -0,0 +1,7 @@
+-- (c) Krasimir Angelov 2009
+abstract Graftal = {
+ cat N; S;
+ fun z : N ;
+ s : N -> N ;
+ c : N -> S ;
+ }
diff --git a/book/examples/chapter8/Sierpinski.gf b/book/examples/chapter8/Sierpinski.gf
new file mode 100644
index 000000000..722088ce5
--- /dev/null
+++ b/book/examples/chapter8/Sierpinski.gf
@@ -0,0 +1,16 @@
+concrete Sierpinski of Graftal = {
+ lincat N = {a : Str; b : Str} ;
+ lincat S = {s : Str} ;
+
+ lin z = {a = A; b = B} ;
+ lin s x = {
+ a = x.b ++ R ++ x.a ++ R ++ x.b ;
+ b = x.a ++ L ++ x.b ++ L ++ x.a
+ } ;
+ lin c x = {s = "newpath 300 550 moveto" ++ x.a ++ "stroke showpage"} ;
+
+ oper A : Str = "0 2 rlineto" ;
+ oper B : Str = "0 2 rlineto" ;
+ oper L : Str = "+60 rotate" ;
+ oper R : Str = "-60 rotate" ;
+}