summaryrefslogtreecommitdiff
path: root/book/examples/chapter3/FoodsEng.gf
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-11-22 12:55:37 +0000
committeraarne <aarne@chalmers.se>2010-11-22 12:55:37 +0000
commit76ba03b545600054176612201de78dca16eb65e1 (patch)
tree5615286b239bee637b32465e9cbf36807ab2c318 /book/examples/chapter3/FoodsEng.gf
parent0bf41793694e8b3101d09e34858eba8ab2c8c5b6 (diff)
started a subdir for the book
Diffstat (limited to 'book/examples/chapter3/FoodsEng.gf')
-rw-r--r--book/examples/chapter3/FoodsEng.gf40
1 files changed, 40 insertions, 0 deletions
diff --git a/book/examples/chapter3/FoodsEng.gf b/book/examples/chapter3/FoodsEng.gf
new file mode 100644
index 000000000..82bae2148
--- /dev/null
+++ b/book/examples/chapter3/FoodsEng.gf
@@ -0,0 +1,40 @@
+concrete FoodsEng of Foods = {
+ lincat
+ Comment, Quality = {s : Str} ;
+ Kind = {s : Number => Str} ;
+ Item = {s : Str ; n : Number} ;
+ lin
+ Pred item quality =
+ {s = item.s ++ copula ! item.n ++ quality.s} ;
+ This = det Sg "this" ;
+ That = det Sg "that" ;
+ These = det Pl "these" ;
+ Those = det Pl "those" ;
+ Mod quality kind =
+ {s = \\n => quality.s ++ kind.s ! n} ;
+ Wine = regNoun "wine" ;
+ Cheese = regNoun "cheese" ;
+ Fish = noun "fish" "fish" ;
+ Pizza = regNoun "pizza" ;
+ Very a = {s = "very" ++ a.s} ;
+ Fresh = adj "fresh" ;
+ Warm = adj "warm" ;
+ Italian = adj "Italian" ;
+ Expensive = adj "expensive" ;
+ Delicious = adj "delicious" ;
+ Boring = adj "boring" ;
+ param
+ Number = Sg | Pl ;
+ oper
+ det : Number -> Str ->
+ {s : Number => Str} -> {s : Str ; n : Number} =
+ \n,det,noun -> {s = det ++ noun.s ! n ; n = n} ;
+ noun : Str -> Str -> {s : Number => Str} =
+ \man,men -> {s = table {Sg => man ; Pl => men}} ;
+ regNoun : Str -> {s : Number => Str} =
+ \car -> noun car (car + "s") ;
+ adj : Str -> {s : Str} =
+ \cold -> {s = cold} ;
+ copula : Number => Str =
+ table {Sg => "is" ; Pl => "are"} ;
+}