forked from GitHub/gf-core
Support nested parameters, but fails with non-static values (see FoodsBull, ASg kind.g).
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
Foods: Pred (That Wine) Delicious
|
||||
FoodsBul: онова вино е превъзходно
|
||||
FoodsEng: that wine is delicious
|
||||
|
||||
Foods: Pred (This Pizza) (Very Boring)
|
||||
FoodsBul: тази пица е много еднообразна
|
||||
FoodsEng: this pizza is very boring
|
||||
|
||||
Foods: Pred (This Cheese) Fresh
|
||||
FoodsBul: това сирене е свежо
|
||||
FoodsEng: this cheese is fresh
|
||||
|
||||
Foods: Pred (Those Fish) Warm
|
||||
FoodsBul: онези риби са горещи
|
||||
FoodsEng: those fish are warm
|
||||
|
||||
Foods: Pred (That (Mod Boring (Mod Italian Pizza))) Expensive
|
||||
FoodsBul: онази еднообразна италианска пица е скъпа
|
||||
FoodsEng: that boring Italian pizza is expensive
|
||||
|
||||
43
testsuite/lpgf/FoodsBul.gf
Normal file
43
testsuite/lpgf/FoodsBul.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
-- (c) 2009 Krasimir Angelov under LGPL
|
||||
|
||||
concrete FoodsBul of Foods = {
|
||||
|
||||
flags
|
||||
coding = utf8;
|
||||
|
||||
param
|
||||
Gender = Masc | Fem | Neutr;
|
||||
Number = Sg | Pl;
|
||||
Agr = ASg Gender | APl ;
|
||||
|
||||
lincat
|
||||
Comment = Str ;
|
||||
Quality = {s : Agr => Str} ;
|
||||
Item = {s : Str; a : Agr} ;
|
||||
Kind = {s : Number => Str; g : Gender} ;
|
||||
|
||||
lin
|
||||
Pred item qual = item.s ++ case item.a of {ASg _ => "е"; APl => "са"} ++ qual.s ! item.a ;
|
||||
|
||||
This kind = {s=case kind.g of {Masc=>"този"; Fem=>"тази"; Neutr=>"това" } ++ kind.s ! Sg; a=ASg kind.g} ;
|
||||
That kind = {s=case kind.g of {Masc=>"онзи"; Fem=>"онази"; Neutr=>"онова"} ++ kind.s ! Sg; a=ASg kind.g} ;
|
||||
These kind = {s="тези" ++ kind.s ! Pl; a=APl} ;
|
||||
Those kind = {s="онези" ++ kind.s ! Pl; a=APl} ;
|
||||
|
||||
Mod qual kind = {s=\\n => qual.s ! (case n of {Sg => ASg kind.g; Pl => APl}) ++ kind.s ! n; g=kind.g} ;
|
||||
|
||||
Wine = {s = table {Sg => "вино"; Pl => "вина"}; g = Neutr};
|
||||
Cheese = {s = table {Sg => "сирене"; Pl => "сирена"}; g = Neutr};
|
||||
Fish = {s = table {Sg => "риба"; Pl => "риби"}; g = Fem};
|
||||
Pizza = {s = table {Sg => "пица"; Pl => "пици"}; g = Fem};
|
||||
|
||||
Very qual = {s = \\g => "много" ++ qual.s ! g};
|
||||
|
||||
Fresh = {s = table {ASg Masc => "свеж"; ASg Fem => "свежа"; ASg Neutr => "свежо"; APl => "свежи"}};
|
||||
Warm = {s = table {ASg Masc => "горещ"; ASg Fem => "гореща"; ASg Neutr => "горещо"; APl => "горещи"}};
|
||||
Italian = {s = table {ASg Masc => "италиански"; ASg Fem => "италианска"; ASg Neutr => "италианско"; APl => "италиански"}};
|
||||
Expensive = {s = table {ASg Masc => "скъп"; ASg Fem => "скъпа"; ASg Neutr => "скъпо"; APl => "скъпи"}};
|
||||
Delicious = {s = table {ASg Masc => "превъзходен"; ASg Fem => "превъзходна"; ASg Neutr => "превъзходно"; APl => "превъзходни"}};
|
||||
Boring = {s = table {ASg Masc => "еднообразен"; ASg Fem => "еднообразна"; ASg Neutr => "еднообразно"; APl => "еднообразни"}};
|
||||
|
||||
}
|
||||
7
testsuite/lpgf/Scratch.gf
Normal file
7
testsuite/lpgf/Scratch.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
abstract Scratch = {
|
||||
cat S ; F ;
|
||||
fun
|
||||
FtoS : F -> S ;
|
||||
f1 : F ;
|
||||
f2 : F ;
|
||||
}
|
||||
2
testsuite/lpgf/Scratch.treebank
Normal file
2
testsuite/lpgf/Scratch.treebank
Normal file
@@ -0,0 +1,2 @@
|
||||
Scratch: FtoS f1
|
||||
ScratchCnc: R1 Q2
|
||||
18
testsuite/lpgf/ScratchCnc.gf
Normal file
18
testsuite/lpgf/ScratchCnc.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
concrete ScratchCnc of Scratch = {
|
||||
param
|
||||
R = R1 | R2 ;
|
||||
P = PR R Q | PP ;
|
||||
Q = Q1 | Q2 ;
|
||||
lincat
|
||||
S = Str ;
|
||||
F = { p : P => Str } ;
|
||||
lin
|
||||
f1 = f2 ;
|
||||
f2 = { p = table {
|
||||
PR R1 Q1 => "R1 Q1" ;
|
||||
PR R1 Q2 => "R1 Q2" ;
|
||||
PR R2 _ => "R2 _" ;
|
||||
PP => "PP"
|
||||
} } ;
|
||||
FtoS f = f.p ! PR R1 Q2 ;
|
||||
}
|
||||
@@ -15,6 +15,7 @@ dir = "testsuite" </> "lpgf"
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
doGrammar "Scratch"
|
||||
doGrammar "Walking"
|
||||
doGrammar "Foods"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user