summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/summerschool/foods/CharactersGla.gf12
-rw-r--r--contrib/summerschool/foods/FoodsChi.gf35
-rw-r--r--contrib/summerschool/foods/FoodsGla.gf66
-rw-r--r--contrib/summerschool/foods/FoodsOri.gf30
-rw-r--r--contrib/summerschool/foods/MutationsGla.gf53
5 files changed, 196 insertions, 0 deletions
diff --git a/contrib/summerschool/foods/CharactersGla.gf b/contrib/summerschool/foods/CharactersGla.gf
new file mode 100644
index 000000000..453741a52
--- /dev/null
+++ b/contrib/summerschool/foods/CharactersGla.gf
@@ -0,0 +1,12 @@
+resource CharactersGla = {
+
+ --Character classes
+ oper
+ vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|""|""|""|""|"") ;
+ vowelCap : pattern Str = #("A"|"E"|"I"|"O"|"U"|""|""|""|""|"") ;
+ consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ;
+ consonantCap : pattern Str = #("B"|"C"|"D"|"F"|"G"|"H"|"J"|"K"|"L"|"M"|"N"|"P"|"Q"|"R"|"S"|"T"|"V"|"W"|"X"|"Z") ;
+ broadVowel : pattern Str = #("a"|"o"|"u"|""|""|"") ;
+ slenderVowel : pattern Str = #("e"|"i"|""|"") ;
+
+} \ No newline at end of file
diff --git a/contrib/summerschool/foods/FoodsChi.gf b/contrib/summerschool/foods/FoodsChi.gf
new file mode 100644
index 000000000..163aa0eb1
--- /dev/null
+++ b/contrib/summerschool/foods/FoodsChi.gf
@@ -0,0 +1,35 @@
+concrete FoodsChi of Foods = {
+flags coding = utf8 ;
+lincat
+ Comment, Item = Str ;
+ Kind = {s,c : Str} ;
+ Quality = {s,p : Str} ;
+lin
+ Pred item quality = item ++ "是" ++ quality.s ++ quality.p ;
+ This kind = "这" ++ kind.c ++ kind.s ;
+ That kind = "那" ++ kind.c ++ kind.s ;
+ These kind = "这" ++ "些" ++ kind.s ;
+ Those kind = "那" ++ "些" ++ kind.s ;
+ Mod quality kind = {
+ s = quality.s ++ quality.p ++ kind.s ;
+ c = kind.c
+ } ;
+ Wine = geKind "酒" ;
+ Pizza = geKind "比 萨 饼" ;
+ Cheese = geKind "奶 酪" ;
+ Fish = geKind "鱼" ;
+ Very quality = longQuality ("非 常" ++ quality.s) ;
+ Fresh = longQuality "新 鲜" ;
+ Warm = longQuality "温 热" ;
+ Italian = longQuality "意 大 利 式" ;
+ Expensive = longQuality "昂 贵" ;
+ Delicious = longQuality "美 味" ;
+ Boring = longQuality "难 吃" ;
+oper
+ mkKind : Str -> Str -> {s,c : Str} = \s,c ->
+ {s = s ; c = c} ;
+ geKind : Str -> {s,c : Str} = \s ->
+ mkKind s "个" ;
+ longQuality : Str -> {s,p : Str} = \s ->
+ {s = s ; p = "的"} ;
+}
diff --git a/contrib/summerschool/foods/FoodsGla.gf b/contrib/summerschool/foods/FoodsGla.gf
new file mode 100644
index 000000000..691b26bb8
--- /dev/null
+++ b/contrib/summerschool/foods/FoodsGla.gf
@@ -0,0 +1,66 @@
+concrete FoodsGla of Foods = open MutationsGla, CharactersGla, Prelude in {
+ param Gender = Masc|Fem ;
+ param Number = Sg|Pl ;
+ param Breadth = Broad|Slender|NoBreadth ;
+ param Beginning = Bcgmp|Other ;
+
+ lincat Comment = Str;
+ lin Pred item quality = "tha" ++ item ++ quality.s!Sg!Unmutated ;
+
+ lincat Item = Str;
+ lin
+ This kind = (addArticleSg kind) ++ "seo" ;
+ That kind = (addArticleSg kind) ++ "sin";
+ These kind = (addArticlePl kind) ++ "seo" ;
+ Those kind = (addArticlePl kind) ++ "sin" ;
+ oper addArticleSg : {s : Number => Mutation => Str; g : Gender} -> Str =
+ \kind -> case kind.g of { Masc => "an" ++ kind.s!Sg!PrefixT; Fem => "a'" ++ kind.s!Sg!Lenition1DNTLS } ;
+ oper addArticlePl : {s : Number => Mutation => Str; g : Gender} -> Str =
+ \kind -> "na" ++ kind.s!Pl!PrefixH ;
+
+ oper Noun : Type = {s : Number => Mutation => Str; g : Gender; pe : Breadth; beginning: Beginning; };
+ lincat Kind = Noun;
+ lin
+ Mod quality kind = {
+ s = table{
+ Sg => table{mutation => kind.s!Sg!mutation ++ case kind.g of {Masc => quality.s!Sg!Unmutated; Fem => quality.s!Sg!Lenition1} };
+ Pl => table{mutation => kind.s!Pl!mutation ++ case kind.pe of {Slender => quality.s!Pl!Lenition1; _ => quality.s!Pl!Unmutated} }
+ };
+ g = kind.g;
+ pe = kind.pe;
+ beginning = kind.beginning
+ } ;
+ Wine = makeNoun "fon" "fontan" Masc ;
+ Cheese = makeNoun "cise" "cisean" Masc ;
+ Fish = makeNoun "iasg" "isg" Masc ;
+ Pizza = makeNoun "pizza" "pizzathan" Masc ;
+ oper makeNoun : Str -> Str -> Gender -> Noun = \sg,pl,g -> {
+ s = table{Sg => (mutate sg); Pl => (mutate pl)};
+ g = g;
+ pe = pe;
+ beginning = Bcgmp
+ }
+ where {
+ pe : Breadth = case pl of {
+ _ + v@(#broadVowel) + c@(#consonant*) + #consonant => Broad;
+ _ + v@(#slenderVowel) + c@(#consonant*) + #consonant => Slender;
+ _ => NoBreadth
+ }
+ };
+
+ oper Adjective : Type = {s : Number => Mutation => Str; sVery : Number => Str};
+ lincat Quality = Adjective;
+ lin
+ Very quality = {s=table{number => table{_ => quality.sVery!number}}; sVery=quality.sVery } ;
+ Fresh = makeAdjective "r" "ra" ;
+ Warm = makeAdjective "blth" "bltha" ;
+ Italian = makeAdjective "Eadailteach" "Eadailteach" ;
+ Expensive = makeAdjective "daor" "daora" ;
+ Delicious = makeAdjective "blasta" "blasta" ;
+ Boring = makeAdjective "leamh" "leamha" ;
+ oper makeAdjective : Str -> Str -> Adjective =
+ \sg,pl -> {
+ s=table{Sg => (mutate sg); Pl => (mutate pl)};
+ sVery=table{Sg => "gl"++(lenition1dntls sg); Pl => "gl"++(lenition1dntls pl)}
+ } ;
+} \ No newline at end of file
diff --git a/contrib/summerschool/foods/FoodsOri.gf b/contrib/summerschool/foods/FoodsOri.gf
new file mode 100644
index 000000000..ad4f492f6
--- /dev/null
+++ b/contrib/summerschool/foods/FoodsOri.gf
@@ -0,0 +1,30 @@
+concrete FoodsOri of Foods = {
+
+flags coding = utf8 ;
+
+lincat
+ Comment = Str;
+ Item = Str;
+ Kind = Str;
+ Quality = Str;
+
+lin
+ Pred item quality = item ++ quality ++ "ଅଟେ";
+ This kind = "ଏଇ" ++ kind;
+ That kind = "ସେଇ" ++ kind;
+ These kind = "ଏଇ" ++ kind ++ "ଗୁଡିକ" ;
+ Those kind = "ସେଇ" ++ kind ++ "ଗୁଡିକ" ;
+ Mod quality kind = quality ++ kind;
+ Wine = "ମଦ";
+ Cheese = "ଛେନା";
+ Fish = "ମାଛ";
+ Pizza = "ପିଜଜ଼ା" ;
+ Very quality = "ଅତି" ++ quality;
+ Fresh = "ତାଜା";
+ Warm = "ଗରମ";
+ Italian = "ଇଟାଲି";
+ Expensive = "ମୁଲ୍ୟବାନ୍";
+ Delicious = "ସ୍ଵାଦିସ୍ଟ ";
+ Boring = "ଅରୁଚିକର";
+
+}
diff --git a/contrib/summerschool/foods/MutationsGla.gf b/contrib/summerschool/foods/MutationsGla.gf
new file mode 100644
index 000000000..41eb11006
--- /dev/null
+++ b/contrib/summerschool/foods/MutationsGla.gf
@@ -0,0 +1,53 @@
+resource MutationsGla = open CharactersGla in {
+ param Mutation = Unmutated|Lenition1|Lenition1DNTLS|Lenition2|PrefixT|PrefixH;
+
+ --Turns a string into a mutation table
+ oper mutate : (_ : Str) -> (Mutation => Str) = \str -> table {
+ Unmutated => str ;
+ Lenition1 => lenition1 str ;
+ Lenition1DNTLS => lenition1dntls str ;
+ Lenition2 => lenition2 str ;
+ PrefixT => prefixT str ;
+ PrefixH => prefixH str
+ };
+
+ --Performs lenition 1: inserts "h" if the word begins with a lenitable character
+ oper lenition1 : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"t"|"d"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"T"|"D"|"C"|"G") + rest => start + "h" + rest ;
+ ("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
+ start@("s"|"S") + rest => start + "h" + rest ;
+ _ => str
+ };
+
+ --Performs lenition 1 with dentals: same as lenition 1 but leaves "d", "t" and "s" unmutated
+ oper lenition1dntls : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
+ _ => str
+ };
+
+ --Performs lenition 2: same as lenition 1 with dentals but also changes "s" into "ts"
+ oper lenition2 : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
+ ("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
+ start@("s"|"S") + rest => "t-" + start + rest ;
+ _ => str
+ };
+
+ --Prefixes a "t" to words beginning with a vowel
+ oper prefixT : Str -> Str = \str -> case str of {
+ start@(#vowel) + rest => "t-" + start + rest ;
+ start@(#vowelCap) + rest => "t-" + start + rest ;
+ _ => str
+ };
+
+ --Prefixes a "h" to words beginning with a vowel
+ oper prefixH : Str -> Str = \str -> case str of {
+ start@(#vowel) + rest => "h-" + start + rest ;
+ start@(#vowelCap) + rest => "h-" + start + rest ;
+ _ => str
+ };
+
+} \ No newline at end of file