mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 22:09:32 -06:00
alternative list syntaxes
This commit is contained in:
@@ -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 ;
|
||||
|
||||
}
|
||||
|
||||
23
lib/resource-1.0/abstract/ListConjunction.gf
Normal file
23
lib/resource-1.0/abstract/ListConjunction.gf
Normal 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} ;
|
||||
|
||||
}
|
||||
@@ -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} ;
|
||||
|
||||
}
|
||||
|
||||
43
lib/resource-1.0/english/ListConjunctionEng.gf
Normal file
43
lib/resource-1.0/english/ListConjunctionEng.gf
Normal 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} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user