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
|
----1 Auxiliary operations common for Romance languages
--
-- This module contains operations that are shared by the Romance
-- languages. The complete set of auxiliary operations needed to
-- implement [Test Test.html] is defined in [ResRomance ResRomance.html],
-- which depends on [DiffRomance DiffRomance.html].
--
resource CommonRomance = ParamX ** open Prelude in {
flags optimize=all ;
--2 Enumerated parameter types for morphology
--
-- These types are the ones found in school grammars.
-- Their parameter values are atomic.
param
Gender = Masc | Fem ;
Mood = Indic | Conjunct ;
Direct = DDir | DInv ;
-- Adjectives are inflected in gender and number, and there is also an
-- adverbial form (e.g. "infiniment"), which has different paradigms and
-- can even be irregular ("bien").
-- Comparative adjectives are moreover inflected in degree
-- (which in Romance is usually syntactic, though).
AForm = AF Gender Number | AA ;
-- Gender is not morphologically determined for first and second person pronouns.
PronGen = PGen Gender | PNoGen ;
-- Cardinal numerals have gender, ordinal numerals have full number as well.
CardOrd = NCard Gender | NOrd Gender Number ;
-- The following coercions are useful:
oper
prongen2gender : PronGen -> Gender = \p -> case p of {
PGen g => g ;
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
} ;
aform2gender : AForm -> Gender = \a -> case a of {
AF g _ => g ;
_ => Masc -- "le plus lentement"
} ;
aform2number : AForm -> Number = \a -> case a of {
AF _ n => n ;
_ => Sg -- "le plus lentement"
} ;
conjGender : Gender -> Gender -> Gender = \m,n ->
case m of {
Fem => n ;
_ => Masc
} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> {
g = conjGender a.g b.g ;
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
--3 Verbs
--
-- In the current syntax, we use
-- a reduced conjugation with only the present tense infinitive,
-- indicative, subjunctive, and imperative forms.
-- But our morphology has full Bescherelle conjunctions:
-- so we use a coercion between full and reduced verbs.
-- The full conjugations and the coercions are defined separately for French
-- and Italian, since they are not identical. The differences are mostly due
-- to Bescherelle structuring the forms in different groups; the
-- gerund and the present participles show real differences.
--
-- For Italian contracted forms, $VInfin$ should have
-- an alternative form, whose proper place is $Diff$.
param
VF =
VInfin Bool
| VFin TMood Number Person
| VImper NumPersI
| VPart Gender Number
| VGer
;
TMood =
VPres Mood
| VImperf Mood --# notpresent
| VPasse --# notpresent
| VFut --# notpresent
| VCondit --# notpresent
;
NumPersI = SgP2 | PlP1 | PlP2 ;
VPForm =
VPFinite TMood Anteriority
| VPImperat
| VPGerund
| VPInfinit Anteriority Bool ;
RTense =
RPres
| RPast --# notpresent
| RPasse --# notpresent
| RFut --# notpresent
| RCond --# notpresent
;
-- Agreement of adjectives, verb phrases, and relative pronouns.
oper
AAgr : Type = {g : Gender ; n : Number} ;
Agr : Type = AAgr ** {p : Person} ;
param
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
-- Clitic slots.
CAgr = CPron Gender Number Person | CRefl | CNone ; --- Agr
--- CAgr = CPron {g : Gender ; n : Number ; p : Person} | CRefl | CNone ; --- Agr
oper
aagr : Gender -> Number -> AAgr = \g,n ->
{g = g ; n = n} ;
agrP3 : Gender -> Number -> Agr = \g,n ->
aagr g n ** {p = P3} ;
vf2numpers : VF -> (Number * Person) = \v -> case v of {
VFin _ n p => <n,p> ;
_ => <Sg,P3> ----
} ;
presInd = VPres Indic ;
-- The imperative forms depend on number and person.
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
<Sg,P2> => VImper SgP2 ;
<Pl,P1> => VImper PlP1 ;
<Pl,P2> => VImper PlP2 ;
_ => VInfin False
} ;
---
oper
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
table {
Masc => bon ;
Fem => bonne
} ;
aagrForms : (x1,_,_,x4 : Str) -> (AAgr => Str) = \tout,toute,tous,toutes ->
table {
{g = g ; n = Sg} => genForms tout toute ! g ;
{g = g ; n = Pl} => genForms tous toutes ! g
} ;
Noun = {s : Number => Str ; g : Gender} ;
Adj = {s : AForm => Str} ;
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
case vp of {
VPAgrSubj => agr ;
VPAgrClit g n => {g = g ; n = n}
} ;
vpAgrNone : VPAgr = VPAgrClit Masc Sg ;
oper
mkOrd : {s : Degree => AForm => Str} -> {s : AAgr => Str} ;
mkOrd x = {s = \\ag => x.s ! Posit ! AF ag.g ag.n} ;
-- This is used in Spanish and Italian to bind clitics with preceding verb.
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
param
VPAgr =
VPAgrSubj -- elle est partie, elle s'est vue
| VPAgrClit Gender Number ; -- elle a dormi; elle les a vues
oper
VPC : Type = {
s : VPForm => {
fin : Agr => Str ; -- ai
inf : AAgr => Str -- dit
} ;
agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic
neg : Polarity => (Str * Str) ; -- ne-pas
clAcc : CAgr ; -- le/se
clDat : CAgr ; -- lui
clit2 : Str ; -- y en
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
ext : Polarity => Str ; -- que je dors / que je dorme
} ;
}
|