diff options
Diffstat (limited to 'book/examples/chapter7')
| -rw-r--r-- | book/examples/chapter7/Map.gf | 10 | ||||
| -rw-r--r-- | book/examples/chapter7/MapEng.gf | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/book/examples/chapter7/Map.gf b/book/examples/chapter7/Map.gf new file mode 100644 index 000000000..52deebb87 --- /dev/null +++ b/book/examples/chapter7/Map.gf @@ -0,0 +1,10 @@ +abstract Map = { +flags startcat = Query ; +cat + Query ; Input ; Place ; Click ; +fun + GoFromTo : Place -> Place -> Input ; + ThisPlace : Click -> Place ; + QueryInput : Input -> Query ; + ClickCoord : Int -> Int -> Click ; +} diff --git a/book/examples/chapter7/MapEng.gf b/book/examples/chapter7/MapEng.gf new file mode 100644 index 000000000..fee0b502c --- /dev/null +++ b/book/examples/chapter7/MapEng.gf @@ -0,0 +1,17 @@ +concrete MapEng of Map = { +lincat + Query = {s : Str} ; + Input, Place = {s : Str ; p : Str} ; + Click = {p : Str} ; +lin + GoFromTo x y = { + s = "I want to go from" ++ x.s ++ "to" ++ y.s ; + p = x.p ++ y.p + } ; + ThisPlace c = { + s = "this place" ; + p = c.p + } ; + QueryInput i = {s = i.s ++ ";" ++ i.p} ; + ClickCoord x y = {p = "(" ++ x.s ++ "," ++ y.s ++ ")"} ; +} |
