alternative list syntaxes

This commit is contained in:
aarne
2005-12-04 20:56:33 +00:00
parent ece605f887
commit 7fc991cd18
4 changed files with 103 additions and 27 deletions

View File

@@ -2,22 +2,34 @@ abstract Conjunction = Cat ** {
fun
ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs"
ConjAP : Conj -> [AP] -> AP ; -- "even and prime"
ConjNP : Conj -> [NP] -> NP ; -- "John or Mary"
ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly"
ConjS : Conj -> SeqS -> S ; -- "John walks and Mary runs"
ConjAP : Conj -> SeqAP -> AP ; -- "even and prime"
ConjNP : Conj -> SeqNP -> NP ; -- "John or Mary"
ConjAdv : Conj -> SeqAdv -> Adv ; -- "quickly or slowly"
DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs"
DConjAP : DConj -> [AP] -> AP ; -- "both even and prime"
DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary"
DConjAdv : DConj -> [Adv] -> Adv ; -- "both badly and slowly"
DConjS : DConj -> SeqS -> S ; -- "either John walks or Mary runs"
DConjAP : DConj -> SeqAP -> AP ; -- "both even and prime"
DConjNP : DConj -> SeqNP -> NP ; -- "either John or Mary"
DConjAdv : DConj -> SeqAdv -> Adv ; -- "both badly and slowly"
-- These categories are internal to this module.
-- these are rather uninteresting
TwoS : S -> S -> SeqS ;
AddS : SeqS -> S -> SeqS ;
TwoAdv : Adv -> Adv -> SeqAdv ;
AddAdv : SeqAdv -> Adv -> SeqAdv ;
TwoNP : NP -> NP -> SeqNP ;
AddNP : SeqNP -> NP -> SeqNP ;
TwoAP : AP -> AP -> SeqAP ;
AddAP : SeqAP -> AP -> SeqAP ;
-- we use right-associative lists instead of GF's built-in lists
cat
[S]{2} ;
[Adv]{2} ;
[NP]{2} ;
[AP]{2} ;
SeqS ;
SeqAdv ;
SeqNP ;
SeqAP ;
}

View File

@@ -0,0 +1,23 @@
abstract Conjunction = Cat ** {
fun
ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs"
ConjAP : Conj -> [AP] -> AP ; -- "even and prime"
ConjNP : Conj -> [NP] -> NP ; -- "John or Mary"
ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly"
DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs"
DConjAP : DConj -> [AP] -> AP ; -- "both even and prime"
DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary"
DConjAdv : DConj -> [Adv] -> Adv ; -- "both badly and slowly"
-- These categories are internal to this module.
cat
[S]{2} ;
[Adv]{2} ;
[NP]{2} ;
[AP]{2} ;
}

View File

@@ -23,21 +23,19 @@ concrete ConjunctionEng of Conjunction =
isPre = ss.isPre
} ;
-- These fun's are generated from the list cat's.
BaseS = twoSS ;
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
TwoS = twoSS ;
AddS = consSS comma ;
TwoAdv = twoSS ;
AddAdv = consSS comma ;
TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
AddAP xs x = consTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
[AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
SeqS = {s1,s2 : Str} ;
SeqAdv = {s1,s2 : Str} ;
SeqNP = {s1,s2 : Case => Str ; a : Agr} ;
SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ;
}

View File

@@ -0,0 +1,43 @@
concrete ConjunctionEng of Conjunction =
CatEng ** open ResEng, Coordination, Prelude in {
lin
ConjS conj ss = {s = conjunctX conj ss} ;
DConjS conj ss = {s = conjunctDistrX conj ss} ;
ConjAdv conj ss = {s = conjunctX conj ss} ;
DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
ConjNP conj ss = conjunctTable Case conj ss ** {
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
} ;
DConjNP conj ss = conjunctDistrTable Case conj ss ** {
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
} ;
ConjAP conj ss = conjunctTable Agr conj ss ** {
isPre = ss.isPre
} ;
DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
isPre = ss.isPre
} ;
-- These fun's are generated from the list cat's.
BaseS = twoSS ;
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
[AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
}