mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
completed book examples
This commit is contained in:
10
book/examples/chapter7/Map.gf
Normal file
10
book/examples/chapter7/Map.gf
Normal file
@@ -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 ;
|
||||
}
|
||||
17
book/examples/chapter7/MapEng.gf
Normal file
17
book/examples/chapter7/MapEng.gf
Normal file
@@ -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 ++ ")"} ;
|
||||
}
|
||||
Reference in New Issue
Block a user