new tutorial example

This commit is contained in:
aarne
2005-12-18 21:26:21 +00:00
parent e4314a739d
commit de6b09f650
34 changed files with 940 additions and 668 deletions

14
doc/tutorial/Food.gf Normal file
View File

@@ -0,0 +1,14 @@
abstract Food = {
cat
S ; Item ; Kind ; Quality ;
fun
Is : Item -> Quality -> S ;
This, That : Kind -> Item ;
QKind : Quality -> Kind -> Kind ;
Wine, Cheese, Fish : Kind ;
Very : Quality -> Quality ;
Fresh, Warm, Italian, Expensive, Delicious, Boring : Quality ;
}

23
doc/tutorial/Food2Eng.gf Normal file
View File

@@ -0,0 +1,23 @@
concrete Food2Eng of Food = open StringOper in {
lincat
S, Item, Kind, Quality = SS ;
lin
Is item quality = cc item (prefix "is" quality) ;
This = prefix "this" ;
That = prefix "that" ;
QKind = cc ;
Wine = ss "wine" ;
Cheese = ss "cheese" ;
Fish = ss "fish" ;
Very = prefix "very" ;
Fresh = ss "fresh" ;
Warm = ss "warm" ;
Italian = ss "Italian" ;
Expensive = ss "expensive" ;
Delicious = ss "delicious" ;
Boring = ss "boring" ;
}

23
doc/tutorial/FoodEng.gf Normal file
View File

@@ -0,0 +1,23 @@
concrete FoodEng of Food = {
lincat
S, Item, Kind, Quality = {s : Str} ;
lin
Is item quality = {s = item.s ++ "is" ++ quality.s} ;
This kind = {s = "this" ++ kind.s} ;
That kind = {s = "that" ++ kind.s} ;
QKind quality kind = {s = quality.s ++ kind.s} ;
Wine = {s = "wine"} ;
Cheese = {s = "cheese"} ;
Fish = {s = "fish"} ;
Very quality = {s = "very" ++ quality.s} ;
Fresh = {s = "fresh"} ;
Warm = {s = "warm"} ;
Italian = {s = "Italian"} ;
Expensive = {s = "expensive"} ;
Delicious = {s = "delicious"} ;
Boring = {s = "boring"} ;
}

22
doc/tutorial/FoodIta.gf Normal file
View File

@@ -0,0 +1,22 @@
concrete FoodIta of Food = {
lincat
S, Item, Kind, Quality = {s : Str} ;
lin
Is item quality = {s = item.s ++ "è" ++ quality.s} ;
This kind = {s = "questo" ++ kind.s} ;
That kind = {s = "quello" ++ kind.s} ;
QKind quality kind = {s = kind.s ++ quality.s} ;
Wine = {s = "vino"} ;
Cheese = {s = "formaggio"} ;
Fish = {s = "pesce"} ;
Very quality = {s = "molto" ++ quality.s} ;
Fresh = {s = "fresco"} ;
Warm = {s = "caldo"} ;
Italian = {s = "italiano"} ;
Expensive = {s = "caro"} ;
Delicious = {s = "delizioso"} ;
Boring = {s = "noioso"} ;
}

View File

@@ -0,0 +1,5 @@
abstract Foodmarket = Food, Fruit, Mushroom ** {
fun
FruitKind : Fruit -> Kind ;
MushroomKind : Mushroom -> Kind ;
}

View File

@@ -0,0 +1,5 @@
concrete FoodmarketEng of Foodmarket = FoodEng, FruitEng, MushroomEng ** {
lin
FruitKind x = x ;
MushroomKind x = x ;
}

14
doc/tutorial/Foods.gf Normal file
View File

@@ -0,0 +1,14 @@
abstract Foods = {
cat
S ; Item ; Kind ; Quality ;
fun
Is : Item -> Quality -> S ;
This, That, All, Most : Kind -> Item ;
QKind : Quality -> Kind -> Kind ;
Wine, Cheese, Fish : Kind ;
Very : Quality -> Quality ;
Fresh, Warm, Italian, Expensive, Delicious, Boring : Quality ;
}

35
doc/tutorial/FoodsEng.gf Normal file
View File

@@ -0,0 +1,35 @@
--# -path=.:prelude
concrete FoodsEng of Foods = open Prelude, MorphoEng in {
lincat
S, Quality = SS ;
Kind = {s : Number => Str} ;
Item = {s : Str ; n : Number} ;
lin
Is item quality = ss (item.s ++ (mkVerb "are" "is").s ! item.n ++ quality.s) ;
This = det Sg "this" ;
That = det Sg "that" ;
All = det Pl "all" ;
Most = det Pl "most" ;
QKind quality kind = {s = \\n => quality.s ++ kind.s ! n} ;
Wine = regNoun "wine" ;
Cheese = regNoun "cheese" ;
Fish = mkNoun "fish" "fish" ;
Very = prefixSS "very" ;
Fresh = ss "fresh" ;
Warm = ss "warm" ;
Italian = ss "Italian" ;
Expensive = ss "expensive" ;
Delicious = ss "delicious" ;
Boring = ss "boring" ;
oper
det : Number -> Str -> Noun -> {s : Str ; n : Number} = \n,d,cn -> {
s = d ++ cn.s ! n ;
n = n
} ;
}

4
doc/tutorial/Fruit.gf Normal file
View File

@@ -0,0 +1,4 @@
abstract Fruit = {
cat Fruit ;
fun Apple, Peach : Fruit ;
}

5
doc/tutorial/FruitEng.gf Normal file
View File

@@ -0,0 +1,5 @@
concrete FruitEng of Fruit = {
lin
Apple = {s = "apple"} ;
Peach = {s = "peach"} ;
}

8
doc/tutorial/Morefood.gf Normal file
View File

@@ -0,0 +1,8 @@
abstract Morefood = Food ** {
cat
Question ;
fun
QIs : Item -> Quality -> Question ;
Pizza : Kind ;
}

View File

@@ -0,0 +1,7 @@
concrete MorefoodEng of Morefood = FoodEng ** {
lincat
Question = {s : Str} ;
lin
QIs item quality = {s = "is" ++ item.s ++ quality.s} ;
Pizza = {s = "pizza"} ;
}

4
doc/tutorial/Mushroom.gf Normal file
View File

@@ -0,0 +1,4 @@
abstract Mushroom = {
cat Mushroom ;
fun Cep, Agaric : Mushroom ;
}

View File

@@ -0,0 +1,5 @@
concrete MushroomEng of Mushroom = {
lin
Cep = {s = "cep"} ;
Agaric = {s = "agaric"} ;
}

View File

@@ -0,0 +1,10 @@
resource StringOper = {
oper
SS : Type = {s : Str} ;
ss : Str -> SS = \x -> {s = x} ;
cc : SS -> SS -> SS = \x,y -> ss (x.s ++ y.s) ;
prefix : Str -> SS -> SS = \p,x -> ss (p ++ x.s) ;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

6
doc/tutorial/food.cf Normal file
View File

@@ -0,0 +1,6 @@
S ::= Item "is" Quality ;
Item ::= "this" Kind | "that" Kind ;
Kind ::= Quality Kind ;
Kind ::= "wine" | "cheese" | "fish" ;
Quality ::= "very" Quality ;
Quality ::= "fresh" | "warm" | "Italian" | "expensive" | "delicious" | "boring" ;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,23 @@
PredVP. S ::= NP VP ;
UseV. VP ::= V ;
ComplTV. VP ::= TV NP ;
UseA. VP ::= "is" A ;
This. NP ::= "this" CN ;
That. NP ::= "that" CN ;
Def. NP ::= "the" CN ;
Indef. NP ::= "a" CN ;
ModA. CN ::= A CN ;
Boy. CN ::= "boy" ;
Louse. CN ::= "louse" ;
Snake. CN ::= "snake" ;
Worm. CN ::= "worm" ;
Green. A ::= "green" ;
Rotten. A ::= "rotten" ;
Thick. A ::= "thick" ;
Warm. A ::= "warm" ;
Laugh. V ::= "laughs" ;
Sleep. V ::= "sleeps" ;
Swim. V ::= "swims" ;
Eat. TV ::= "eats" ;
Kill. TV ::= "kills"
Wash. TV ::= "washes" ;

View File

@@ -1,8 +0,0 @@
S ::= NP VP ;
VP ::= V | TV NP | "is" A ;
NP ::= "this" CN | "that" CN | "the" CN | "a" CN ;
CN ::= A CN ;
CN ::= "boy" | "louse" | "snake" | "worm" ;
A ::= "green" | "rotten" | "thick" | "warm" ;
V ::= "laughs" | "sleeps" | "swims" ;
TV ::= "eats" | "kills" | "washes" ;