summaryrefslogtreecommitdiff
path: root/book/examples/chapter3
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2011-01-11 15:46:43 +0000
committeraarne <aarne@chalmers.se>2011-01-11 15:46:43 +0000
commite7439d65b0e153434d3acc07df6e2a0972ee79ca (patch)
tree36716eec18256eeb600b4a552d9cc80f8ad7f16f /book/examples/chapter3
parent276327f7f264e770478a6d8c6e683266505b0a55 (diff)
gf-book web page index and toc
Diffstat (limited to 'book/examples/chapter3')
-rw-r--r--book/examples/chapter3/Arabic.gf118
-rw-r--r--book/examples/chapter3/Discont.gf11
-rw-r--r--book/examples/chapter3/DiscontEng.gf21
-rw-r--r--book/examples/chapter3/Foods.gf13
-rw-r--r--book/examples/chapter3/FoodsEng.gf40
-rw-r--r--book/examples/chapter3/FoodsIta.gf32
-rw-r--r--book/examples/chapter3/ResIta.gf36
7 files changed, 0 insertions, 271 deletions
diff --git a/book/examples/chapter3/Arabic.gf b/book/examples/chapter3/Arabic.gf
deleted file mode 100644
index e00d02c23..000000000
--- a/book/examples/chapter3/Arabic.gf
+++ /dev/null
@@ -1,118 +0,0 @@
-resource Arabic = {
-oper
- Root : Type = {F,C,L : Str} ;
- Pattern : Type = Root -> Str ;
-
- Filling : Type = {F,FC,CL,L : Str} ;
-
- fill : Filling -> Root -> Str = \p,r ->
- p.F + r.F + p.FC + r.C + p.CL + r.L + p.L ;
-
- dfill : Filling -> Root -> Str = \p,r ->
- p.F + r.F + p.FC + r.C + r.C + p.CL + r.L + p.L ;
-
- getRoot : Str -> Root = \s -> case s of {
- F@? + C@? + L@? => {F = F ; C = C ; L = L} ;
- _ => Predef.error ("cannot get root from" ++ s)
- } ;
-
- getPattern : Str -> Pattern = \s -> case s of {
- F + "F" + FC + "CC" + CL + "L" + L =>
- dfill {F = F ; FC = FC ; CL = CL ; L = L} ;
- F + "F" + FC + "C" + CL + "L" + L =>
- fill {F = F ; FC = FC ; CL = CL ; L = L} ;
- _ => Predef.error ("cannot get pattern from" ++ s)
- } ;
-
- word : Str -> Str -> Str = \p,r ->
- getPattern p (getRoot r) ;
-
-param
- Number = Sg | Dl | Pl ;
- Gender = Masc | Fem ;
- Tense = Perf | Impf ;
-
- VPer = Vp3 Number Gender | Vp2Sg Gender | Vp2Dl | Vp2Pl Gender | Vp1Sg | Vp1Pl ;
-
-oper
- Verb : Type = {s : Tense => VPer => Str} ;
-
- pattV_u : Tense -> VPer -> Pattern = \t,v -> getPattern (case t of {
- Perf => case v of {
- Vp3 Sg Masc => "FaCaLa" ;
- Vp3 Sg Fem => "FaCaLat" ;
- Vp3 Dl Masc => "FaCaLaA" ;
- Vp3 Dl Fem => "FaCaLataA" ;
- Vp3 Pl Masc => "FaCaLuwA" ;
- Vp3 Pl Fem => "FaCaLona" ;
-
- Vp2Sg Masc => "FaCaLota" ;
- Vp2Sg Fem => "FaCaLoti" ;
- Vp2Dl => "FaCaLotumaA" ;
- Vp2Pl Masc => "FaCaLotum" ;
- Vp2Pl Fem => "FaCaLotunv2a" ;
-
- Vp1Sg => "FaCaLotu" ;
- Vp1Pl => "FaCaLonaA"
- } ;
- Impf => case v of {
- Vp3 Sg Masc => "yaFoCuLu" ;
- Vp3 Sg Fem => "taFoCuLu" ;
- Vp3 Dl Masc => "yaFoCuLaAni" ;
- Vp3 Dl Fem => "taFoCuLaAni" ;
- Vp3 Pl Masc => "yaFoCuLuwna" ;
- Vp3 Pl Fem => "yaFoCuLna" ;
-
- Vp2Sg Masc => "taFoCuLu" ;
- Vp2Sg Fem => "taFoCuLiyna" ;
- Vp2Dl => "taFoCuLaAni" ;
- Vp2Pl Masc => "taFoCuLuwna" ;
- Vp2Pl Fem => "taFoCuLona" ;
-
- Vp1Sg => "A?aFoCuLu" ;
- Vp1Pl => "naFoCuLu"
- }
- }) ;
-
- u_Verb : Str -> Verb = \s -> {
- s = \\t,p => pattV_u t p (getRoot s) ;
- } ;
-
--- for html
-
- tag : Str -> Str = \t -> "<" + t + ">" ;
- etag : Str -> Str = \t -> "</" + t + ">" ;
- atag : Str -> Str -> Str = \t,a -> "<" + t ++ a + ">" ;
-
- intag : Str -> Str -> Str = \t,s -> tag t ++ s ++ etag t ;
- intagAttr : Str -> Str -> Str -> Str = \t,a,s -> atag t a ++ s ++ etag t ;
-
- verbTable : Verb -> Str = \v ->
- let
- vsp = v.s ! Perf ;
- vsi = v.s ! Impf ;
- tr : Str -> Str = intag "tr" ;
- td : Str -> Str = intag "td" ;
- ts : Str -> Str = \s -> td ("\"" ++ s ++ "\"") ;
- trs : Str -> Str -> VPer -> Str = \s,n,v ->
- tr (td s ++ td n ++ ts (vsp ! v) ++ ts (vsi ! v))
- in
- intagAttr "table" "border=1" (
- tr ((td "Persona") ++ (td "Numerus") ++ (td "Perfectum") ++ (td "Imperfectum")) ++
- trs "3. masc." "sing." (Vp3 Sg Masc) ++
- trs "3. fem." "sing." (Vp3 Sg Fem) ++
- trs "2. masc." "sing." (Vp2Sg Masc) ++
- trs "2. fem." "sing." (Vp2Sg Fem) ++
- trs "1." "sing." (Vp1Sg) ++
- trs "3. masc." "dual." (Vp3 Dl Masc) ++
- trs "3. fem." "dual." (Vp3 Dl Fem) ++
- trs "2." "dual." (Vp2Dl) ++
- trs "3. masc." "plur." (Vp3 Pl Masc) ++
- trs "3. fem." "plur." (Vp3 Pl Fem) ++
- trs "2. masc." "plur." (Vp2Pl Masc) ++
- trs "2. fem." "plur." (Vp2Pl Fem) ++
- trs "1." "plur." (Vp1Pl)
- ) ;
-
-
-}
diff --git a/book/examples/chapter3/Discont.gf b/book/examples/chapter3/Discont.gf
deleted file mode 100644
index 879bedc4c..000000000
--- a/book/examples/chapter3/Discont.gf
+++ /dev/null
@@ -1,11 +0,0 @@
-abstract Discont = {
- cat
- S ; Cl ; NP ; VP ; AP ;
- fun
- DeclCl : Cl -> S ;
- QuestCl : Cl -> S ;
- PredVP : NP -> VP -> Cl ;
- CompAP : AP -> VP ;
- John : NP ;
- Old : AP ;
-}
diff --git a/book/examples/chapter3/DiscontEng.gf b/book/examples/chapter3/DiscontEng.gf
deleted file mode 100644
index 93d70a02c..000000000
--- a/book/examples/chapter3/DiscontEng.gf
+++ /dev/null
@@ -1,21 +0,0 @@
-concrete DiscontEng of Discont = {
- param
- SForm = SDecl | SQuest ;
- lincat
- S, NP, AP = Str ;
- Cl = SForm => Str ;
- VP = {verb,comp : Str} ;
- lin
- DeclCl cl = cl ! SDecl ;
- QuestCl cl = cl ! SQuest ;
- PredVP np vp = table {
- SDecl => np ++ vp.verb ++ vp.comp ;
- SQuest => vp.verb ++ np ++ vp.comp
- } ;
- CompAP ap = {
- verb = "is" ;
- comp = ap
- } ;
- John = "John" ;
- Old = "old" ;
-}
diff --git a/book/examples/chapter3/Foods.gf b/book/examples/chapter3/Foods.gf
deleted file mode 100644
index e60f0ea09..000000000
--- a/book/examples/chapter3/Foods.gf
+++ /dev/null
@@ -1,13 +0,0 @@
-abstract Foods = {
- flags startcat = Comment ;
- cat
- Comment ; Item ; Kind ; Quality ;
- fun
- Pred : Item -> Quality -> Comment ;
- This, That, These, Those : Kind -> Item ;
- Mod : Quality -> Kind -> Kind ;
- Wine, Cheese, Fish, Pizza : Kind ;
- Very : Quality -> Quality ;
- Fresh, Warm, Italian,
- Expensive, Delicious, Boring : Quality ;
-}
diff --git a/book/examples/chapter3/FoodsEng.gf b/book/examples/chapter3/FoodsEng.gf
deleted file mode 100644
index 82bae2148..000000000
--- a/book/examples/chapter3/FoodsEng.gf
+++ /dev/null
@@ -1,40 +0,0 @@
-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"} ;
-}
diff --git a/book/examples/chapter3/FoodsIta.gf b/book/examples/chapter3/FoodsIta.gf
deleted file mode 100644
index 6f7015694..000000000
--- a/book/examples/chapter3/FoodsIta.gf
+++ /dev/null
@@ -1,32 +0,0 @@
-concrete FoodsIta of Foods = open ResIta in {
- lincat
- Comment = {s : Str} ;
- Quality = Adjective ;
- Kind = Noun ;
- Item = NounPhrase ;
- lin
- Pred item quality =
- {s = item.s ++ copula ! item.n ++
- quality.s ! item.g ! item.n} ;
- This = det Sg "questo" "questa" ;
- That = det Sg "quel" "quella" ;
- These = det Pl "questi" "queste" ;
- Those = det Pl "quei" "quelle" ;
- Mod quality kind = {
- s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ;
- g = kind.g
- } ;
- Wine = noun "vino" "vini" Masc ;
- Cheese = noun "formaggio" "formaggi" Masc ;
- Fish = noun "pesce" "pesci" Masc ;
- Pizza = noun "pizza" "pizze" Fem ;
- Very qual = {s = \\g,n => "molto" ++ qual.s ! g ! n} ;
- Fresh =
- adjective "fresco" "fresca" "freschi" "fresche" ;
- Warm = regAdj "caldo" ;
- Italian = regAdj "italiano" ;
- Expensive = regAdj "caro" ;
- Delicious = regAdj "delizioso" ;
- Boring = regAdj "noioso" ;
-}
-
diff --git a/book/examples/chapter3/ResIta.gf b/book/examples/chapter3/ResIta.gf
deleted file mode 100644
index 17809c498..000000000
--- a/book/examples/chapter3/ResIta.gf
+++ /dev/null
@@ -1,36 +0,0 @@
-resource ResIta = open Prelude in {
- param
- Number = Sg | Pl ;
- Gender = Masc | Fem ;
- oper
- NounPhrase : Type =
- {s : Str ; g : Gender ; n : Number} ;
- Noun : Type = {s : Number => Str ; g : Gender} ;
- Adjective : Type = {s : Gender => Number => Str} ;
-
- det : Number -> Str -> Str -> Noun -> NounPhrase =
- \n,m,f,cn -> {
- s = table {Masc => m ; Fem => f} ! cn.g ++
- cn.s ! n ;
- g = cn.g ;
- n = n
- } ;
- noun : Str -> Str -> Gender -> Noun =
- \vino,vini,g -> {
- s = table {Sg => vino ; Pl => vini} ;
- g = g
- } ;
- adjective : (nero,nera,neri,nere : Str) -> Adjective =
- \nero,nera,neri,nere -> {
- s = table {
- Masc => table {Sg => nero ; Pl => neri} ;
- Fem => table {Sg => nera ; Pl => nere}
- }
- } ;
- regAdj : Str -> Adjective = \nero ->
- let ner : Str = init nero
- in
- adjective nero (ner+"a") (ner+"i") (ner+"e") ;
- copula : Number => Str =
- table {Sg => "è" ; Pl => "sono"} ;
-}