summaryrefslogtreecommitdiff
path: root/devel/compiler/ex.src
blob: 241fd96b464fe6f949cfb8e2568cdbbc496160a6 (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
param Num = Sg | Pl ;
param Gen = Masc | Fem ;

param AG = A Num Gen ;

oper Agr = {g#0 : Gen ; n#1 : Num} ;

oper CN = {s#1 : Num -> Str ; g#0 : Gen} ;
oper NP = {s#1 : Str ; a#0 : Agr} ;

oper artDef : Gen -> Str = \g -> table Gen {
  (Masc) => "le" ;
  (Fem) => "la"
} ! $g ;

lin Voiture : CN = {
  s#1 = table Num {
    (Sg) => "voiture" ;
    (Pl) => "voitures"
  } ;
  g#0 = (Fem@)
} ;


lin Bus : CN = {
  s#1 = table Num {$x => "bus"} ;
  g#0 = (Masc@)
} ;

lin Indef : CN -> NP = \cn -> {
  s#1 = table Gen {
        (Masc) => "un" ;
        $x     => "une"
        } ! $cn.g#0 ++ $cn.s#1 ! (Sg@) ;
  a#0 = {g#0 = $cn.g#0 ; n#1 = (Sg@)} 
} ;


lin Def : CN -> NP = \cn -> {
  s#1 = &artDef $cn.g#0 ++ $cn.s#1 ! (Sg@) ;
  a#0 = {g#0 = $cn.g#0 ; n#1 = (Sg@)} 
} ;

lin UneVoiture : NP = Indef Voiture ;
lin LaVoiture : NP = Def Voiture ;