mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-19 01:39:32 -06:00
syntax interfaces
This commit is contained in:
@@ -71,19 +71,19 @@ incomplete resource Constructors = open Grammar in {
|
||||
--2 Sentences, and clauses
|
||||
|
||||
mkS : overload {
|
||||
mkS : Cl -> S ; -- John walks
|
||||
mkS : Tense -> Cl -> S ; -- John walked
|
||||
mkS : Ant -> Cl -> S ; -- John has walked
|
||||
mkS : Pol -> Cl -> S ; -- John doesn't walk
|
||||
mkS : Tense -> Ant -> Cl -> S ; -- John had walked
|
||||
mkS : Tense -> Pol -> Cl -> S ; -- John didn't walk
|
||||
mkS : Ant -> Pol -> Cl -> S ; -- John hasn't walked
|
||||
mkS : Tense -> Ant -> Pol -> Cl -> S ; -- John wouldn't have walked
|
||||
mkS : Conj -> S -> S -> S ; -- John walks and Mary talks
|
||||
mkS : DConj -> S -> S -> S ; -- either I leave or you come
|
||||
mkS : Conj -> ListS -> S ; -- John walks, Mary talks, and Bob runs
|
||||
mkS : DConj -> ListS -> S ; -- either I leave, you come, or he runs
|
||||
mkS : Adv -> S -> S -- today, I will sleep
|
||||
mkS : Cl -> S ; -- John walks
|
||||
mkS : Tense -> Cl -> S ; -- John walked
|
||||
mkS : Ant -> Cl -> S ; -- John has walked
|
||||
mkS : Pol -> Cl -> S ; -- John doesn't walk
|
||||
mkS : Tense -> Ant -> Cl -> S ; -- John had walked
|
||||
mkS : Tense -> Pol -> Cl -> S ; -- John didn't walk
|
||||
mkS : Ant -> Pol -> Cl -> S ; -- John hasn't walked
|
||||
mkS : Tense -> Ant -> Pol -> Cl -> S ; -- John wouldn't have walked
|
||||
mkS : Conj -> S -> S -> S ; -- John walks and Mary talks
|
||||
mkS : DConj -> S -> S -> S ; -- either I leave or you come
|
||||
mkS : Conj -> ListS -> S ; -- John walks, Mary talks, and Bob runs
|
||||
mkS : DConj -> ListS -> S ; -- either I leave, you come, or he runs
|
||||
mkS : Adv -> S -> S -- today, I will sleep
|
||||
} ;
|
||||
|
||||
mkCl : overload {
|
||||
|
||||
4
lib/resource-1.0/api/Syntax.gf
Normal file
4
lib/resource-1.0/api/Syntax.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
interface Syntax = Constructors, Cat, Structural ** {} ;
|
||||
|
||||
4
lib/resource-1.0/api/SyntaxEng.gf
Normal file
4
lib/resource-1.0/api/SyntaxEng.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxEng of Syntax = ConstructorsEng, CatEng, StructuralEng ** {} ;
|
||||
|
||||
4
lib/resource-1.0/api/SyntaxFin.gf
Normal file
4
lib/resource-1.0/api/SyntaxFin.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxFin of Syntax = ConstructorsFin, CatFin, StructuralFin ** {} ;
|
||||
|
||||
4
lib/resource-1.0/api/SyntaxFre.gf
Normal file
4
lib/resource-1.0/api/SyntaxFre.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxFre of Syntax = ConstructorsFre, CatFre, StructuralFre ** {} ;
|
||||
|
||||
4
lib/resource-1.0/api/SyntaxGer.gf
Normal file
4
lib/resource-1.0/api/SyntaxGer.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer ** {} ;
|
||||
|
||||
4
lib/resource-1.0/api/SyntaxSwe.gf
Normal file
4
lib/resource-1.0/api/SyntaxSwe.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxSwe of Syntax = ConstructorsSwe, CatSwe, StructuralSwe ** {} ;
|
||||
|
||||
@@ -127,10 +127,6 @@ oper
|
||||
|
||||
nounPN : N -> PN ;
|
||||
|
||||
-- To form a noun phrase that can also be plural and have an irregular
|
||||
-- genitive, you can use the worst-case function.
|
||||
|
||||
mkNP : Str -> Str -> Number -> Gender -> NP ;
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
@@ -271,12 +267,12 @@ oper
|
||||
mkAV : A -> AV ;
|
||||
mkA2V : A -> Prep -> A2V ;
|
||||
|
||||
-- Notice: categories $V2S, V2V, V2A, V2Q$ are in v 1.0 treated
|
||||
-- Notice: categories $V2S, V2V, V2Q$ are in v 1.0 treated
|
||||
-- just as synonyms of $V2$, and the second argument is given
|
||||
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||
-- $V0$ is just $V$.
|
||||
|
||||
V0, V2S, V2V, V2A, V2Q : Type ;
|
||||
V0, V2S, V2V, V2Q : Type ;
|
||||
AS, A2S, AV, A2V : Type ;
|
||||
|
||||
--.
|
||||
@@ -354,8 +350,6 @@ oper
|
||||
regPN n = regGenPN n human ;
|
||||
regGenPN n g = nameReg n g ** {lock_PN = <>} ;
|
||||
nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
|
||||
mkNP x y n g = {s = table {Gen => x ; _ => y} ; a = agrP3 n ;
|
||||
lock_NP = <>} ;
|
||||
|
||||
mk2A a b = mkAdjective a a a b ** {lock_A = <>} ;
|
||||
regA a = regAdjective a ** {lock_A = <>} ;
|
||||
@@ -462,7 +456,7 @@ oper
|
||||
mkVQ v = v ** {lock_VQ = <>} ;
|
||||
|
||||
V0 : Type = V ;
|
||||
V2S, V2V, V2Q, V2A : Type = V2 ;
|
||||
V2S, V2V, V2Q : Type = V2 ;
|
||||
AS, A2S, AV : Type = A ;
|
||||
A2V : Type = A2 ;
|
||||
|
||||
|
||||
@@ -49,13 +49,11 @@ rebuildModule ms mo@(i,mi) = do
|
||||
--- to avoid double inclusions, in instance I of I0 = J0 ** ...
|
||||
case extends m of
|
||||
[] -> return $ replaceJudgements m js'
|
||||
j0:jj -> do
|
||||
m0 <- lookupModMod gr j0
|
||||
let notInM0 c _ = not $ isInBinTree c $ jments m0
|
||||
j0s -> do
|
||||
m0s <- mapM (lookupModMod gr) j0s
|
||||
let notInM0 c _ = all (not . isInBinTree c . jments) m0s
|
||||
let js2 = filterBinTree notInM0 js'
|
||||
if null jj
|
||||
then return $ replaceJudgements m js2
|
||||
else Bad "FIXME: handle multiple inheritance in instance"
|
||||
return $ replaceJudgements m js2
|
||||
return $ ModMod m'
|
||||
_ -> return mi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user