resource ResEng = { param Number = Sg | Pl ; Person = P1 | P2 | P3 ; Case = Nom | Acc | Gen ; Anteriority = Simul | Anter ; Tense = Pres | Past | Fut | Cond ; Pol = PPos | PNeg ; Ord = ODir | OQuest ; VForm = VInf | VPres | VPast | VPPart | VPresPart ; oper Agr = {n : Number ; p : Person} ; regV : Str -> {s : VForm => Str} = \walk -> { s = table { VInf => walk ; VPres => walk + "s" ; VPast | VPPart => walk + "ed" ; VPresPart => walk + "ing" } } ; mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} = \i,me,my,n,p -> { s = table { Nom => i ; Acc => me ; Gen => my } ; a = { n = n ; p = p } } ; Verb : Type = { s : VForm => Str } ; VP : Type = { s : Tense => Anteriority => Ord => Pol => Agr => {fin, inf : Str} ; s2 : Agr => Str } ; predV : Verb -> VP = \verb -> { s = \\t,ant,ord,b,agr => let inf = verb.s ! VInf ; fin = presVerb verb agr ; past = verb.s ! VPast ; part = verb.s ! VPPart ; vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; in case of { => vf fin [] ; => vf (does agr) inf ; => vf (doesnt agr) inf ; => vf (have agr) part ; => vf (havent agr) part ; => vf past [] ; => vf "did" inf ; => vf "didn't" inf ; => vf "had" part ; => vf "hadn't" part ; => vf "will" inf ; => vf "won't" inf ; => vf "will" ("have" ++ part) ; => vf "won't" ("have" ++ part) ; => vf "would" inf ; => vf "wouldn't" inf ; => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; s2 = \\_ => [] } ; predAux : Aux -> VP = \verb -> { s = \\t,ant,ord,b,agr => let inf = verb.inf ; fin = verb.pres ! b ! agr ; past = verb.past ! b ! agr ; part = verb.ppart ; vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; in case of { => vf fin [] ; => vf (have agr) part ; => vf (havent agr) part ; => vf fin [] ; => vf "had" part ; => vf "hadn't" part ; => vf "will" inf ; => vf "won't" inf ; => vf "will" ("have" ++ part) ; => vf "won't" ("have" ++ part) ; => vf "would" inf ; => vf "wouldn't" inf ; => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; s2 = \\_ => [] } ; insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { s = vp.s ; s2 = \\a => vp.s2 ! a ++ obj ! a } ; presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> agrVerb (verb.s ! VPres) (verb.s ! VInf) ; infVP : VP -> Agr -> Str = \vp,a -> (vp.s ! Fut ! Simul ! ODir ! PNeg ! a).inf ++ vp.s2 ! a ; agrVerb : Str -> Str -> Agr -> Str = \has,have,agr -> case agr of { {n = Sg ; p = P3} => has ; _ => have } ; have = agrVerb "has" "have" ; havent = agrVerb "hasn't" "haven't" ; does = agrVerb "does" "do" ; doesnt = agrVerb "doesn't" "don't" ; Aux = {pres,past : Pol => Agr => Str ; inf,ppart : Str} ; auxBe : Aux = { pres = \\b,a => agrVerb (posneg b "is") (posneg b "are") a ; past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ; inf = "be" ; ppart = "been" } ; posneg : Pol -> Str -> Str = \p,s -> case p of { PPos => s ; PNeg => s + "n't" } ; }