diff --git a/lab2/grammar/intro/MicroLangEng.gf b/lab2/grammar/intro/MicroLangEng.gf new file mode 100644 index 0000000..3c2b008 --- /dev/null +++ b/lab2/grammar/intro/MicroLangEng.gf @@ -0,0 +1,15 @@ +--# -path=.:../abstract + +concrete MicroLangEng of MicroLang = + open MicroResEng + in { + +lincat + N = Noun ; + +lin + animal_N = mkN "animal" ; + apple_N = mkN "apple" ; + baby_N = mkN "baby" ; + woman_N = mkN "woman" "women" ; +} \ No newline at end of file diff --git a/lab2/grammar/intro/MicroResEng.gf b/lab2/grammar/intro/MicroResEng.gf new file mode 100644 index 0000000..1e71999 --- /dev/null +++ b/lab2/grammar/intro/MicroResEng.gf @@ -0,0 +1,44 @@ +-- live-coded MicroResEng for Lab 2 + +resource MicroResEng = { + +param + Number = Sg | Pl ; + +oper +-- phonological patterns + sibilant : pattern Str + = #("s" | "x" | "ch" | "sh" | "z") ; + vowel : pattern Str + = #("a" | "e" | "i" | "o" | "u") ; + +-- the type of nouns + Noun : Type = {s : Number => Str} ; + +-- worst-case paradigm + mkNoun : (sg, pl : Str) -> Noun + = \sg, pl -> {s = table {Sg => sg ; Pl => pl}} ; + +-- regular paradigm + regNoun : (sg : Str) -> Noun + = \sg -> mkNoun sg (sg + "s") ; + +-- smart paradigm + smartNoun : (sg : Str) -> Noun + = \sg -> case sg of { + x + #vowel + "y" => regNoun sg ; + x + "y" => mkNoun sg (x + "ies") ; + x + #sibilant => mkNoun sg (sg + "es") ; + _ => regNoun sg + } ; + +-- overloaded paradigm for lexicographers + mkN = overload { + mkN : (sg : Str) -> Noun = smartNoun ; + mkN : (sg, pl : Str) -> Noun = mkNoun ; + } ; + + + + +} \ No newline at end of file diff --git a/lab2/grammar/italian/MicroLangIta.gfo b/lab2/grammar/italian/MicroLangIta.gfo index ea1f9bd..7dc4f0b 100644 Binary files a/lab2/grammar/italian/MicroLangIta.gfo and b/lab2/grammar/italian/MicroLangIta.gfo differ