diff --git a/lib/resource-1.0/abstract/Cat.gf b/lib/resource-1.0/abstract/Cat.gf index c8431a7bc..85e81e97d 100644 --- a/lib/resource-1.0/abstract/Cat.gf +++ b/lib/resource-1.0/abstract/Cat.gf @@ -6,15 +6,6 @@ abstract Cat = Common ** { cat ---2 Top-level units - --- Constructed in [Text Text.html]: $Text$. - --- Constructed in [Phrase Phrase.html]: $Phr$ and - - Utt ; -- sentence, question, word... e.g. "be quiet" - Voc ; -- vocative or "please" e.g. "my darling" - --2 Sentences and clauses -- Constructed in [Sentence Sentence.html], and also in @@ -26,7 +17,6 @@ abstract Cat = Common ** { Cl ; -- declarative clause, with all tenses e.g. "she looks at this" Slash ; -- clause missing NP (S/NP in GPSG) e.g. "she looks at" Imp ; -- imperative e.g. "look at this" - SC ; -- embedded sentence or question e.g. "that it rains" --2 Questions and interrogatives @@ -100,8 +90,6 @@ abstract Cat = Common ** { Conj ; -- conjunction, e.g. "and" DConj ; -- distributed conj. e.g. "both - and" - PConj ; -- phrase-beginning conj. e.g. "therefore" - CAdv ; -- comparative adverb e.g. "more" Subj ; -- subjunction, e.g. "if" Prep ; -- preposition, or just case e.g. "in" diff --git a/lib/resource-1.0/abstract/Common.gf b/lib/resource-1.0/abstract/Common.gf index 003174ef6..aed4fe355 100644 --- a/lib/resource-1.0/abstract/Common.gf +++ b/lib/resource-1.0/abstract/Common.gf @@ -1,6 +1,10 @@ --1 Infrastructure with common implementations. --- This module defines the abstract parameters of tense, polarity, and +-- This module defines the categories that uniformly have the linearization +-- ${s : Str}$ in all languages. They are given lock fields that guarantee +-- grammatical correctness via type checking. + +-- Moreover, this module defines the abstract parameters of tense, polarity, and -- anteriority, which are used in [Phrase Phrase.html] to generate different -- forms of sentences. Together they give 2 x 4 x 4 = 16 sentence forms. @@ -11,9 +15,41 @@ abstract Common = { cat + +--2 Top-level units + +-- Constructed in [Text Text.html]: $Text$. + Text ; -- text consisting of several phrases Phr ; -- phrase in a text e.g. "But come here my darling." +-- Constructed in [Phrase Phrase.html]: $Phr$ and + + Utt ; -- sentence, question, word... e.g. "be quiet" + Voc ; -- vocative or "please" e.g. "my darling" + PConj ; -- phrase-beginning conj. e.g. "therefore" + + SC ; -- embedded sentence or question e.g. "that it rains" + + SC ; + Adv ; + AdV ; + AdA ; + AdS ; + AdN ; + +--2 Adverbs + +-- Constructed in [Adverb Adverb.html]. +-- Many adverbs are constructed in [Structural Structural.html]. + + Adv ; -- verb-phrase-modifying adverb, e.g. "in the house" + AdV ; -- adverb directly attached to verb e.g. "always" + AdA ; -- adjective-modifying adverb, e.g. "very" + AdN ; -- numeral-modifying adverb, e.g. "more than" + IAdv ; -- interrogative adverb e.g. "why" + CAdv ; -- comparative adverb e.g. "more" + Pol ; Tense ; Ant ; diff --git a/lib/resource-1.0/common/CommonX.gf b/lib/resource-1.0/common/CommonX.gf index d37136231..27781459b 100644 --- a/lib/resource-1.0/common/CommonX.gf +++ b/lib/resource-1.0/common/CommonX.gf @@ -2,6 +2,17 @@ concrete CommonX of Common = open (R = ParamX) in { lincat Text, Phr = {s : Str} ; + Utt = {s : Str} ; + Voc = {s : Str} ; + SC = {s : Str} ; + Adv = {s : Str} ; + AdV = {s : Str} ; + AdA = {s : Str} ; + AdS = {s : Str} ; + AdN = {s : Str} ; + IAdv = {s : Str} ; + CAdv = {s : Str} ; + PConj = {s : Str} ; Tense = {s : Str ; t : R.Tense} ; Ant = {s : Str ; a : R.Anteriority} ; diff --git a/lib/resource-1.0/english/CatEng.gf b/lib/resource-1.0/english/CatEng.gf index 370f7c1b7..52e7a0b4e 100644 --- a/lib/resource-1.0/english/CatEng.gf +++ b/lib/resource-1.0/english/CatEng.gf @@ -4,10 +4,6 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Str} ; @@ -24,7 +20,7 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; IP = {s : Case => Str ; n : Number} ; - IAdv, IComp = {s : Str} ; + IComp = {s : Str} ; IDet = {s : Str ; n : Number} ; -- Relative @@ -43,7 +39,6 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { } ; Comp = {s : Agr => Str} ; - SC = {s : Str} ; -- Adjective @@ -57,10 +52,6 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { Predet, QuantSg, QuantPl, Num, Ord = {s : Str} ; Quant = {s : Number => Str} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; @@ -69,8 +60,6 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str} ; Prep = {s : Str} ; diff --git a/lib/resource-1.0/finnish/CatFin.gf b/lib/resource-1.0/finnish/CatFin.gf index ebf04a1f8..b40ebe702 100644 --- a/lib/resource-1.0/finnish/CatFin.gf +++ b/lib/resource-1.0/finnish/CatFin.gf @@ -4,10 +4,6 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Str} ; @@ -24,7 +20,6 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { QCl = {s : Tense => Anteriority => Polarity => Str} ; IP = {s : NPForm => Str ; n : Number} ; - IAdv = {s : Str} ; IComp = {s : Agr => Str} ; IDet = {s : Case => Str ; n : Number} ; @@ -37,7 +32,6 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { VP = ResFin.VP ; Comp = {s : Agr => Str} ; - SC = {s : Str} ; -- Adjective @@ -66,10 +60,6 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { Quant = {s1 : Number => Case => Str ; s2 : Str ; isPoss, isDef : Bool} ; Num = {s : Number => Case => Str ; isNum : Bool} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; @@ -78,8 +68,6 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str} ; Prep = Compl ; diff --git a/lib/resource-1.0/german/CatGer.gf b/lib/resource-1.0/german/CatGer.gf index 659a62185..168192806 100644 --- a/lib/resource-1.0/german/CatGer.gf +++ b/lib/resource-1.0/german/CatGer.gf @@ -4,10 +4,6 @@ concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Order => Str} ; @@ -25,7 +21,6 @@ concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; IP = {s : Case => Str ; n : Number} ; - IAdv = {s : Str} ; IComp = {s : Agr => Str} ; IDet = {s : Gender => Case => Str ; n : Number} ; @@ -38,7 +33,6 @@ concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { VP = ResGer.VP ; Comp = {s : Agr => Str} ; - SC = {s : Str} ; -- Adjective @@ -56,10 +50,6 @@ concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { Num = {s : Str} ; Ord = {s : AForm => Str} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Numeral = {s : CardOrd => Str} ; @@ -68,8 +58,6 @@ concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str} ; Prep = {s : Str ; c : Case} ; diff --git a/lib/resource-1.0/romance/CatRomance.gf b/lib/resource-1.0/romance/CatRomance.gf index 4fb240e2f..32433410e 100644 --- a/lib/resource-1.0/romance/CatRomance.gf +++ b/lib/resource-1.0/romance/CatRomance.gf @@ -5,10 +5,6 @@ incomplete concrete CatRomance of Cat = lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Mood => Str} ; @@ -25,7 +21,6 @@ incomplete concrete CatRomance of Cat = QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; IP = {s : Case => Str ; a : AAgr} ; - IAdv = {s : Str} ; IComp = {s : AAgr => Str} ; IDet = {s : Gender => Case => Str ; n : Number} ; @@ -38,7 +33,6 @@ incomplete concrete CatRomance of Cat = VP = CommonRomance.VP ; Comp = {s : Agr => Str} ; - SC = {s : Str} ; -- Adjective @@ -56,10 +50,6 @@ incomplete concrete CatRomance of Cat = Num = {s : Gender => Str ; isNum : Bool} ; Ord = {s : AAgr => Str} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Numeral = {s : CardOrd => Str} ; @@ -68,8 +58,6 @@ incomplete concrete CatRomance of Cat = Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str ; m : Mood} ; Prep = {s : Str ; c : Case} ; diff --git a/lib/resource-1.0/russian/CatRus.gf b/lib/resource-1.0/russian/CatRus.gf index 4c6b8bcbd..f23d8625b 100644 --- a/lib/resource-1.0/russian/CatRus.gf +++ b/lib/resource-1.0/russian/CatRus.gf @@ -6,14 +6,9 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Str} ; - SC = {s : Str} ; QS = {s : QForm => Str} ; RS = {s : GenNum => Case => Animacy => Str} ; @@ -28,7 +23,7 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { QCl = {s :Polarity => ClForm => QForm => Str}; IP = { s : PronForm => Str ; n : Number ; p : Person ; g: PronGen ; anim : Animacy ; pron: Bool} ; - IAdv, IComp = {s : Str} ; + IComp = {s : Str} ; IDet = Adjective ** {n: Number; g: PronGen; c: Case} ; -- Relative @@ -65,10 +60,6 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { QuantSg, QuantPl , Det = {s : AdjForm => Str; n: Number; g: PronGen; c: Case} ; Predet, Quant= {s : AdjForm => Str; g: PronGen; c: Case} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Num, Numeral = {s : Case => Gender => Str} ; @@ -80,8 +71,6 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str} ; Prep = {s : Str ; c: Case } ; diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf index e395bc7f7..2608d60a7 100644 --- a/lib/resource-1.0/scandinavian/CatScand.gf +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -5,10 +5,6 @@ incomplete concrete CatScand of Cat = lincat --- Phrase - - Utt, Voc = {s : Str} ; - -- Tensed/Untensed S = {s : Order => Str} ; @@ -25,7 +21,6 @@ incomplete concrete CatScand of Cat = QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; IP = {s : NPForm => Str ; gn : GenNum} ; - IAdv = {s : Str} ; IComp = {s : AFormPos => Str} ; IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ; @@ -48,7 +43,6 @@ incomplete concrete CatScand of Cat = en2,ea2,eext : Bool -- indicate if the field exists } ; Comp = {s : AFormPos => Str} ; - SC = {s : Str} ; -- always Sub -- Adjective @@ -72,10 +66,6 @@ incomplete concrete CatScand of Cat = Num = {s : Gender => Str ; isDet : Bool} ; Ord = {s : Str ; isDet : Bool} ; --- Adverb - - Adv, AdV, AdA, AdS, AdN = {s : Str} ; - -- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; @@ -84,8 +74,6 @@ incomplete concrete CatScand of Cat = Conj = {s : Str ; n : Number} ; DConj = {s1,s2 : Str ; n : Number} ; - PConj = {s : Str} ; - CAdv = {s : Str} ; Subj = {s : Str} ; Prep = {s : Str} ; diff --git a/src/GF/Grammar/Lookup.hs b/src/GF/Grammar/Lookup.hs index a80217cd6..eaa44c1c9 100644 --- a/src/GF/Grammar/Lookup.hs +++ b/src/GF/Grammar/Lookup.hs @@ -45,9 +45,9 @@ lookupResDef gr m c = look True m c where ResOper _ Nope -> return (Q m c) ---- if isTop then lookExt m c ---- else prtBad "cannot find in exts" c - CncCat (Yes ty) _ _ -> lockRecType c $ ty - CncCat _ _ _ -> lockRecType c $ defLinType - CncFun _ (Yes tr) _ -> unlockRecord c tr + CncCat (Yes ty) _ _ -> return ty ---- lockRecType c $ ty + CncCat _ _ _ -> return defLinType ---- lockRecType c $ defLinType + CncFun _ (Yes tr) _ -> return tr ---- unlockRecord c tr AnyInd _ n -> look False n c ResParam _ -> return $ QC m c @@ -70,7 +70,7 @@ lookupResType gr m c = do -- used in reused concrete CncCat _ _ _ -> return typeType CncFun (Just (cat,(cont,val))) _ _ -> do - val' <- lockRecType cat val + val' <- return val ---- lockRecType cat val return $ mkProd (cont, val', []) CncFun _ _ _ -> do a <- abstractOfConcrete gr m