mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
completed book examples
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
--# -path=alltenses
|
||||
--# -path=.:present
|
||||
|
||||
concrete GeometryEng of Geometry = LogicEng **
|
||||
open SyntaxEng, ParadigmsEng in {
|
||||
|
||||
7
book/examples/chapter8/Graftal.gf
Normal file
7
book/examples/chapter8/Graftal.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
-- (c) Krasimir Angelov 2009
|
||||
abstract Graftal = {
|
||||
cat N; S;
|
||||
fun z : N ;
|
||||
s : N -> N ;
|
||||
c : N -> S ;
|
||||
}
|
||||
16
book/examples/chapter8/Sierpinski.gf
Normal file
16
book/examples/chapter8/Sierpinski.gf
Normal file
@@ -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" ;
|
||||
}
|
||||
Reference in New Issue
Block a user