forked from GitHub/comp-syntax-gu-mlt
cleaned up in lab2 grammars ; added myproject/ from the lecture
This commit is contained in:
15
lab2/grammar/myproject/MicroLangEng.gf
Normal file
15
lab2/grammar/myproject/MicroLangEng.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:../abstract
|
||||
|
||||
concrete MicroLangEng of MicroLang = open MicroResEng in {
|
||||
|
||||
lincat N = MicroResEng.N ;
|
||||
|
||||
lin baby_N = mkN "baby" ;
|
||||
lin dog_N = mkN "dog" ;
|
||||
lin man_N = mkN "man" "men" ;
|
||||
lin car_N = mkN "car" ;
|
||||
lin city_N = mkN "city" ;
|
||||
lin boy_N = mkN "boy" ;
|
||||
|
||||
|
||||
}
|
||||
BIN
lab2/grammar/myproject/MicroLangEng.gfo
Normal file
BIN
lab2/grammar/myproject/MicroLangEng.gfo
Normal file
Binary file not shown.
15
lab2/grammar/myproject/MicroLangSwe.gf
Normal file
15
lab2/grammar/myproject/MicroLangSwe.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:../abstract
|
||||
|
||||
concrete MicroLangSwe of MicroLang = open MicroResSwe in {
|
||||
|
||||
lincat N = MicroResSwe.N ;
|
||||
|
||||
lin baby_N = decl2 "bebis" ;
|
||||
lin dog_N = decl2 "hund" ;
|
||||
lin man_N = worstN "man" "mannen" "män" "männen" Utr ;
|
||||
lin car_N = decl2 "bil" ;
|
||||
--lin city_N = mkN "stad" ;
|
||||
lin boy_N = decl2 "pojke" ;
|
||||
|
||||
|
||||
}
|
||||
BIN
lab2/grammar/myproject/MicroLangSwe.gfo
Normal file
BIN
lab2/grammar/myproject/MicroLangSwe.gfo
Normal file
Binary file not shown.
30
lab2/grammar/myproject/MicroResEng.gf
Normal file
30
lab2/grammar/myproject/MicroResEng.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
resource MicroResEng = {
|
||||
|
||||
param Number = Sg | Pl ;
|
||||
|
||||
oper
|
||||
N = {s : Number => Str} ;
|
||||
|
||||
worstN : Str -> Str -> N
|
||||
= \x,y -> {s = table {Sg => x ; Pl => y}} ;
|
||||
|
||||
regN : Str -> N
|
||||
= \x -> worstN x (x + "s") ;
|
||||
|
||||
smartN : Str -> N
|
||||
= \x -> case x of
|
||||
{
|
||||
b + ("ay"|"oy"|"uy") => regN x ;
|
||||
bab + "y" => worstN x (bab + "ies") ;
|
||||
_ => regN x
|
||||
} ;
|
||||
|
||||
mkN = overload {
|
||||
mkN : (dog : Str) -> N
|
||||
= smartN ;
|
||||
mkN : (man,men : Str) -> N
|
||||
= worstN
|
||||
} ;
|
||||
|
||||
|
||||
}
|
||||
BIN
lab2/grammar/myproject/MicroResEng.gfo
Normal file
BIN
lab2/grammar/myproject/MicroResEng.gfo
Normal file
Binary file not shown.
23
lab2/grammar/myproject/MicroResSwe.gf
Normal file
23
lab2/grammar/myproject/MicroResSwe.gf
Normal file
@@ -0,0 +1,23 @@
|
||||
resource MicroResSwe = {
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Species = Indef | Def ;
|
||||
Gender = Utr | Neutr ;
|
||||
|
||||
oper
|
||||
N = {s : Number => Species => Str ; g : Gender} ;
|
||||
|
||||
worstN : Str -> Str -> Str -> Str -> Gender -> N
|
||||
= \man,mannen,män,männen,gen -> {
|
||||
s = table {
|
||||
Sg => table {Indef => man ; Def => mannen} ;
|
||||
Pl => table {Indef => män ; Def => männen}
|
||||
} ;
|
||||
g = gen
|
||||
} ;
|
||||
|
||||
decl2 : Str -> N
|
||||
= \bil -> worstN bil (bil + "en") (bil + "ar") (bil + "arna") Utr ;
|
||||
|
||||
}
|
||||
BIN
lab2/grammar/myproject/MicroResSwe.gfo
Normal file
BIN
lab2/grammar/myproject/MicroResSwe.gfo
Normal file
Binary file not shown.
Reference in New Issue
Block a user