mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 16:42:51 -06:00
a new abstract syntax in Documentation.gf which allows a more compact definition of the corresponding concrete syntax. The new strategy is so far used only in DocumentationEng and the new DocumentationBul.
This commit is contained in:
@@ -15,50 +15,64 @@ in {
|
||||
|
||||
|
||||
lincat
|
||||
Inflection = {s : Str} ;
|
||||
Inflection = {s1,s2 : Str} ;
|
||||
Document = {s : Str} ;
|
||||
|
||||
oper
|
||||
tdf : Str -> Str = \s -> td (intag "i" s) ;
|
||||
heading : N -> Str = \n -> (nounHeading n).s ;
|
||||
lin
|
||||
InflectionN noun = {
|
||||
s = heading1 (heading noun_Category) ++ frameTable (
|
||||
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
|
||||
tr (th (heading nominative_Parameter) ++ tdf (noun.s ! Sg ! Nom) ++ tdf (noun.s ! Pl ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ tdf (noun.s ! Sg ! Gen) ++ tdf (noun.s ! Pl ! Gen))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionA adj = {
|
||||
s = heading1 (heading adjective_Category) ++
|
||||
frameTable (
|
||||
tr (th (heading positive_Parameter) ++ tdf (adj.s ! AAdj Posit Nom)) ++
|
||||
tr (th (heading comparative_Parameter) ++ tdf (adj.s ! AAdj Compar Nom)) ++
|
||||
tr (th (heading superlative_Parameter) ++ tdf (adj.s ! AAdj Superl Nom)) ++
|
||||
tr (th (heading adverb_Category) ++ tdf (adj.s ! AAdv))
|
||||
)
|
||||
s1 = heading1 (heading noun_Category) ;
|
||||
s2 = frameTable (
|
||||
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
|
||||
tr (th (heading nominative_Parameter) ++ tdf (noun.s ! Sg ! Nom) ++ tdf (noun.s ! Pl ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ tdf (noun.s ! Sg ! Gen) ++ tdf (noun.s ! Pl ! Gen))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V v))) v ;
|
||||
InflectionV2 v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2 v) S.something_NP)) (lin V v) ;
|
||||
--- InflectionVV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin VV v) (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
InflectionV2V v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2V v) S.we_NP (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
InflectionA adj = {
|
||||
s1 = heading1 (heading adjective_Category) ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading positive_Parameter) ++ tdf (adj.s ! AAdj Posit Nom)) ++
|
||||
tr (th (heading comparative_Parameter) ++ tdf (adj.s ! AAdj Compar Nom)) ++
|
||||
tr (th (heading superlative_Parameter) ++ tdf (adj.s ! AAdj Superl Nom)) ++
|
||||
tr (th (heading adverb_Category) ++ tdf (adj.s ! AAdv))
|
||||
)
|
||||
} ;
|
||||
|
||||
ExplainInflection e i = ss (i.s ++ paragraph e.s) ; -- explanation appended in a new paragraph
|
||||
InflectionV v = {
|
||||
s1= heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" (verbExample (S.mkCl S.she_NP (lin V v)))) ;
|
||||
s2= inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2 v = {
|
||||
s1= heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" (verbExample (S.mkCl S.she_NP (lin V2 v) S.something_NP))) ;
|
||||
s2= inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2V v = {
|
||||
s1= heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" (verbExample (S.mkCl S.she_NP (lin V2V v) S.we_NP (S.mkVP (L.sleep_V))))) ;
|
||||
s2= inflVerb v
|
||||
} ;
|
||||
|
||||
--- InflectionVV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin VV v) (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
|
||||
MkDocument b i e = ss (i.s1 ++ paragraph b.s ++ i.s2 ++ paragraph e.s) ;
|
||||
|
||||
oper
|
||||
verbExample : CatEng.Cl -> Str = \cl -> (S.mkUtt cl).s ;
|
||||
|
||||
inflectionVerb : Str -> CatEng.V -> {s : Str} = \ex,verb -> {
|
||||
s = heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" ex) ++
|
||||
frameTable (
|
||||
tr (th (heading infinitive_Parameter) ++ tdf (verb.s ! VInf)) ++
|
||||
tr (th (heading present_Parameter) ++ tdf (verb.s ! VPres)) ++
|
||||
tr (th (heading past_Parameter) ++ tdf (verb.s ! VPast)) ++ --# notpresent
|
||||
tr (th (heading past_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPPart)) ++
|
||||
tr (th (heading present_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPresPart))
|
||||
)
|
||||
} ;
|
||||
inflVerb : Verb -> Str = \verb ->
|
||||
frameTable (
|
||||
tr (th (heading infinitive_Parameter) ++ tdf (verb.s ! VInf)) ++
|
||||
tr (th (heading present_Parameter) ++ tdf (verb.s ! VPres)) ++
|
||||
tr (th (heading past_Parameter) ++ tdf (verb.s ! VPast)) ++ --# notpresent
|
||||
tr (th (heading past_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPPart)) ++
|
||||
tr (th (heading present_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPresPart))
|
||||
) ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,43 +72,5 @@ fun CompoundCN : Num -> N -> CN -> CN ;
|
||||
AdAdV : AdA -> AdV -> AdV ;
|
||||
|
||||
UttAdV : AdV -> Utt;
|
||||
|
||||
cat Feat;
|
||||
fun FeatN : N -> Feat;
|
||||
FeatN2 : N2 -> Feat;
|
||||
FeatV : V -> Feat;
|
||||
FeatV2 : V2 -> Feat;
|
||||
FeatV3 : V3 -> Feat;
|
||||
FeatV2V : V2V -> Feat;
|
||||
FeatV2S : V2S -> Feat;
|
||||
FeatV2Q : V2Q -> Feat;
|
||||
FeatV2A : V2A -> Feat;
|
||||
FeatVV : VV -> Feat;
|
||||
FeatVS : VS -> Feat;
|
||||
FeatVQ : VQ -> Feat;
|
||||
FeatVA : VA -> Feat;
|
||||
|
||||
|
||||
-- for displaying inflection tables ---- TODO soon obsolete
|
||||
|
||||
cat
|
||||
NDisplay ; ADisplay ; VDisplay ;
|
||||
fun
|
||||
DisplayN : N -> NDisplay ;
|
||||
DisplayN2 : N2 -> NDisplay ;
|
||||
DisplayN3 : N3 -> NDisplay ;
|
||||
DisplayA : A -> ADisplay ;
|
||||
DisplayA2 : A2 -> ADisplay ;
|
||||
DisplayV : V -> VDisplay ;
|
||||
DisplayV2 : V2 -> VDisplay ;
|
||||
DisplayV3 : V3 -> VDisplay ;
|
||||
DisplayVA : VA -> VDisplay ;
|
||||
DisplayVQ : VQ -> VDisplay ;
|
||||
DisplayVS : VS -> VDisplay ;
|
||||
DisplayVV : VV -> VDisplay ;
|
||||
DisplayV2A : V2A -> VDisplay ;
|
||||
DisplayV2Q : V2Q -> VDisplay ;
|
||||
DisplayV2S : V2S -> VDisplay ;
|
||||
DisplayV2V : V2V -> VDisplay ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user