summaryrefslogtreecommitdiff
path: root/src/GF/Canon/GFCC/Test.gf
blob: 6cbbd367c348af469daa6eaaba7e3ff4ca9887d4 (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
-- to test GFCC compilation

cat S ; NP ; N ; VP ;

fun Pred : NP -> VP -> S ;
fun Pred2 : NP -> VP -> NP -> S ;
fun Det, Dets : N -> NP ;

fun Mina, Te : NP ;
fun Raha, Paska, Pallo : N ;
fun Puhua, Munia, Sanoa : VP ;


param Person = P1 | P2 | P3 ;
param Number = Sg | Pl ;
param Case = Nom | Part ;

param NForm = NF Number Case ;
param VForm = VF Number Person ;

lincat N  = Noun ; 
lincat VP = Verb ; 

oper Noun = {s : NForm => Str} ;
oper Verb = {s : VForm => Str} ;

lincat NP = {s : Case => Str ; n : Number ; p : Person} ;
lin Pred np vp = {s = np.s ! Nom ++ vp.s ! VF np.n np.p} ;
lin Pred2 np vp ob = {s = np.s ! Nom ++ vp.s ! VF np.n np.p ++ ob.s ! Part} ;
lin Det  no = {s = \\c => no.s ! NF Sg c ; n = Sg ; p = P3} ;
lin Dets no = {s = \\c => no.s ! NF Pl c ; n = Pl ; p = P3} ;
lin Mina = {s = table Case ["minä" ; "minua"] ; n = Sg ; p = P1} ;
lin Te = {s = table Case ["te" ; "teitä"] ; n = Pl ; p = P2} ;
--lincat NP = {s : Case => Str ; a : {n : Number ; p : Person}} ;
--lin Pred np vp = {s = np.s ! Nom ++ vp.s ! VF np.a.n np.a.p} ;
--lin Pred2 np vp ob = {s = np.s ! Nom ++ vp.s ! VF np.a.n np.a.p ++ ob.s ! Part} ;
--lin Det  no = {s = \\c => no.s ! NF Sg c ; a = {n = Sg ; p = P3}} ;
--lin Dets no = {s = \\c => no.s ! NF Pl c ; a = {n = Pl ; p = P3}} ;
--lin Mina = {s = table Case ["minä" ; "minua"] ; a = {n = Sg ; p = P1}} ;
--lin Te = {s = table Case ["te" ; "teitä"] ; a = {n = Pl ; p = P2}} ;


lin Raha = mkN "raha" ;
lin Paska = mkN "paska" ;
lin Pallo = mkN "pallo" ;
lin Puhua = mkV "puhu" ;
lin Munia = mkV "muni" ;
lin Sanoa = mkV "sano" ;

oper mkN : Str -> Noun = \raha -> {
  s = table {
    NF Sg Nom  => raha ;
    NF Sg Part => raha + "a" ;
    NF Pl Nom  => raha + "t" ;
    NF Pl Part => Predef.tk 1 raha + "oja"
    } 
  } ;

oper mkV : Str -> Verb = \puhu -> {
  s = table {
    VF Sg P1 => puhu + "n" ;
    VF Sg P2 => puhu + "t" ;
    VF Sg P3 => puhu + Predef.dp 1 puhu ;
    VF Pl P1 => puhu + "mme" ;
    VF Pl P2 => puhu + "tte" ;
    VF Pl P3 => puhu + "vat"
    } 
  } ;