lrec tutorial examples

This commit is contained in:
aarne
2010-04-24 11:34:04 +00:00
parent f80e650329
commit 17b7fb1463
31 changed files with 871 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
abstract Ara = {
cat S ; V ;
fun ktb_V : V ;
Tab : V -> S ;
}

View File

@@ -0,0 +1,9 @@
concrete AraAra of Ara = open Arabic in {
lincat V = Verb ; S = Str ;
lin ktb_V = u_Verb "ktb" ;
Tab v = verbTable v ;
}

View File

@@ -0,0 +1,110 @@
resource Arabic = {
oper
Root : Type = {F,C,L : Str} ;
Pattern : Type = {F,FC,CL,L : Str} ;
appPattern : Root -> Pattern -> Str = \r,p ->
p.F + r.F + p.FC + r.C + p.CL + r.L + p.L ;
getRoot : Str -> Root = \s -> case s of {
F@? + C@? + L => {F = F ; C = C ; L = L} ;
_ => Predef.error ("cannot get root from" ++ s)
} ;
getPattern : Str -> Pattern = \s -> case s of {
F + "F" + FC + "C" + CL + "L" + L => {F = F ; FC = FC ; CL = CL ; L = L} ;
_ => Predef.error ("cannot get pattern from" ++ s)
} ;
getWord : Str -> Str -> Str = \r,p ->
appPattern (getRoot r) (getPattern p) ;
param
Number = Sg | Dl | Pl ;
Gender = Masc | Fem ;
Tense = Perf | Impf ;
VPer = Vp3 Number Gender | Vp2Sg Gender | Vp2Dl | Vp2Pl Gender | Vp1Sg | Vp1Pl ;
oper
Verb : Type = {s : Tense => VPer => Str} ;
pattV_u : Tense -> VPer -> Pattern = \t,v -> getPattern (case t of {
Perf => case v of {
Vp3 Sg Masc => "FaCaLa" ;
Vp3 Sg Fem => "FaCaLat" ;
Vp3 Dl Masc => "FaCaLaA" ;
Vp3 Dl Fem => "FaCaLataA" ;
Vp3 Pl Masc => "FaCaLuwA" ;
Vp3 Pl Fem => "FaCaLona" ;
Vp2Sg Masc => "FaCaLota" ;
Vp2Sg Fem => "FaCaLoti" ;
Vp2Dl => "FaCaLotumaA" ;
Vp2Pl Masc => "FaCaLotum" ;
Vp2Pl Fem => "FaCaLotunv2a" ;
Vp1Sg => "FaCaLotu" ;
Vp1Pl => "FaCaLonaA"
} ;
Impf => case v of {
Vp3 Sg Masc => "yaFoCuLu" ;
Vp3 Sg Fem => "taFoCuLu" ;
Vp3 Dl Masc => "yaFoCuLaAni" ;
Vp3 Dl Fem => "taFoCuLaAni" ;
Vp3 Pl Masc => "yaFoCuLuwna" ;
Vp3 Pl Fem => "yaFoCuLna" ;
Vp2Sg Masc => "taFoCuLu" ;
Vp2Sg Fem => "taFoCuLiyna" ;
Vp2Dl => "taFoCuLaAni" ;
Vp2Pl Masc => "taFoCuLuwna" ;
Vp2Pl Fem => "taFoCuLona" ;
Vp1Sg => "A?aFoCuLu" ;
Vp1Pl => "naFoCuLu"
}
}) ;
u_Verb : Str -> Verb = \s -> {
s = \\t,p => appPattern (getRoot s) (pattV_u t p)
} ;
-- for html
tag : Str -> Str = \t -> "<" + t + ">" ;
etag : Str -> Str = \t -> "</" + t + ">" ;
atag : Str -> Str -> Str = \t,a -> "<" + t ++ a + ">" ;
intag : Str -> Str -> Str = \t,s -> tag t ++ s ++ etag t ;
intagAttr : Str -> Str -> Str -> Str = \t,a,s -> atag t a ++ s ++ etag t ;
verbTable : Verb -> Str = \v ->
let
vsp = v.s ! Perf ;
vsi = v.s ! Impf ;
tr : Str -> Str = intag "tr" ;
td : Str -> Str = intag "td" ;
ts : Str -> Str = \s -> td ("\"" ++ s ++ "\"") ;
trs : Str -> Str -> VPer -> Str = \s,n,v ->
tr (td s ++ td n ++ ts (vsp ! v) ++ ts (vsi ! v))
in
intagAttr "table" "border=1" (
tr ((td "Persona") ++ (td "Numerus") ++ (td "Perfectum") ++ (td "Imperfectum")) ++
trs "3. masc." "sing." (Vp3 Sg Masc) ++
trs "3. fem." "sing." (Vp3 Sg Fem) ++
trs "2. masc." "sing." (Vp2Sg Masc) ++
trs "2. fem." "sing." (Vp2Sg Fem) ++
trs "1." "sing." (Vp1Sg) ++
trs "3. masc." "dual." (Vp3 Dl Masc) ++
trs "3. fem." "dual." (Vp3 Dl Fem) ++
trs "2." "dual." (Vp2Dl) ++
trs "3. masc." "plur." (Vp3 Pl Masc) ++
trs "3. fem." "plur." (Vp3 Pl Fem) ++
trs "2. masc." "plur." (Vp2Pl Masc) ++
trs "2. fem." "plur." (Vp2Pl Fem) ++
trs "1." "plur." (Vp1Pl)
) ;
}

View File

@@ -0,0 +1,17 @@
abstract Grammar = {
cat
Cl ; NP ; VP ; AP ; CN ; Det ; N ; A ; V ; V2 ;
fun
PredVP : NP -> VP -> Cl ;
ComplV2 : V2 -> NP -> VP ;
DetCN : Det -> CN -> NP ;
ModCN : CN -> AP -> CN ;
UseV : V -> VP ;
UseN : N -> CN ;
UseA : A -> AP ;
a_Det, the_Det : Det ;
this_Det, these_Det : Det ;
i_NP, she_NP, we_NP : NP ;
}

View File

@@ -0,0 +1,80 @@
concrete GrammarIta of Grammar = open ResIta, Prelude in {
lincat
Cl = {s : ResIta.Tense => Str} ;
NP = ResIta.NP ; -- {s : Case => {clit,obj : Str} ; a : Agr} ;
VP = ResIta.VP ; -- {v : Verb ; clit : Str ; obj : Str} ;
AP = {s : Gender => Number => Str ; isPre : Bool} ;
CN = Noun ; -- {s : Number => Str ; g : Gender} ;
Det = {s : Gender => Case => Str ; n : Number} ;
N = Noun ; -- {s : Number => Str ; g : Gender} ;
A = Adj ; -- {s : Gender => Number => Str ; isPre : Bool} ;
V = Verb ; -- {s : VForm => Str ; aux : Aux} ;
V2 = Verb ** {c : Case} ;
lin
PredVP np vp =
let
subj = (np.s ! Nom).obj ;
obj = vp.obj ;
clit = vp.clit ;
verb = table {
Pres => agrV vp.v np.a ;
Perf => agrV (auxVerb vp.v.aux) np.a ++ agrPart vp.v np.a
}
in {
s = \\t => subj ++ clit ++ verb ! t ++ obj
} ;
ComplV2 v2 np =
let
nps = np.s ! v2.c
in {
v = {s = v2.s ; aux = v2.aux} ;
clit = nps.clit ;
obj = nps.obj
} ;
UseV v = {
v = v ;
clit = [] ;
obj = []
} ;
DetCN det cn = {
s = \\c => {obj = det.s ! cn.g ! c ++ cn.s ! det.n ; clit = []} ;
a = Ag cn.g det.n Per3
} ;
ModCN cn ap = {
s = \\n => preOrPost ap.isPre (ap.s ! cn.g ! n) (cn.s ! n) ;
g = cn.g
} ;
UseN n = n ;
UseA adj = adj ;
a_Det = adjDet (mkA "un" "una" [] [] True) Sg ;
the_Det = {
s = table {
Masc => table {
Nom | Acc => pre {"il" ; "lo" / s_impuro ; "l'" / vowel} ;
Dat => pre {"al" ; "allo" / s_impuro ; "all'" / vowel}
} ;
Fem => table {
Nom | Acc => pre {"la" ; "l'" / vowel} ;
Dat => pre {"alla" ; "all'" / vowel}
}
} ;
n = Sg
} ;
this_Det = adjDet (mkA "questo") Sg ;
these_Det = adjDet (mkA "questo") Pl ;
i_NP = pronNP "io" "mi" "mi" Masc Sg Per1 ;
she_NP = pronNP "lei" "la" "le" Fem Sg Per3 ;
we_NP = pronNP "noi" "ci" "ci" Masc Pl Per1 ;
}

View File

@@ -0,0 +1,80 @@
concrete GrammarIta of Grammar = open ResIta, Prelude in {
lincat
Cl = {s : Tense => Str} ;
NP = {s : Case => Str ; a : Agr} ;
VP = {s : VForm => Str ; aux : Aux} ;
AP = {s : Gender => Number => Str} ;
CN = {s : Number => Str ; g : Gender} ;
Det = {s : Gender => Case => Str ; n : Number} ;
N = {s : Number => Str ; g : Gender} ;
A = {s : Gender => Number => Str} ;
V = {s : VForm => Str ; aux : Aux} ;
V2 = Verb ** {c : Preposition} ;
lin
PredVP np vp =
let
subj = np.s ! Nom ;
obj = vp.obj ;
clit = vp.clit ;
verb = table {
Pres => agrV vp ;
Perf => agrV (auxVerb vp.aux) np.a ++ agrPart vp np.a
}
in {
s = \\t => subj ++ clit ++ verb ! t ++ obj
} ;
ComplV2 v2 np =
let
nps = np.s ! v2.c.c
in {
v = {s = v2.s ; aux = v2.aux} ;
clit = nps.clit ;
obj = v2.c.p ++ nps.obj
} ;
UseV v = {
v = v ;
clit = [] ;
obj = []
} ;
DetCN det cn = {
s = \\c => {obj = det.s ! cn.g ! c ++ cn.s ! det.n ; clit = []} ;
a = Ag cn.g det.n Per3
} ;
ModCN cn ap = {
s = \\n => preOrPost ap.isPre (ap.s ! cn.g ! n) (cn.s ! n) ;
g = cn.g
} ;
UseN n = n ;
UseA adj = adj ;
a_Det = adjDet (mkA "un" "una" [] [] True) Sg ;
the_Det = {
s = table {
Masc => table {
Nom | Acc => pre {"il" ; "lo" / s_impuro ; "l'" / vowel} ;
Dat => pre {"al" ; "allo" / s_impuro ; "all'" / vowel}
} ;
Fem => table {
Nom | Acc => pre {"la" ; "l'" / vowel} ;
Dat => pre {"alla" ; "all'" / vowel}
}
} ;
n = Sg
} ;
this_Det = adjDet (mkA "questo") Sg ;
these_Det = adjDet (mkA "questo") Pl ;
i_NP = pronNP "io" "mi" "mi" Masc Sg Per1 ;
she_NP = pronNP "lei" "la" "le" Fem Sg Per3 ;
we_NP = pronNP "noi" "ci" "ci" Masc Pl Per1 ;
}

View File

@@ -0,0 +1,9 @@
abstract Lang = Grammar ** {
fun
man_N, woman_N, house_N, tree_N : N ;
big_A, small_A, green_A : A ;
walk_V, arrive_V : V ;
love_V2, please_V2 : V2 ;
} ;

View File

@@ -0,0 +1,17 @@
concrete LangIta of Lang = GrammarIta ** open ResIta in {
lin
man_N = mkN "uomo" "uomini" Masc ;
woman_N = mkN "donna" ;
house_N = mkN "casa" ;
tree_N = mkN "albero" ;
big_A = preA (mkA "grande") ;
small_A = preA (mkA "piccolo") ;
green_A = mkA "verde" ;
walk_V = mkV "camminare" ;
arrive_V = essereV (mkV "arrivare") ;
love_V2 = mkV2 "amare" ;
please_V2 = mkV2 (mkV "piacere" "piaccio" "piaci" "piace"
"piacciamo" "piacete" "piacciono" "piaciuto" Essere) Dat ;
} ;

View File

@@ -0,0 +1,9 @@
instance LexFaceIta of LexFace = open SyntaxIta, ParadigmsIta, LexiconIta in {
oper
like_V2 = mkV2 "amare" ;
invitation_N = mkN "invitazione" feminine ;
friend_N = mkN "amico" ;
have_V2 = LexiconIta.have_V2 ;
}

View File

@@ -0,0 +1,82 @@
resource Morpho = open Prelude in {
param
VForm = VInf | VPres | VPast | VPastPart | VPresPart ;
oper
Verb : Type = {s : VForm => Str} ;
-- worst-case function for data abstraction
mkVerb : (_,_,_,_,_ : Str) -> Verb = \vi,vpr,vpa,vpap,vprp -> {
s = table {
VInf => vi ;
VPres => vpr ;
VPast => vpa ;
VPastPart => vpap ;
VPresPart => vprp
}
} ;
regVerb : Str -> Verb = \walk ->
mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
s_regVerb : Str -> Verb = \kiss ->
mkVerb kiss (kiss + "es") (kiss + "ed") (kiss + "ed") (kiss + "ing") ;
e_regVerb : Str -> Verb = \use ->
let us = init use
in
mkVerb use (use + "s") (us + "ed") (us + "ed") (us + "ing") ;
y_regVerb : Str -> Verb = \cry ->
let cr = init cry
in
mkVerb cry (cr + "ies") (cr + "ied") (cr + "ied") (cry + "ing") ;
ie_regVerb : Str -> Verb = \die ->
let dy = Predef.tk 2 die + "y"
in
mkVerb die (die + "s") (die + "d") (die + "d") (dy + "ing") ;
dupRegVerb : Str -> Verb = \stop ->
let stopp = stop + last stop
in
mkVerb stop (stop + "s") (stopp + "ed") (stopp + "ed") (stopp + "ing") ;
smartVerb : Str -> Verb = \v -> case v of {
_ + ("s"|"z"|"x"|"ch") => s_regVerb v ;
_ + "ie" => ie_regVerb v ;
_ + "ee" => mkVerb v (v + "s") (v + "d") (v + "d") (v + "ing") ;
_ + "e" => e_regVerb v ;
_ + ("a"|"e"|"o"|"u") + "y" => regVerb v ;
_ + "y" => y_regVerb v ;
_ + ("ea"|"ee"|"ie"|"oa"|"oo"|"ou") + ? => regVerb v ;
_ + ("a"|"e"|"i"|"o"|"u") +
("b"|"d"|"g"|"m"|"n"|"p"|"s"|"t") => dupRegVerb v ;
_ => regVerb v
} ;
irregVerb : (_,_,_ : Str) -> Verb = \sing,sang,sung ->
let v = smartVerb sing
in
mkVerb sing (v.s ! VPres) sang sung (v.s ! VPresPart) ;
-- first example of matching
add_s : Str -> Str = \v -> case v of {
_ + ("s"|"z"|"x"|"ch") => v + "es" ;
_ + ("a"|"e"|"o"|"u") + "y" => v + "s" ;
cr + "y" => cr + "ies" ;
_ => v + "s"
} ;
-- user paradigm
mkV = overload {
mkV : (cry : Str) -> Verb = smartVerb ;
mkV : (sing,sang,sung : Str) -> Verb = irregVerb ;
mkV : (go,goes,went,gone,going : Str) -> Verb = mkVerb ;
} ;
}

View File

@@ -0,0 +1,42 @@
abstract One = {
cat
S ;
Cl ;
NP ;
VP ;
AP ;
CN ;
Det ;
Pron ;
PN ;
N ;
A ;
V ;
V2 ;
Adv ;
Prep ;
Pol ;
Tense ;
fun
DeclCl : Tense -> Pol -> Cl -> S ;
QuestCl : Tense -> Pol -> Cl -> S ;
PredVP : NP -> VP -> Cl ;
ComplV2 : V2 -> NP -> VP ;
UseAP : AP -> VP ;
UseV : V -> VP ;
AdVP : VP -> Adv -> VP ;
DetCN : Det -> CN -> NP ;
UsePN : PN -> NP ;
UsePron : Pron -> NP ;
ModCN : CN -> AP -> CN ;
UseN : N -> CN ;
UseA : A -> AP ;
AdvA : A -> Adv ;
PrepNP : Prep -> NP -> Adv ;
}

View File

@@ -0,0 +1,154 @@
resource ResIta = open Prelude in {
-- parameters
param
Number = Sg | Pl ;
Gender = Masc | Fem ;
Case = Nom | Acc | Dat ;
Agr = Ag Gender Number Person ;
Aux = Avere | Essere ;
Tense = Pres | Perf ;
Person = Per1 | Per2 | Per3 ;
VForm = VInf | VPres Number Person | VPart Gender Number ;
-- parts of speech
oper
VP = {v : Verb ; clit : Str ; obj : Str} ;
NP = {s : Case => {clit,obj : Str} ; a : Agr} ;
-- auxiliaries
prepCase : Case -> Str = \c -> case c of {
Dat => "a" ;
_ => []
} ;
adjDet : Adj -> Number -> {s : Gender => Case => Str ; n : Number} = \adj,n -> {
s = \\g,c => prepCase c ++ adj.s ! g ! n ;
n = n
} ;
pronNP : (s,a,d : Str) -> Gender -> Number -> Person -> NP = \s,a,d,g,n,p -> {
s = table {
Nom => {clit = [] ; obj = s} ;
Acc => {clit = a ; obj = []} ;
Dat => {clit = d ; obj = []}
} ;
a = Ag g n p
} ;
-- predication
agrV : Verb -> Agr -> Str = \v,a -> case a of {
Ag _ n p => v.s ! VPres n p
} ;
auxVerb : Aux -> Verb = \a -> case a of {
Avere => mkVerb "avere" "ho" "hai" "ha" "abbiamo" "avete" "hanno" "avuto" Avere ;
Essere => mkVerb "essere" "sono" "sei" "è" "siamo" "siete" "sono" "stato" Essere
} ;
agrPart : Verb -> Agr -> Str = \v,a -> case v.aux of {
Avere => v.s ! VPart Masc Sg ;
Essere => case a of {
Ag g n _ => v.s ! VPart g n
}
} ;
neg : Bool -> Str = \b -> case b of {True => [] ; False => "non"} ;
--------------------------------------------------------
-- morphology
Noun : Type = {s : Number => Str ; g : Gender} ;
Adj : Type = {s : Gender => Number => Str ; isPre : Bool} ;
Verb : Type = {s : VForm => Str ; aux : Aux} ;
mkNoun : Str -> Str -> Gender -> Noun = \vino,vini,g -> {
s = table {Sg => vino ; Pl => vini} ;
g = g
} ;
regNoun : Str -> Noun = \vino -> case vino of {
fuo + c@("c"|"g") + "o" => mkNoun vino (fuo + c + "hi") Masc ;
ol + "io" => mkNoun vino (ol + "i") Masc ;
vin + "o" => mkNoun vino (vin + "i") Masc ;
cas + "a" => mkNoun vino (cas + "e") Fem ;
pan + "e" => mkNoun vino (pan + "i") Masc ;
_ => mkNoun vino vino Masc
} ;
mkN = overload {
mkN : (vino : Str) -> Noun = regNoun ;
mkN : (uomo, uomini : Str) -> Gender -> Noun = mkNoun ;
} ;
mkAdj : (_,_,_,_ : Str) -> Bool -> Adj = \buono,buona,buoni,buone,p -> {
s = table {
Masc => table {Sg => buono ; Pl => buoni} ;
Fem => table {Sg => buona ; Pl => buone}
} ;
isPre = p
} ;
regAdj : Str -> Adj = \nero -> case nero of {
ner + "o" => mkAdj nero (ner + "a") (ner + "i") (ner + "e") False ;
verd + "e" => mkAdj nero nero (verd + "i") (verd + "i") False ;
_ => mkAdj nero nero nero nero False
} ;
mkA = overload {
mkA : (nero : Str) -> Adj = regAdj ;
mkN : (buono,buona,buoni,buone : Str) -> Bool -> Adj = mkAdj ;
} ;
preA : Adj -> Adj = \a -> {s = a.s ; isPre = True} ;
mkVerb : (_,_,_,_,_,_,_,_ : Str) -> Aux -> Verb =
\amare,amo,ami,ama,amiamo,amate,amano,amato,aux -> {
s = table {
VInf => amare ;
VPres Sg Per1 => amo ;
VPres Sg Per2 => ami ;
VPres Sg Per3 => ama ;
VPres Pl Per1 => amiamo ;
VPres Pl Per2 => amate ;
VPres Pl Per3 => amano ;
VPart g n => (regAdj amato).s ! g ! n
} ;
aux = aux
} ;
regVerb : Str -> Verb = \amare -> case amare of {
am + "are" => mkVerb amare (am+"o") (am+"i") (am+"a")
(am+"iamo") (am+"ate") (am+"ano") (am+"ato") Avere ;
tem + "ere" => mkVerb amare (tem+"o") (tem+"i") (tem+"e")
(tem+"iamo") (tem+"ete") (tem+"ono") (tem+"uto") Avere ;
fin + "ire" => mkVerb amare (fin+"isco") (fin+"isci") (fin+"isce")
(fin+"iamo") (fin+"ite") (fin+"iscono") (fin+"ito") Avere
} ;
mkV = overload {
mkV : (finire : Str) -> Verb = regVerb ;
mkV : (andare,vado,vadi,va,andiamo,andate,vanno,andato : Str) ->
Aux -> Verb = mkVerb ;
} ;
essereV : Verb -> Verb = \v -> {s = v.s ; aux = Essere} ;
Verb2 = Verb ** {c : Case} ;
mkV2 = overload {
mkV2 : (amare : Str) -> Verb2 = \v -> regVerb v ** {c = Acc} ;
mkV2 : (amare : Verb) -> Case -> Verb2 = \v,p -> v ** {c = p} ;
} ;
-- phonological auxiliaries
vowel : Strs = strs {"a" ; "e" ; "i" ; "o" ; "u" ; "h"} ;
s_impuro : Strs = strs {"z" ; "sb" ; "sc" ; "sd" ; "sf" ; "sp"} ; --- ...
}

View File

@@ -0,0 +1,9 @@
abstract Zero = {
cat
S ; NP ; VP ; V2 ;
fun
Pred : NP -> VP -> S ;
Compl : V2 -> NP -> VP ;
John, Mary : NP ;
Love : V2 ;
}

View File

@@ -0,0 +1,18 @@
concrete ZeroDut of Zero = {
lincat
S, NP, VP = Str ;
V2 = {v,p : Str} ;
lin
Pred np vp = np ++ vp ;
Compl v2 np = v2.v ++ np ++ v2.p ;
John = "Jan" ;
Mary = "Marie" ;
Love = {v = "heeft" ; p = "lief"} ;
}
--.
-- illustrates: discontinuous constituents
--
-- > p -lang=ZeroEng "John loves Mary" | aw -view=open -format=png

View File

@@ -0,0 +1,11 @@
concrete ZeroEng of Zero = {
lincat
S, NP, VP, V2 = Str ;
lin
Pred np vp = np ++ vp ;
Compl v2 np = v2 ++ np ;
John = "John" ;
Mary = "Mary" ;
Love = "loves" ;
}

View File

@@ -0,0 +1,16 @@
concrete ZeroFre of Zero = {
lincat
S, NP, VP, V2 = Str ;
lin
Pred np vp = np ++ vp ;
Compl v2 np = v2 ++ np ;
John = "Jean" ;
Mary = "Marie" ;
Love = "aime" ;
}
--.
-- > gr | l
-- > p -lang=ZeroEng "John loves Mary" | l -lang=ZeroFre

View File

@@ -0,0 +1,19 @@
concrete ZeroGer of Zero = {
lincat
S, NP, VP = Str ;
V2 = {v,p : Str} ;
lin
Pred np vp = np ++ vp ;
Compl v2 np = v2.v ++ np ++ v2.p ;
John = "Johann" ;
Mary = "Maria" ;
Love = {v = "hat" ; p = "lieb"} ;
}
--.
-- illustrates: discontinuous constituents
-- contrived, since we also have "liebt"
--
-- > p -lang=ZeroEng "John loves Mary" | aw -view=open -format=png

View File

@@ -0,0 +1,24 @@
concrete ZeroHeb of Zero = {
flags coding=utf8 ;
lincat
S = Str ;
NP = {s : Str ; g : Gender} ;
VP, V2 = Gender => Str ;
lin
Pred np vp = np.s ++ vp ! np.g ;
Compl v2 np = table {g => v2 ! g ++ "את" ++ np.s} ;
John = {s = "ג׳ון" ; g = Masc} ;
Mary = {s = "מרי" ; g = Fem} ;
Love = table {Masc => "אוהב" ; Fem => "אוהבת"} ;
param
Gender = Masc | Fem ;
}
--.
-- illustrates: transliteration, inherent features, agreement
-- > gr | l -to_hebrew
-- > ut -hebrew
-- > rf -file=ZeroHeb.gf | ps -env=quotes -to_hebrew
-- > dc amac aw -format=png -view=open ?0
-- > gr | %amac

View File

@@ -0,0 +1,20 @@
concrete ZeroHebTr of Zero = {
lincat
S = Str ;
NP = {s : Str ; g : Gender} ;
VP, V2 = Gender => Str ;
lin
Pred np vp = np.s ++ vp ! np.g ;
Compl v2 np = table {g => v2 ! g ++ "At" ++ np.s} ;
John = {s = "gg1wN" ; g = Masc} ;
Mary = {s = "mry" ; g = Fem} ;
love = table {Masc => "Awhb" ; Fem => "Awhbt"} ;
param
Gender = Masc | Fem ;
}
--.
-- illustrates: transliteration, inherent features, agreement
-- > gr | l -to_hebrew
-- > ut -hebrew
-- > rf -file=ZeroHeb.gf | ps -env=quotes -to_hebrew

View File

@@ -0,0 +1,16 @@
concrete ZeroIta of Zero = {
lincat
S, NP, VP, V2 = Str ;
lin
Pred np vp = np ++ vp ;
Compl v2 np = v2 ++ np ;
John = "Giovanni" ;
Mary = "Maria" ;
Love = "ama" ;
}
--.
-- > gr | l
-- > p -lang=ZeroEng "John loves Mary" | l -lang=ZeroIta

View File

@@ -0,0 +1,17 @@
concrete ZeroLat of Zero = {
lincat
S, VP, V2 = Str ;
NP = Case => Str ;
lin
Pred np vp = np ! Nom ++ vp ;
Compl v2 np = np ! Acc ++ v2 ;
John = table {Nom => "Ioannes" ; Acc => "Ioannem"} ;
Mary = table {Nom => "Maria" ; Acc => "Mariam"} ;
Love = "amat" ;
param
Case = Nom | Acc ;
}
--.
-- illustrates: parameters, word order
-- > p -lang=ZeroEng "John loves Mary" | aw -view=open -format=png

View File

@@ -0,0 +1,14 @@
abstract Face = {
flags startcat = Message ;
cat
Message ; Person ; Object ; Number ;
fun
Have : Person -> Number -> Object -> Message ;
Like : Person -> Object -> Message ;
You : Person ;
Friend, Invitation : Object ;
One, Two, Hundred : Number ;
}

View File

@@ -0,0 +1,22 @@
--# -path=.:present
concrete FaceEn0 of Face = open SyntaxEng, ParadigmsEng in {
lincat
Message = Cl ;
Person = NP ;
Object = CN ;
Number = Numeral ;
lin
Have p n o = mkCl p have_V2 (mkNP n o) ;
Like p o = mkCl p like_V2 (mkNP this_Quant o) ;
You = mkNP youSg_Pron ;
Friend = mkCN friend_N ;
Invitation = mkCN invitation_N ;
One = n1_Numeral ;
Two = n2_Numeral ;
Hundred = n100_Numeral ;
oper
like_V2 = mkV2 "like" ;
invitation_N = mkN "invitation" ;
friend_N = mkN "friend" ;
}

View File

@@ -0,0 +1,7 @@
--# -path=.:present
concrete FaceEng of Face = FaceI with
(Syntax = SyntaxEng),
(LexFace = LexFaceEng) ;

View File

@@ -0,0 +1,7 @@
--# -path=.:present
concrete FaceFin of Face = FaceI with
(Syntax = SyntaxFin),
(LexFace = LexFaceFin) ;

View File

@@ -0,0 +1,17 @@
incomplete concrete FaceI of Face = open Syntax, LexFace in {
lincat
Message = Cl ;
Person = NP ;
Object = CN ;
Number = Numeral ;
lin
Have p n o = mkCl p have_V2 (mkNP n o) ;
Like p o = mkCl p like_V2 (mkNP this_Quant o) ;
You = mkNP youSg_Pron ;
Friend = mkCN friend_N ;
Invitation = mkCN invitation_N ;
One = n1_Numeral ;
Two = n2_Numeral ;
Hundred = n100_Numeral ;
}

View File

@@ -0,0 +1,8 @@
--# -path=.:present
concrete FaceIta of Face = FaceI - [Like] with
(Syntax = SyntaxIta),
(LexFace = LexFaceIta) ** open SyntaxIta in {
lin Like p o =
mkCl (mkNP this_Quant o) like_V2 p ;
}

View File

@@ -0,0 +1,8 @@
interface LexFace = open Syntax in {
oper
like_V2 : V2 ;
invitation_N : N ;
friend_N : N ;
}

View File

@@ -0,0 +1,8 @@
instance LexFaceEng of LexFace = open SyntaxEng, ParadigmsEng in {
oper
like_V2 = mkV2 "like" ;
invitation_N = mkN "invitation" ;
friend_N = mkN "friend" ;
}

View File

@@ -0,0 +1,7 @@
instance LexFaceFin of LexFace = open SyntaxFin, ParadigmsFin in {
oper
like_V2 = mkV2 (mkV "pitää") elative ;
invitation_N = mkN "kutsu" ;
friend_N = mkN "ystävä" ;
}

View File

@@ -0,0 +1,6 @@
instance LexFaceIta of LexFace = open SyntaxIta, ParadigmsIta in {
oper
like_V2 = mkV2 (mkV (piacere_64 "piacere")) dative ;
invitation_N = mkN "invito" ;
friend_N = mkN "amico" ;
}