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

param AG = A Num Gen ;

oper Agr = {g : Gen ; n : Num} ;

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

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

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


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

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


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