summaryrefslogtreecommitdiff
path: root/next-lib/src/telugu/ResTel.gf
blob: 20e05f96423c40c552f053592a5dc9913f4178a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
--# -path=.:../abstract:../common:../../prelude

--1 Teldi auxiliary operations.

-- This module contains operations that are needed to make the
-- resource syntax work. 
--
resource ResTel = ParamX ** open Prelude in {

  flags optimize=all ;

  param 
    Case = Dir | Obl ;
    Gender = Masc | Fem | Neutr ;

  oper
    Noun = {s : Number => Case => Str ; g : Gender} ;

    mkNoun : (x1,_,_,x4 : Str) -> Gender -> Noun = 
      \sd,so,pd,po,g -> {
      s = table Number [table Case [sd;so] ; table Case [pd;po]] ;
      g = g
      } ;

    wallNoun : Str -> Noun = \goda -> 
      mkNoun goda goda (goda + "lu") (goda + "la") Neutr ;

--    reggNoun : Str -> Gender -> Noun = \s,g -> case <s,g> of {
--      <-(_ + ("A" | "I")), Fem> => 
--           mkNoun s s s (s + "eM") (s + "oM") (s + "o") Fem ; 
--      _ => regNoun s ** {g = g}
--      } ; 
--
--    regNoun : Str -> Noun = \s -> case s of {
--      x + "iyA" => 
--        mkNoun s s       s   (x + "iyAM") (x + "iyoN") (x + "iyo") Fem ;
--      x + "A"   => 
--        mkNoun s (x + "e") (x + "e") (x + "e") (x + "oN") (x + "o") Masc ;
--      x + "I"   => 
--        mkNoun s s       s   (x + "iyAM") (x + "iyoN") (x + "iyo") Fem ;
--      _  => 
--        mkNoun s s       s   s             (s + "oN")   (s + "o")   Masc
--      } ; 
--
--
--    Adjective = {s : Gender => Number => Case => Str} ;
--
--    mkAdjective : (x1,x2,x3 : Str) -> Adjective = \smd,sm,f -> {
--      s = \\g,n,c => case <g,n,c> of {
--        <Masc,Sg,Dir> => smd ;
--        <Masc>        => sm ;
--        _             => f 
--        }
--      } ;
--
--    regAdjective : Str -> Adjective = \s -> case s of {
--      acch + "A" => mkAdjective s (acch + "e") (acch + "I") ;
--      _ => mkAdjective s s s
--      } ;
--
--  param 
--    VForm = 
--       VInf
--     | VStem
--     | VImpf Gender Number
--     | VPerf Gender Number
--     | VSubj Number Person
--     | VFut  Number Person Gender
--     | VAbs
--     | VReq
--     | VImp
--     | VReqFut
--     ;
--
--  oper
--    Verb = {s : VForm => Str} ;
--
--    mkVerb : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Verb = 
--      \inf,stem,ims,imp,ifs,ifp,pms,pmp,pfs,pfp,ss1,ss2,sp2,sp3,r -> {
--        s = 
--        let ga : Number -> Gender -> Str = \n,g -> 
--          (regAdjective "gA").s ! g ! n ! Dir 
--        in table {
--          VInf => inf ;
--          VStem => stem ;
--          VImpf Masc Sg => ims ;
--          VImpf Masc Pl => imp ;
--          VImpf Fem  Sg => ifs ;
--          VImpf Fem  Pl => ifp ;
--          VPerf Masc Sg => pms ;
--          VPerf Masc Pl => pmp ;
--          VPerf Fem  Sg => pfs ;
--          VPerf Fem  Pl => pfp ;
--          VSubj Sg   P1 => ss1 ; 
--          VSubj Sg   _  => ss2 ; 
--          VSubj Pl   P2 => sp2 ; 
--          VSubj Pl   _  => sp3 ;
--          VFut  Sg   P1 g => ss1 + ga Sg g ; 
--          VFut  Sg   _  g => ss2 + ga Sg g ; 
--          VFut  Pl   P2 g => sp2 + ga Pl g ; 
--          VFut  Pl   _  g => sp3 + ga Pl g ;
--          VAbs  => stem + "kar" ; --- ke
--          VReq  => r ;
--          VImp  => sp2 ;
--          VReqFut => stem + "ie-gA"
--          }
--        } ;
--
--    regVerb : Str -> Verb = \cal -> 
--      let caly : Str = case cal of {
--        _ + ("A" | "e") => cal + "y" ;
--        c + "U" => c + "uy" ;
--        c + "I" => c + "iy" ;
--        _ => cal
--        }
--      in
--      mkVerb
--        (cal + "nA") cal
--        (cal + "tA") (cal + "te") (cal + "tI") (cal + "tI")
--        (caly + "A")  (caly + "e")  (caly + "I")  (caly + "IN")
--        (caly + "UM") (caly + "e")  (caly + "o")   (caly + "eN") 
--        (caly + "ie-") ;
--
--  param
--    CTense = CPresent | CPast | CFuture ;
--  oper 
--    copula : CTense -> Number -> Person -> Gender -> Str = \t,n,p,g -> 
--      case <t,n,p,g> of {
--        <CPresent,Sg,P1,_   > => "hUM" ;
--        <CPresent,Sg,P2,_   > => "hE" ;
--        <CPresent,Sg,P3,_   > => "hE" ;
--        <CPresent,Pl,P1,_   > => "hEN" ;
--        <CPresent,Pl,P2,_   > => "ho" ;
--        <CPresent,Pl,P3,_   > => "hEN" ;
--        <CPast,   Sg,_ ,Masc> => "TA" ;
--        <CPast,   Sg,_ ,Fem > => "TI" ;
--        <CPast,   Pl,_ ,Masc> => "Te" ;
--        <CPast,   Pl,_ ,Fem > => "TIN" ;
--        <CFuture, Sg,P1,Masc> => "hUNgA" ;
--        <CFuture, Sg,P1,Fem > => "hUNgI" ;
--        <CFuture, Sg,_ ,Masc> => "hogA" ;
--        <CFuture, Sg,_ ,Fem > => "hogI" ;
--        <CFuture, Pl,P2,Masc> => "hoge" ;
--        <CFuture, Pl,_ ,Masc> => "hoNge" ;
--        <CFuture, Pl,P2,Fem > => "hogi:" ;
--        <CFuture, Pl,_ ,Fem > => "hoNgi:"
--        } ;
--
--  param
--    PronCase = PC Case | PObj | PPoss ;
--  oper
--    personalPronoun : Person -> Number -> {s : PronCase => Str} = \p,n -> 
--      case <p,n> of {
--        <P1,Sg> => {s = table PronCase ["mEN"  ; "muJ" ; "muJ"  ; "muJe"   ; "merA"]} ;
--        <P1,Pl> => {s = table PronCase ["ham"  ; "ham" ; "ham"  ; "hameN"  ; "hamArA"]} ;
--        <P2,Sg> => {s = table PronCase ["tU"   ; "tuJ" ; "tuJ"  ; "tuJe"   ; "terA"]} ;
--        <P2,Pl> => {s = table PronCase ["tum"  ; "tum" ; "tum"  ; "tum"    ; "tumhArA"]} ;
--        <P3,Sg> => {s = table PronCase ["vah"  ; "u-s" ; "u-s"  ; "u-se"    ; "u-skA"]} ;
--        <P3,Pl> => {s = table PronCase ["ve"   ; "u-n" ; "u-n"  ; "u-nheN" ; "u-nkA"]}
--        } ;  
--      ---- the third is the vocative - is it really this way?
--
--  -- the Teldi verb phrase
--
-----    CTense = CPresent | CPast | CFuture ;
--
--      
--
--  param
--    VPHTense = 
--       VPGenPres  -- impf hum       nahim    "I go"
--     | VPImpPast  -- impf Ta        nahim    "I went"
--     | VPContPres -- stem raha hum  nahim    "I am going"
--     | VPContPast -- stem raha Ta   nahim    "I was going"
--     | VPPerf     -- perf           na/nahim "I went"
--     | VPPerfPres -- perf hum       na/nahim "I have gone"
--     | VPPerfPast -- perf Ta        na/nahim "I had gone"          
--     | VPSubj     -- subj           na       "I may go"
--     | VPFut      -- fut            na/nahim "I shall go"
--     ;
--
--    VPHForm = 
--       VPTense VPHTense Agr -- 9 * 12
--     | VPReq
--     | VPImp
--     | VPReqFut
--     | VPInf
--     | VPStem
--     ;
--
--    VType = VIntrans | VTrans | VTransPost ;
--
--  oper
--    objVType : VType -> NPCase = \vt -> case vt of {
--      VTrans => NPObj ;
--      _ => NPC Obl
--      } ;
--
--    VPH : Type = {
--      s    : Bool => VPHForm => {fin, inf, neg : Str} ;
--      obj  : {s : Str ; a : Agr} ; 
--      subj : VType ;
--      comp : Agr => Str
--      } ; 
--
--    predV : Verb -> VPH = \verb -> {
--      s = \\b,vh => 
--       let 
--         na = if_then_Str b [] "na" ;
--         nahim = if_then_Str b [] "nahIN" ;
--       in
--       case vh of {
--         VPTense VPGenPres (Ag g n p) => 
--           {fin = copula CPresent n p g ; inf = verb.s ! VImpf g n ; neg = nahim} ;
--         VPTense VPImpPast (Ag g n p) => 
--           {fin = copula CPast n p g ; inf = verb.s ! VImpf g n ; neg = nahim} ;
--         VPTense VPContPres (Ag g n p) => 
--           {fin = copula CPresent n p g ; 
--            inf = verb.s ! VStem ++ raha g n ; neg = nahim} ;
--         VPTense VPContPast (Ag g n p) => 
--           {fin = copula CPast n p g ; 
--            inf = verb.s ! VStem ++ raha g n ; neg = nahim} ;
--         VPTense VPPerf (Ag g n _) => 
--           {fin = verb.s ! VPerf g n ; inf = [] ; neg = nahim} ;
--         VPTense VPPerfPres (Ag g n p) => 
--           {fin = copula CPresent n p g ; inf = verb.s ! VPerf g n ; neg = nahim} ;
--         VPTense VPPerfPast (Ag g n p) => 
--           {fin = copula CPast n p g ; inf = verb.s ! VPerf g n ; neg = nahim} ;
--         VPTense VPSubj (Ag _ n p) => {fin = verb.s ! VSubj n p ; inf = [] ; neg = na} ;
--         VPTense VPFut (Ag g n p) => {fin = verb.s ! VFut n p g ; inf = [] ; neg = na} ;
--         VPInf => {fin = verb.s ! VStem ; inf = [] ; neg = na} ;
--         _ => {fin = verb.s ! VStem ; inf = [] ; neg = na} ----
--         } ;
--      obj = {s = [] ; a = defaultAgr} ;
--      subj = VIntrans ;
--      comp = \\_ => []
--      } ;
--
--    raha : Gender -> Number -> Str = \g,n -> 
--      (regAdjective "rahA").s ! g ! n ! Dir ;
--
--    VPHSlash = VPH ** {c2 : Compl} ;
--
--    Clause : Type = {s : VPHTense => Bool => Str} ;
--
--    Compl : Type = {s : Str ; c : VType} ;
--
--    insertObject : NP -> VPHSlash -> VPH = \np,vps -> {
--      s = vps.s ;
--      obj = {s = vps.obj.s ++ np.s ! objVType vps.c2.c ++ vps.c2.s ; a = np.a} ;
--      subj = vps.c2.c ;
--      comp = vps.comp 
--      } ;
--
--  param
--    Agr = Ag Gender Number Person ;
--    NPCase = NPC Case | NPObj | NPErg ;
--
--  oper
--    agrP3 : Gender -> Number -> Agr = \g,n -> Ag g n P3 ;
--
--    defaultAgr : Agr = agrP3 Masc Sg ;
--
--    npcase2case : NPCase -> Case = \npc -> case npc of {
--      NPC c => c ;
--      NPObj => Obl ;
--      NPErg => Obl
--      } ;
--
--    np2pronCase : NPCase -> PronCase = \np -> case np of {
--      NPC c => PC c ;
--      NPObj => PObj ;
--      NPErg => PC Obl
--      } ;
--
--    toNP : (Case => Str) -> NPCase -> Str = \pn, npc -> case npc of {
--      NPC c => pn ! c ;
--      NPObj => pn ! Obl ;
--      NPErg => pn ! Obl ++ "ne"
--      } ;
--
--    NP : Type = {s : NPCase => Str ; a : Agr} ;
--
--    mkClause : NP -> VPH -> Clause = \np,vp -> {
--      s = \\vt,b => 
--        let 
--          subjagr : NPCase * Agr = case vt of {
--            VPPerf => case vp.subj of {
--              VTrans     => <NPErg, vp.obj.a> ;
--              VTransPost => <NPErg, defaultAgr> ;
--              _ => <NPC Dir, np.a>
--              } ;
--            _ => <NPC Dir, np.a>
--            } ;
--          subj = subjagr.p1 ;
--          agr  = subjagr.p2 ;
--          vps  = vp.s ! b ! VPTense vt agr ;
--        in
--        np.s ! subj ++ vp.obj.s ++ vp.comp ! np.a ++ vps.neg ++ vps.inf ++ vps.fin
--      } ;
--
--
}