diff --git a/lectures/lecture05/MicroLangMyeng.gf b/lectures/lecture05/MicroLangMyeng.gf index 25fc060..223b329 100644 --- a/lectures/lecture05/MicroLangMyeng.gf +++ b/lectures/lecture05/MicroLangMyeng.gf @@ -3,12 +3,67 @@ concrete MicroLangMyeng of MicroLang = open MicroResMyeng, Prelude in { lincat + Utt = {s : Str} ; + S = {s : Str} ; + + NP = {s : Case => Str ; n : Number} ; + VP = {s : Number => Str} ; + CN = {s : Number => Str} ; + Comp = {s : Str} ; + AP = {s : Str} ; + Det = {s : Str ; n : Number} ; + Prep = {s : Str} ; + Pron = {s : Case => Str ; n : Number} ; + V = Verb ; V2 = Verb2 ; A = Adjective ; N = Noun ; Adv = Adverb ; +lin + UttS s = s ; + UttNP np = {s = np.s ! Nom} ; + + PredVPS np vp = {s = np.s ! Nom ++ vp.s ! np.n} ; + +-- Verb + UseV verb = {s = \\n => presentVerb verb n} ; + + ComplV2 verb np = {s = \\n => presentVerb verb n ++ verb.prep ++ np.s ! Acc} ; + + UseComp comp = {s = \\n => copula n ++ comp.s} ; + CompAP ap = ap ; + AdvVP vp adv = {s = \\n => vp.s ! n ++ adv.s} ; + +-- Noun + DetCN det cn = {s = \\c => det.s ++ cn.s ! det.n ; n = det.n} ; + UsePron pron = pron ; + + a_Det = {s = "a" ; n = Sg} ; + aPl_Det = {s = "" ; n = Pl} ; + the_Det = {s = "the" ; n = Sg} ; + thePl_Det = {s = "the" ; n = Pl} ; + UseN noun = noun ; + AdjCN ap cn = {s = \\n => ap.s ++ cn.s ! n} ; + +-- Adjective + PositA adj = adj ; + +{- +-- Adverb + PrepNP : Prep -> NP -> Adv ; -- in the house + +-- Structural + in_Prep : Prep ; + on_Prep : Prep ; + with_Prep : Prep ; +-} + he_Pron = {s = table {Nom => "he" ; Acc => "him"} ; n = Sg} ; + she_Pron = {s = table {Nom => "she" ; Acc => "her"} ; n = Sg} ; + they_Pron = {s = table {Nom => "they" ; Acc => "them"} ; n = Pl} ; + + ----------------------------------------------------- ---------------- Lexicon part ----------------------- ----------------------------------------------------- diff --git a/lectures/lecture05/MicroResMyeng.gf b/lectures/lecture05/MicroResMyeng.gf index 53d8f45..c2a6eec 100644 --- a/lectures/lecture05/MicroResMyeng.gf +++ b/lectures/lecture05/MicroResMyeng.gf @@ -44,6 +44,8 @@ param VerbForm = Inf | Pres3Sg | Past | PastPart | PresPart ; + Case = Nom | Acc ; + oper Noun : Type = {s : Number => Str} ; @@ -68,7 +70,7 @@ oper Adverb : Type = {s : Str} ; Verb : Type = {s : VerbForm => Str} ; - + -- constructor; worst case paradigm mkVerb : (sing, sings, sang, sung, singing : Str) -> Verb = \sing, sings, sang, sung, singing -> { @@ -112,4 +114,18 @@ oper Verb2 : Type = {s : VerbForm => Str ; prep : Str} ; +-- auxiliary for syntax + presentVerb : Verb -> Number -> Str = \verb, n -> + case n of { + Sg => verb.s ! Pres3Sg ; + Pl => verb.s ! Inf + } ; + + copula : Number -> Str = \n -> + case n of { + Sg => "is" ; + Pl => "are" + } ; + + } \ No newline at end of file