summaryrefslogtreecommitdiff
path: root/src/GF/Canon/GFCC/Test.gf
blob: cd52a629172d1432baa245d2d10f8ee9424e417b (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
-- 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 ;

lincat NP = {s : Case => Str ; a : {n : Number ; p : Person}} ;
lincat N  = Noun ; 
lincat VP = Verb ; 

oper Noun = {s : {n : Number ; c : Case} => Str} ;
oper Verb = {s : {n : Number ; p : Person} => Str} ;

lin Pred np vp = {s = np.s ! Nom ++ vp.s ! np.a} ;
lin Pred2 np vp ob = {s = np.s ! Nom ++ vp.s ! np.a ++ ob.s ! Part} ;
lin Det  no = {s = \\c => no.s ! {n = Sg ; c = c} ; a = {n = Sg ; p = P3}} ;
lin Dets no = {s = \\c => no.s ! {n = Pl ; c = 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 {
    {n = Sg ; c = Nom} => raha ;
    {n = Sg ; c = Part} => raha + "a" ;
    {n = Pl ; c = Nom} => raha + "t" ;
    {n = Pl ; c = Part} => Predef.tk 1 raha + "oja"
    } 
  } ;

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