1
0
forked from GitHub/gf-core

simple source language for compiler experiment

This commit is contained in:
aarne
2007-03-24 23:11:59 +00:00
parent 4fdc0b598a
commit 436ddd5ebf
2 changed files with 95 additions and 0 deletions

31
devel/compiler/ex.src Normal file
View File

@@ -0,0 +1,31 @@
param Num = Sg | Pl ;
param Gen = Masc | Fem ;
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 {
(Masc) => "le" ;
(Fem) => "la"
} ! g ;
lin Voiture : CN = {
s = table {
(Sg) => "voiture" ;
(Pl) => "voitures"
} ;
g = Fem
} ;
lin Bus : CN = {
s = table {$x => "bus"} ;
g = Masc
} ;
lin Def : CN -> NP = \cn -> {
s = artDef cn.g ++ cn.s ! Sg ;
a = {g = cn.g ; n = Sg}
} ;