summaryrefslogtreecommitdiff
path: root/next-lib/src/italian/DiffIta.gf
blob: 7eef2109e975ec438c1a7b80a75e535c593f187f (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
--# -path=.:../romance:../abstract:../common:prelude

instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelude in {

  flags optimize=all ;

  param 
    Prepos = P_di | P_a | P_da | P_in | P_su | P_con ;
    VType = VHabere | VEsse | VRefl ;

  oper
    dative   : Case = CPrep P_a ;
    genitive : Case = CPrep P_di ;

    prepCase = \c -> case c of {
      Nom | Acc => [] ;
      CPrep p => case p of {
        P_di => "di" ;
        P_a  => pre {"a" ; "ad" / vocale} ;
        P_da => "da" ;
        P_in => "in" ;
        P_su => "su" ;
        P_con => "con"
        }
      } ;

    artDef : Gender -> Number -> Case -> Str = \g,n,c ->
      case <g,n,c> of {
        <_, _, CPrep P_di>  => prepArt "de" ;
        <_, _, CPrep P_da>  => prepArt "da" ;
        <_, _, CPrep P_a>   => prepArt "a" ;
        <_, _, CPrep P_in>  => prepArt "ne" ;
        <_, _, CPrep P_su>  => prepArt "su" ;
        <_, _, CPrep P_con> => prepArt "co" ;
        <Masc,Sg, Nom| Acc> => elision "il" "l'" "lo" ;
        <Fem ,Sg, _>        => elision "la" "l'" "la" ;
        <Masc,Pl, _>        => elision "i" "gli" "gli" ;
        <Fem ,Pl, _>        => "le"
        } 
       where {
         prepArt : Tok -> Tok = \de -> case <g,n> of {
           <Masc,Sg> => elision (de + "l")   (de + "ll'") (de + "llo") ;
           <Masc,Pl> => elision (de + "i")   (de + "gli") (de + "gli") ;
           <Fem, Sg> => elision (de + "lla") (de + "ll'") (de + "lla") ;
           <Fem, Pl> => de + "lle"
           }
         } ;


-- In these two, "de de/du/des" becomes "de".

    artIndef = \g,n,c -> case <n,c> of {
      <Sg,_>   => prepCase c ++ 
                  genForms (elision "un" "un" "uno") (elision "una" "un'" "una") ! g ;
      _        => prepCase c 
      } ;

    possCase = artDef ;

    partitive = \g,c -> case c of {
      CPrep P_di => "di" ;
      _ => prepCase c ++ artDef g Sg (CPrep P_di)
      } ;

    conjunctCase : NPForm -> NPForm = \c -> case c of {
      Ton Nom | Aton Nom => Ton Nom ;
      _ => Ton Acc 
      } ;

    auxVerb : VType -> (VF => Str) = \vtyp -> case vtyp of {
      VHabere => avere_V.s ;
      _ => copula.s
      } ;

    partAgr : VType -> VPAgr = \vtyp -> case vtyp of {
      VHabere => vpAgrNone ;
      _ => VPAgrSubj
      } ;

    vpAgrClit : Agr -> VPAgr = \a ->
      VPAgrClit a.g a.n ; --- subty

    pronArg = \n,p,acc,dat ->
      let 
        pacc = case acc of {  --- only accusative refl handled
          CRefl => case p of {
            P3 => "si" ;
            _  => argPron Fem n p Acc False --- no clitic after acc
            } ;
          CPron ag an ap => argPron ag an ap Acc False ;
          _ => []
          } ;
        hasAcc = case acc of {
          CNone => False ;
          _ => True
          } ;
        hasDat = case dat of {
          CNone => False ;
          _ => True
          } ;
        pdat = case dat of {
          CPron ag an ap => argPron ag an ap dative hasAcc ;
          _ => []
          } ;
       in
       <pdat ++ pacc, [], orB hasAcc hasDat> ;

    infForm n p x y = (pronArg n p x y).p3 ;

    mkImperative b p vp = {
      s = \\pol,aag => 
        let 
          pe    = case b of {True => P3 ; _ => p} ;
          agr   = aag ** {p = pe} ;
          clpr  = pronArg agr.n agr.p vp.clAcc vp.clDat ;
          verb  = case <aag.n, pol,pe> of {
            <Sg,Neg,P2> => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ;
            _ => (vp.s ! VPImperat).fin ! agr
            } ;
          neg   = vp.neg ! pol ;
          compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
        in
        neg.p1 ++ verb ++ bindIf clpr.p3 ++ clpr.p1 ++ compl ;
      } ;

    negation : Polarity => (Str * Str) = table {
      Pos => <[],[]> ;
      Neg => <"non",[]>
      } ;

    conjThan = "che" ; --- di
    conjThat = "che" ;

    subjIf = "se" ;

    clitInf b cli inf = inf ++ bindIf b ++ cli ;

    relPron : Bool => AAgr => Case => Str = \\b,a,c => 
      case c of {
        Nom | Acc => "che" ;
        CPrep P_di => "cui" ;
        _ => prepCase c ++ "cui" --- ilquale
        } ;

    pronSuch : AAgr => Str = aagrForms "tale" "tale" "tali" "tali" ;

    quelPron : AAgr => Str = aagrForms "quale" "quale" "quali" "quali" ;

    partQIndir = "ciò" ;

    reflPron : Number -> Person -> Case -> Str = 
      let 
        cases : (x,y : Str) -> (Case -> Str) = \me,moi,c -> case c of {
          Acc | CPrep P_a => me ;
          _ => moi
          } ;
      in 
      \n,p -> case <n,p> of { 
        <Sg,P1> => cases "mi" "me" ;
        <Sg,P2> => cases "ti" "te" ;
        <Pl,P1> => cases "ci" "noi" ; -- unlike French with just one alt!
        <Pl,P2> => cases "vi" "voi" ;
        _ => cases "si" "se"
        } ;

    argPron : Gender -> Number -> Person -> Case -> Bool -> Str = 
      let 
        cases : (x,y,z : Str) -> Case -> Bool -> Str = 
          \ci,ce,noi,c,isPre -> case c of {
          Acc | CPrep P_a => if_then_Str isPre ce ci ;
          _ => noi
          } ;
        cases4 : (x,y,z,u : Str) -> Case -> Bool -> Str =
          \lo,gli,glie,lui,c,isPre -> case c of {
          Acc => lo ; 
          CPrep P_a => if_then_Str isPre glie gli ;
          _ => lui
          } ;
      in 
      \g,n,p -> case <g,n,p> of { 
        <_,Sg,P1> => cases "mi" "me" "me" ;
        <_,Sg,P2> => cases "ti" "te" "te" ;
        <_,Pl,P1> => cases "ci" "ce" "noi" ; -- unlike French with just one alt!
        <_,Pl,P2> => cases "vi" "ve" "voi" ;
        <Masc,Sg,P3> => cases4 "lo" "gli" "glie" "lui" ;
        <Fem, Sg,P3> => cases4 "la" "le"  "glie" "lei" ;
        <_,   Pl,P3> => cases4 "li" "li" "glie"  "loro"
        } ;

    vRefl   : VType = VRefl ;
    isVRefl : VType -> Bool = \ty -> case ty of {
      VRefl => True ;
      _ => False
      } ;

    auxPassive : Verb = venire_V ;

    copula = verbBesch (essere_1 "essere") ** {vtyp = VEsse} ;
    avere_V = verbBesch (avere_2 "avere") ** {vtyp = VHabere} ;
    venire_V = verbBesch (venire_110 "venire") ** {vtyp = VEsse} ;
}