restored Makfile and synopsis in 1.4

This commit is contained in:
aarne
2008-06-20 14:01:53 +00:00
parent 6f60b26413
commit 8e5989362d
14 changed files with 8644 additions and 98 deletions

25
lib/resource-1.4/Makefile Normal file
View File

@@ -0,0 +1,25 @@
RUNGHC=runghc
RUNMAKE=$(RUNGHC) Make.hs
all: link present alltenses math
present:
$(RUNMAKE) present lang
$(RUNMAKE) present api
alltenses:
$(RUNMAKE) lang
$(RUNMAKE) api
test:
$(RUNMAKE) test
synopsis:
cd doc ; $(RUNGHC) MkSynopsis ; cd ..
link:
chmod a+x mkPresent
clean:
$(RUNMAKE) clean

View File

@@ -49,11 +49,11 @@ fun
-- Numerals as sequences of digits have a separate, simpler grammar
cat
Dig ;
Dig ; -- single digit 0..9
fun
IDig : Dig -> Digits ;
IIDig : Dig -> Digits -> Digits ;
IDig : Dig -> Digits ; -- 8
IIDig : Dig -> Digits -> Digits ; -- 876
D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ;

View File

@@ -12,7 +12,7 @@ abstract Structural = Cat ** {
-- This is an alphabetical list of structural words
above_Prep : Prep ;
above_Prep : Prep ;
after_Prep : Prep ;
all_Predet : Predet ;
almost_AdA : AdA ;
@@ -24,18 +24,18 @@ abstract Structural = Cat ** {
before_Prep : Prep ;
behind_Prep : Prep ;
between_Prep : Prep ;
both7and_DConj : Conj ;
both7and_DConj : Conj ; -- both...and
---b both7and_DConj : DConj ;
but_PConj : PConj ;
by8agent_Prep : Prep ;
by8means_Prep : Prep ;
by8agent_Prep : Prep ; -- by (agent)
by8means_Prep : Prep ; -- by (means of)
can8know_VV : VV ;
can_VV : VV ;
during_Prep : Prep ;
either7or_DConj : Conj ;
either7or_DConj : Conj ; -- either...or
---b either7or_DConj : DConj ;
every_Det : Det ;
everybody_NP : NP ;
everybody_NP : NP ; -- everybody
everything_NP : NP ;
everywhere_Adv : Adv ;
--- first_Ord : Ord ; DEPRECATED
@@ -44,13 +44,13 @@ abstract Structural = Cat ** {
from_Prep : Prep ;
he_Pron : Pron ;
here_Adv : Adv ;
here7to_Adv : Adv ;
here7from_Adv : Adv ;
here7to_Adv : Adv ; -- to here
here7from_Adv : Adv ; -- from here
how_IAdv : IAdv ;
how8many_IDet : IDet ;
i_Pron : Pron ;
if_Subj : Subj ;
in8front_Prep : Prep ;
in8front_Prep : Prep ; -- in front of
in_Prep : Prep ;
it_Pron : Pron ;
less_CAdv : CAdv ;
@@ -68,7 +68,7 @@ abstract Structural = Cat ** {
otherwise_PConj : PConj ;
part_Prep : Prep ;
please_Voc : Voc ;
possess_Prep : Prep ;
possess_Prep : Prep ; -- of (possessive)
quite_Adv : AdA ;
she_Pron : Pron ;
so_AdA : AdA ;
@@ -79,8 +79,8 @@ abstract Structural = Cat ** {
somewhere_Adv : Adv ;
that_Quant : Quant ;
there_Adv : Adv ;
there7to_Adv : Adv ;
there7from_Adv : Adv ;
there7to_Adv : Adv ; -- to there
there7from_Adv : Adv ; -- from there
therefore_PConj : PConj ;
they_Pron : Pron ;
this_Quant : Quant ;
@@ -91,21 +91,21 @@ abstract Structural = Cat ** {
very_AdA : AdA ;
want_VV : VV ;
we_Pron : Pron ;
whatPl_IP : IP ;
whatSg_IP : IP ;
whatPl_IP : IP ; -- what (plural)
whatSg_IP : IP ; -- what (singular)
when_IAdv : IAdv ;
when_Subj : Subj ;
where_IAdv : IAdv ;
which_IQuant : IQuant ;
whoPl_IP : IP ;
whoSg_IP : IP ;
whoPl_IP : IP ; -- who (plural)
whoSg_IP : IP ; -- who (singular)
why_IAdv : IAdv ;
with_Prep : Prep ;
without_Prep : Prep ;
---b yes_Phr : Phr ;
yes_Utt : Utt ;
youSg_Pron : Pron ;
youPl_Pron : Pron ;
youPol_Pron : Pron ;
youSg_Pron : Pron ; -- you (singular)
youPl_Pron : Pron ; -- you (plural)
youPol_Pron : Pron ; -- you (polite)
}

View File

@@ -238,41 +238,44 @@ incomplete resource Constructors = open Grammar in {
mkCl : NP -> VQ -> QS -> Cl ; -- 6. John wonders if it is good
mkCl : NP -> VA -> AP -> Cl ; -- 7. John becomes old
mkCl : NP -> V2A -> NP -> AP -> Cl ; -- 8. John paints it red
mkCl : NP -> A -> Cl ; -- 9. John is old
mkCl : NP -> A -> NP -> Cl ; -- 10. John is older than her
mkCl : NP -> A2 -> NP -> Cl ; -- 11. John is married to her
mkCl : NP -> AP -> Cl ; -- 12. John is very old
mkCl : NP -> N -> Cl ; -- 13. John is a man
mkCl : NP -> CN -> Cl ; -- 14. John is an old man
mkCl : NP -> NP -> Cl ; -- 15. John is the man
mkCl : NP -> Adv -> Cl ; -- 16. John is here
mkCl : NP -> V2S -> NP -> S -> Cl ; -- 9. John tells her that we are here
mkCl : NP -> V2Q -> NP -> QS -> Cl ; -- 10. John asks her who is here
mkCl : NP -> V2V -> NP -> VP -> Cl ; -- 11. John forces us to sleep
mkCl : NP -> A -> Cl ; -- 12. John is old
mkCl : NP -> A -> NP -> Cl ; -- 13. John is older than her
mkCl : NP -> A2 -> NP -> Cl ; -- 14. John is married to her
mkCl : NP -> AP -> Cl ; -- 15. John is very old
mkCl : NP -> N -> Cl ; -- 16. John is a man
mkCl : NP -> CN -> Cl ; -- 17. John is an old man
mkCl : NP -> NP -> Cl ; -- 18. John is the man
mkCl : NP -> Adv -> Cl ; -- 19. John is here
-- As the general rule, a clause can be built from a subject noun phrase and
-- a verb phrase.
mkCl : NP -> VP -> Cl ; -- 17. John walks here
mkCl : NP -> VP -> Cl ; -- 20. John walks here
-- Subjectless verb phrases are used for impersonal actions.
mkCl : V -> Cl ; -- 18. it rains
mkCl : VP -> Cl ; -- 19. it is raining
mkCl : V -> Cl ; -- 21. it rains
mkCl : VP -> Cl ; -- 22. it is raining
-- Existentials are a special form of clauses.
mkCl : N -> Cl ; -- 20. there is a house
mkCl : CN -> Cl ; -- 21. there is an old houses
mkCl : NP -> Cl ; -- 22. there are five houses
mkCl : N -> Cl ; -- 23. there is a house
mkCl : CN -> Cl ; -- 24. there is an old houses
mkCl : NP -> Cl ; -- 25. there are five houses
-- There are also special forms in which a noun phrase or an adverb is
-- emphasized.
mkCl : NP -> RS -> Cl ; -- 23. it is John that walks
mkCl : Adv -> S -> Cl -- 24. it is here John walks
mkCl : NP -> RS -> Cl ; -- 26. it is John that walks
mkCl : Adv -> S -> Cl -- 27. it is here John walks
} ;
-- Generic clauses are one with an impersonal subject.
genericCl : VP -> Cl ; -- 25. one walks
genericCl : VP -> Cl ; -- 28. one walks
--2 Verb phrases and imperatives
@@ -306,7 +309,13 @@ incomplete resource Constructors = open Grammar in {
-- A verb phrase can be modified with a postverbal or a preverbal adverb.
mkVP : VP -> Adv -> VP ; -- 17. sleep here
mkVP : AdV -> VP -> VP -- 18. always sleep
mkVP : AdV -> VP -> VP ; -- 18. always sleep
-- Objectless verb phrases can be taken to verb phrases in two ways.
mkVP : VPSlash -> NP -> VP ; -- 19. paint it black
mkVP : VPSlash -> VP ; -- 20. paint itself black
} ;
-- Two-place verbs can be used reflexively.
@@ -346,12 +355,12 @@ incomplete resource Constructors = open Grammar in {
-- special case of a simple common noun ($N$) is always provided.
mkNP : overload {
mkNP : Det -> N -> NP ; -- 1. the first man
mkNP : Det -> CN -> NP ; -- 2. the first old man
mkNP : Quant -> N -> NP ; -- 3. this man
mkNP : Quant -> CN -> NP ; -- 4. this old man
mkNP : Quant -> Num -> N -> NP ; -- 5. these men
mkNP : Quant -> Num -> CN -> NP ; -- 6. these old men
mkNP : Art -> NP ; -- 1. the man
mkNP : Art -> (Num) -> CN -> NP ; -- 2. the five old men
mkNP : Quant -> N -> NP ; -- 3. this men
mkNP : Quant -> (Num) -> CN -> NP; -- 4. these five old men
mkNP : Det -> N -> NP ; -- 5. the first man
mkNP : Det -> CN -> NP ; -- 6. the first old man
mkNP : Numeral -> N -> NP ; -- 7. twenty men
mkNP : Numeral -> CN -> NP ; -- 8. twenty old men
mkNP : Digits -> N -> NP ; -- 9. 45 men
@@ -366,18 +375,28 @@ incomplete resource Constructors = open Grammar in {
mkNP : PN -> NP ; -- 15. John
mkNP : Pron -> NP ; -- 16. he
-- Determiners alone can form noun phrases (this excludes articles, $Art$)
mkNP : Quant -> NP ; -- 17. this
mkNP : Det -> NP ; -- 18. these five
-- Determinesless mass noun phrases.
mkNP : N -> NP ; -- 19. beer
mkNP : CN -> NP ; -- 20. beer
-- A noun phrase once formed can be prefixed by a predeterminer and
-- suffixed by a past participle or an adverb.
mkNP : Predet -> NP -> NP ; -- 17. only John
mkNP : NP -> V2 -> NP ; -- 18. John killed
mkNP : NP -> Adv -> NP ; -- 19. John in Paris
mkNP : Predet -> NP -> NP ; -- 21. only John
mkNP : NP -> V2 -> NP ; -- 22. John killed
mkNP : NP -> Adv -> NP ; -- 23. John in Paris
-- A conjunction can be formed both from two noun phrases and a longer
-- list of them.
mkNP : Conj -> NP -> NP -> NP ; -- 20. John and I
mkNP : Conj -> ListNP -> NP ; -- 21. John, I, and that
mkNP : Conj -> NP -> NP -> NP ; -- 22. John and I
mkNP : Conj -> ListNP -> NP ; -- 23. John, I, and that
} ;
@@ -410,51 +429,12 @@ incomplete resource Constructors = open Grammar in {
mkDet : Pron -> Num -> Det -- 11. my (houses)
} ;
--3 Art, articles
{-
-- The definite and indefinite articles are commonly used determiners.
-- There are definite and indefinite articles.
defSgDet : Det ; -- 11. the (house)
defPlDet : Det ; -- 12. the (houses)
indefSgDet : Det ; -- 13. a (house)
indefPlDet : Det ; -- 14. (houses)
--3 QuantSg, singular quantifiers
-- From quantifiers that can have both forms, this constructor
-- builds the singular form.
mkQuantSg : Quant -> QuantSg ; -- 1. this
-- The mass noun phrase constructor is treated as a singular quantifier.
massQuant : QuantSg ; -- 2. (mass terms)
-- More singular quantifiers are available in the $Structural$ module.
-- The following singular cases of quantifiers are often used.
the_QuantSg : QuantSg ; -- 3. the
a_QuantSg : QuantSg ; -- 4. a
this_QuantSg : QuantSg ; -- 5. this
that_QuantSg : QuantSg ; -- 6. that
--3 QuantPl, plural quantifiers
-- From quantifiers that can have both forms, this constructor
-- builds the plural form.
mkQuantPl : Quant -> QuantPl ; -- 1. these
-- More plural quantifiers are available in the $Structural$ module.
-- The following plural cases of quantifiers are often used.
the_QuantPl : QuantPl ; -- 2. the
a_QuantPl : QuantPl ; -- 3. (indefinite plural)
these_QuantPl : QuantPl ; -- 4. these
those_QuantPl : QuantPl ; -- 5. those
-}
the_Art : Art ; -- the
a_Art : Art ; -- a
--3 Num, cardinal numerals
@@ -470,6 +450,10 @@ incomplete resource Constructors = open Grammar in {
mkNum : AdN -> Num -> Num -- 3. almost ten
} ;
-- Dummy numbers are sometimes to select the grammatical number of a determiner.
sgNum : Num ; -- singular
plNum : Num ; -- plural
--3 Ord, ordinal numerals
@@ -512,6 +496,11 @@ incomplete resource Constructors = open Grammar in {
-- See $Numeral$ for the full set of constructors, and use the category
-- $Digits$ for other numbers from one million.
mkDigits : overload {
mkDigits : Dig -> Digits ; -- 1. 8
mkDigits : Dig -> Digits -> Digits ; -- 2. 876
} ;
n1_Digits : Digits ; -- 1. 1
n2_Digits : Digits ; -- 2. 2
n3_Digits : Digits ; -- 3. 3
@@ -526,8 +515,20 @@ incomplete resource Constructors = open Grammar in {
n100_Digits : Digits ; -- 12. 100
n1000_Digits : Digits ; -- 13. 1,000
--3 Dig, single digits
n0_Dig : Dig ; -- 0. 0
n1_Dig : Dig ; -- 1. 1
n2_Dig : Dig ; -- 2. 2
n3_Dig : Dig ; -- 3. 3
n4_Dig : Dig ; -- 4. 4
n5_Dig : Dig ; -- 5. 5
n6_Dig : Dig ; -- 6. 6
n7_Dig : Dig ; -- 7. 7
n8_Dig : Dig ; -- 8. 8
n9_Dig : Dig ; -- 9. 9
--2 Nouns
--3 CN, common noun phrases
@@ -779,7 +780,7 @@ incomplete resource Constructors = open Grammar in {
mkRP : Prep -> NP -> RP -> RP ; -- 2. all the houses in which
--3 Slash, objectless sentences
--3 ClSlash, objectless sentences
mkClSlash : overload {
@@ -803,6 +804,22 @@ incomplete resource Constructors = open Grammar in {
} ;
--3 VPSlash, verb phrases missing an object
mkVPSlash : overload {
-- This is the deep level of many-argument predication, permitting extraction.
mkVPSlash : V2 -> VPSlash ; -- 1. (whom) (John) loves
mkVPSlash : V3 -> NP -> VPSlash ; -- 2. (whom) (John) gives an apple
mkVPSlash : V2A -> AP -> VPSlash ; -- 3. (whom) (John) paints red
mkVPSlash : V2Q -> QS -> VPSlash ; -- 4. (whom) (John) asks who sleeps
mkVPSlash : V2S -> S -> VPSlash ; -- 5. (whom) (John) tells that we sleep
mkVPSlash : V2V -> VP -> VPSlash ; -- 6. (whom) (John) forces to sleep
} ;
--2 Lists for coordination
-- The rules in this section are very uniform: a list can be built from two or more
@@ -948,10 +965,10 @@ incomplete resource Constructors = open Grammar in {
mkNP = overload {
mkNP : Art -> CN -> NP -- the old man --n14
= DetArtSg ;
mkNP : Art -> N -> NP -- the man --n14
= \d,n -> DetArtSg d (UseN n) ;
mkNP : Art -> CN -> NP -- the old man --n14
= DetArtSg ;
mkNP : Art -> Num -> CN -> NP -- the old men --n14
= \d,nu,cn -> case nu.n of {
Sg => DetArtSg d cn ;
@@ -986,6 +1003,8 @@ incomplete resource Constructors = open Grammar in {
= DetCN ;
mkNP : Det -> N -> NP -- the man
= \d,n -> DetCN d (UseN n) ;
mkNP : Quant -> NP -- this
= \q -> DetNP (DetQuant q sgNum) ;
mkNP : Det -> NP -- this
= DetNP ;
mkNP : Card -> CN -> NP -- forty-five old men
@@ -1076,6 +1095,8 @@ incomplete resource Constructors = open Grammar in {
} ;
the_Art : Art = DefArt ; -- the
a_Art : Art = IndefArt ; -- a
-- 1.4
-- defSgDet : Det = DetSg (SgQuant DefArt) NoOrd ; -- the (man)
@@ -1164,6 +1185,23 @@ incomplete resource Constructors = open Grammar in {
mkAdN : CAdv -> AdN = AdnCAdv ; -- more (than five)
mkDigits = overload {
mkDigits : Dig -> Digits = IDig ;
mkDigits : Dig -> Digits -> Digits = IIDig ;
} ;
n0_Dig = D_0 ;
n1_Dig = D_1 ;
n2_Dig = D_2 ;
n3_Dig = D_3 ;
n4_Dig = D_4 ;
n5_Dig = D_5 ;
n6_Dig = D_6 ;
n7_Dig = D_7 ;
n8_Dig = D_8 ;
n9_Dig = D_9 ;
mkCN = overload {
@@ -1522,11 +1560,33 @@ incomplete resource Constructors = open Grammar in {
mkVP : VP -> Adv -> VP -- sleep here
= AdvVP ;
mkVP : AdV -> VP -> VP -- always sleep
= AdVVP
= AdVVP ;
mkVP : VPSlash -> NP -> VP -- always sleep
= ComplSlash ;
mkVP : VPSlash -> VP
= ReflVP
} ;
reflexiveVP : V2 -> VP = \v -> ReflVP (SlashV2a v) ;
mkVPSlash = overload {
mkVPSlash : V2 -> VPSlash -- 1. (whom) (John) loves
= SlashV2a ;
mkVPSlash : V3 -> NP -> VPSlash -- 2. (whom) (John) gives an apple
= Slash2V3 ;
mkVPSlash : V2A -> AP -> VPSlash -- 3. (whom) (John) paints red
= SlashV2A ;
mkVPSlash : V2Q -> QS -> VPSlash -- 4. (whom) (John) asks who sleeps
= SlashV2Q ;
mkVPSlash : V2S -> S -> VPSlash -- 5. (whom) (John) tells that we sleep
= SlashV2S ;
mkVPSlash : V2V -> VP -> VPSlash -- 6. (whom) (John) forces to sleep
= SlashV2V ;
} ;
passiveVP = overload {
passiveVP : V2 -> VP = PassV2 ;
passiveVP : V2 -> NP -> VP = \v,np ->
@@ -1573,5 +1633,49 @@ incomplete resource Constructors = open Grammar in {
ComplV3 : V3 -> NP -> NP -> VP = \v,o,d -> ComplSlash (Slash2V3 v o) d ;
{-
-- The definite and indefinite articles are commonly used determiners.
defSgDet : Det ; -- 11. the (house)
defPlDet : Det ; -- 12. the (houses)
indefSgDet : Det ; -- 13. a (house)
indefPlDet : Det ; -- 14. (houses)
--3 QuantSg, singular quantifiers
-- From quantifiers that can have both forms, this constructor
-- builds the singular form.
mkQuantSg : Quant -> QuantSg ; -- 1. this
-- The mass noun phrase constructor is treated as a singular quantifier.
massQuant : QuantSg ; -- 2. (mass terms)
-- More singular quantifiers are available in the $Structural$ module.
-- The following singular cases of quantifiers are often used.
the_QuantSg : QuantSg ; -- 3. the
a_QuantSg : QuantSg ; -- 4. a
this_QuantSg : QuantSg ; -- 5. this
that_QuantSg : QuantSg ; -- 6. that
--3 QuantPl, plural quantifiers
-- From quantifiers that can have both forms, this constructor
-- builds the plural form.
mkQuantPl : Quant -> QuantPl ; -- 1. these
-- More plural quantifiers are available in the $Structural$ module.
-- The following plural cases of quantifiers are often used.
the_QuantPl : QuantPl ; -- 2. the
a_QuantPl : QuantPl ; -- 3. (indefinite plural)
these_QuantPl : QuantPl ; -- 4. these
those_QuantPl : QuantPl ; -- 5. those
-}
}

View File

@@ -0,0 +1,240 @@
import System
import Char
import List
type Cats = [(String,String,String)]
type Rules = [(String,String,String)]
main = do
xx <- getArgs
let isLatex = case xx of
"-tex":_ -> True
_ -> False
cs1 <- getCats commonAPI
cs2 <- getCats catAPI
let cs = sortCats (cs1 ++ cs2)
writeFile synopsis "GF Resource Grammar Library: Synopsis"
append "B. Bringert and A. Ranta"
space
append "%!postproc(html): '(SRC=\"categories.png\")' '\\1 USEMAP=\"#categories\"'"
append "%!postproc(html): '#LParadigms' '<a name=\"RParadigms\"></a>'"
append "%!postproc(tex): '#LParadigms' ''"
delimit $ addToolTips cs
include "synopsis-intro.txt"
title "Categories"
space
link "Source 1:" commonAPI
space
link "Source 2:" catAPI
space
append "==A hierarchic view==\n"
include "categories-intro.txt"
append "==Explanations==\n"
delimit $ mkCatTable isLatex cs
space
title "Syntax Rules and Structural Words"
space
link "Source 1:" syntaxAPI
space
link "Source 2:" structuralAPI
space
rs <- getRules syntaxAPI
rs2 <- getRules structuralAPI
delimit $ mkSplitTables True isLatex cs $ rs ++ rs2
space
-- title "Structural Words"
-- space
-- link "Source:" structuralAPI
-- space
-- rs <- rulesTable False isLatex cs structuralAPI
-- delimit rs
space
title "Lexical Paradigms"
mapM_ (putParadigms isLatex cs) paradigmFiles
space
include "synopsis-browse.txt"
space
title "An Example of Usage"
space
include "synopsis-example.txt"
space
let format = if isLatex then "tex" else "html"
system $ "txt2tags -t" ++ format ++ " --toc " ++ synopsis
if isLatex then (system $ "pdflatex synopsis.tex") >> return () else return ()
addToolTips :: Cats -> [String]
addToolTips = map f
where f (n,e,_) = "%!postproc(html): '(?i)(HREF=\"#" ++ n ++ "\")( TITLE=\"[^\"]*\")?' '\\1 TITLE=\"" ++ e' ++ "\"'"
where e' = n ++ if null e then "" else " - " ++ e
getCats :: FilePath -> IO Cats
getCats file = do
ss <- readFile file >>= return . lines
return $ getrs [] ss
where
getrs rs ss = case ss of
('-':'-':'.':_):_ -> reverse rs
[] -> reverse rs
('-':'-':_):ss2 -> getrs rs ss2
s:ss2 -> case words s of
cat:";":"--":exp -> getrs ((cat,unwords expl, unwords (tail ex)):rs) ss2 where
(expl,ex) = span (/="e.g.") exp
_ -> getrs rs ss2
rulesTable :: Bool -> Bool -> Cats -> FilePath -> IO [String]
rulesTable hasEx isLatex cs file = do
rs <- getRules file
return $ mkTable hasEx isLatex cs rs
getRules :: FilePath -> IO Rules
getRules file = do
ss <- readFile file >>= return . lines
return $ getrs [] ss
where
getrs rs ss = case ss of
('-':'-':'.':_):_ -> reverse rs
[] -> reverse rs
('-':'-':_):ss2 -> getrs rs ss2
s:ss2 -> case words s of
_:_:"overload":_ -> getrs rs ss2
_:":":_ -> getrs (rule s:rs) ss2
_ -> getrs rs ss2
rule s = (name, typ, ex)
where
ws = words s
name = head ws
(t,e) = span (/="--") (tail ws)
typ = unwords $ filtype (drop 1 t)
filtype = filter (/=";")
ex = if null e then "" else unwords $ unnumber $ drop 1 e
unnumber e = case e of
n:ws | last n == '.' && not (null (init n)) && all isDigit (init n) -> ws
_ -> e
putParadigms :: Bool -> Cats -> (String, FilePath) -> IO ()
putParadigms isLatex cs (lang,file) = do
stitle ("Paradigms for " ++ lang)
append "#LParadigms"
space
link "source" file
space
rs <- rulesTable False isLatex cs file
space
delimit rs
space
inChunks :: Int -> ([a] -> [String]) -> [a] -> [String]
inChunks i f = concat . intersperse ["\n\n"] . map f . chunks i where
chunks _ [] = []
chunks i xs = x : chunks i y where (x,y) = splitAt i xs
-- Makes one table per result category.
-- Adds a subsection header for each table.
mkSplitTables :: Bool -> Bool -> Cats -> Rules -> [String]
mkSplitTables hasEx isLatex cs = concatMap t . addLexicalCats cs . sortRules
where t (c, xs) = [subtitle c expl] ++ tableOrLink
where
expl = case [e | (n,e,_) <- cs, n == c] of
[] -> ""
e:_ -> e
tableOrLink = if null xs then parad else mkTable hasEx isLatex cs xs
parad = [
"Lexical category, constructors given in",
"[lexical paradigms #RParadigms]."
]
mkTable :: Bool -> Bool -> Cats -> Rules -> [String]
mkTable hasEx isLatex cs = inChunks chsize (\rs -> header : map (unwords . row) rs)
where
chsize = if isLatex then 40 else 1000
header = if hasEx then "|| Function | Type | Example ||"
else "|| Function | Type ||"
row (name,typ,ex)
= if hasEx then ["|", name', "|", typ', "|", ex', "|"]
else ["|", name', "|", typ', "|"]
where
name' = ttf name
typ' = showTyp cs typ
ex' = if null ex then itf (takeWhile (/='_') name) else itf ex
mkCatTable :: Bool -> Cats -> [String]
mkCatTable isLatex cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
where
header = ["|| Category | Explanation | Example ||"]
chsize = if isLatex then 40 else 1000
mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"]
typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex
synopsis = "synopsis.txt"
commonAPI = "../abstract/Common.gf"
catAPI = "../abstract/Cat.gf"
syntaxAPI = "../api/Constructors.gf"
structuralAPI = "../abstract/Structural.gf"
paradigmFiles = [
("Bulgarian", "../bulgarian/ParadigmsBul.gf"),
("Danish", "../danish/ParadigmsDan.gf"),
("English", "../english/ParadigmsEng.gf"),
("Finnish", "../finnish/ParadigmsFin.gf"),
("French", "../french/ParadigmsFre.gf"),
("German", "../german/ParadigmsGer.gf"),
-- ("Interlingua", "../interlingua/ParadigmsIna.gf"),
("Italian", "../italian/ParadigmsIta.gf"),
("Norwegian", "../norwegian/ParadigmsNor.gf"),
("Russian", "../russian/ParadigmsRus.gf"),
("Spanish", "../spanish/ParadigmsSpa.gf"),
("Swedish", "../swedish/ParadigmsSwe.gf")
]
append s = appendFile synopsis ('\n':s)
title s = append $ "=" ++ s ++ "="
stitle s = append $ "==" ++ s ++ "=="
include s = append $ "%!include: " ++ s
space = append "\n"
delimit ss = mapM_ append ss
link s f = append $ s ++ " [``" ++ fa ++ "`` " ++ f ++ "]" where
fa = "http://www.cs.chalmers.se/~aarne/GF/lib/resource" ++ dropWhile (=='.') f
ttf s = "``" ++ s ++ "``"
itf s = "//" ++ s ++ "//"
-----------------
-- sort category synopsis by category, retain one table
sortCats :: Cats -> Cats
sortCats = sortBy compareCat
where compareCat (n1,_,_) (n2,_,_) = compare n1 n2
-- sort function synopsis by category, into separate tables
sortRules :: Rules -> [Rules]
sortRules = groupBy sameCat . sortBy compareRules
where sameCat r1 r2 = resultCat r1 == resultCat r2
compareRules r1@(n1,_,_) r2@(n2,_,_)
= compare (resultCat r1,n1) (resultCat r2,n2)
addLexicalCats :: Cats -> [Rules] -> [(String,Rules)]
addLexicalCats cs rss =
map head $ groupBy fstEq $ sortBy (\x y -> compare (fst x) (fst y)) $
[ (resultCat r, rs) | rs@(r:_) <- rss] ++ [(n,[]) | (n,_,_) <- cs]
where fstEq p1 p2 = fst p1 == fst p2
resultCat :: (String,String,String) -> String
resultCat (_,t,_) = last (words t)
subtitle cat expl = "==" ++ cat ++ e ++ "==" ++ "[" ++ cat ++ "]"
where e = if null expl then "" else " - " ++ expl
showCat :: Cats -> String -> String
showCat cs cat = "[" ++ cat ++ " #" ++ cat ++ "]"
showTyp :: Cats -> String -> String
showTyp cs = unwords . map f . words
where f s | head s == '(' && last s == ')' && isCat c
= "(" ++ showCat cs c ++ ")"
| isCat s = showCat cs s
| otherwise = ttf s
where c = init (tail s)
isCat cat = cat `notElem` ["Str","Int"]
&& all (\c -> isAlphaNum c || c == '\'') cat
&& isUpper (head cat)

View File

@@ -0,0 +1,53 @@
<map id="categories" name="categories">
<area shape="poly" href="#Text" title="Text" alt="" coords="690,23 688,17 685,12 679,8 672,5 664,4 656,5 649,8 643,12 640,17 638,23 640,29 643,34 649,38 656,41 664,42 672,41 679,38 685,34 688,29"/>
<area shape="poly" href="#Punct" title="Punct" alt="" coords="657,95 656,89 652,84 646,80 638,77 629,76 620,77 612,80 606,84 602,89 600,95 602,101 606,106 612,110 620,113 629,114 638,113 646,110 652,106 656,101"/>
<area shape="poly" href="#Phr" title="Phr" alt="" coords="726,95 725,89 721,84 715,80 708,77 700,76 692,77 685,80 679,84 676,89 675,95 676,101 679,106 685,110 692,113 700,114 708,113 715,110 721,106 725,101"/>
<area shape="poly" href="#PConj" title="PConj" alt="" coords="658,167 656,162 652,156 645,152 637,150 628,149 619,150 610,152 604,156 600,162 598,167 600,173 604,179 610,183 619,185 628,186 637,185 645,183 652,179 656,173"/>
<area shape="poly" href="#Utt" title="Utt" alt="" coords="726,167 725,162 721,156 715,152 708,150 700,149 692,150 685,152 679,156 676,162 675,167 676,173 679,179 685,183 692,185 700,186 708,185 715,183 721,179 725,173"/>
<area shape="poly" href="#Voc" title="Voc" alt="" coords="794,167 793,162 789,156 784,152 777,150 769,149 761,150 754,152 748,156 744,162 743,167 744,173 748,179 754,183 761,185 769,186 777,185 784,183 789,179 793,173"/>
<area shape="poly" href="#Imp" title="Imp" alt="" coords="657,240 656,234 652,229 647,225 640,222 632,221 624,222 617,225 611,229 607,234 606,240 607,246 611,251 617,255 624,258 632,259 640,258 647,255 652,251 656,246"/>
<area shape="poly" href="#S" title="S" alt="" coords="726,240 725,234 721,229 715,225 708,223 700,222 692,223 685,225 679,229 676,234 675,240 676,245 679,250 685,254 692,257 700,258 708,257 715,254 721,250 725,245"/>
<area shape="poly" href="#QS" title="QS" alt="" coords="870,240 868,234 865,229 859,225 852,222 844,221 836,222 829,225 823,229 819,234 818,240 819,246 823,251 829,255 836,258 844,259 852,258 859,255 865,251 868,246"/>
<area shape="poly" href="#Tense" title="Tense" alt="" coords="521,312 519,306 515,301 509,297 501,294 492,293 483,294 475,297 469,301 464,306 463,312 464,318 469,323 475,327 483,330 492,331 501,330 509,327 515,323 519,318"/>
<area shape="poly" href="#Ant" title="Ant" alt="" coords="589,312 588,306 584,301 578,297 571,294 563,293 555,294 548,297 542,301 539,306 538,312 539,318 542,323 548,327 555,330 563,331 571,330 578,327 584,323 588,318"/>
<area shape="poly" href="#Pol" title="Pol" alt="" coords="657,312 656,306 652,301 647,297 640,294 632,293 624,294 617,297 611,301 607,306 606,312 607,318 611,323 617,327 624,330 632,331 640,330 647,327 652,323 656,318"/>
<area shape="poly" href="#Cl" title="Cl" alt="" coords="726,312 725,306 721,301 715,297 708,294 700,293 692,294 685,297 679,301 676,306 675,312 676,318 679,323 685,327 692,330 700,331 708,330 715,327 721,323 725,318"/>
<area shape="poly" href="#ListS" title="ListS" alt="" coords="798,312 797,306 793,301 787,297 779,294 771,293 762,294 754,297 748,301 745,306 743,312 745,318 748,323 754,327 762,330 771,331 779,330 787,327 793,323 797,318"/>
<area shape="poly" href="#Conj" title="Conj" alt="" coords="867,312 866,306 862,301 856,297 849,294 841,293 833,294 826,297 820,301 816,306 815,312 816,318 820,323 826,327 833,330 841,331 849,330 856,327 862,323 866,318"/>
<area shape="poly" href="#QCl" title="QCl" alt="" coords="945,312 943,306 940,301 934,297 927,294 919,293 911,294 904,297 898,301 895,306 893,312 895,318 898,323 904,327 911,330 919,331 927,330 934,327 940,323 943,318"/>
<area shape="poly" href="#NP" title="NP" alt="" coords="270,384 269,379 265,373 260,369 252,366 244,366 237,366 229,369 224,373 220,379 219,384 220,390 224,395 229,400 237,402 244,403 252,402 260,400 265,395 269,390"/>
<area shape="poly" href="#VP" title="VP" alt="" coords="636,384 634,379 631,373 625,369 618,366 610,366 602,366 595,369 589,373 585,379 584,384 585,390 589,395 595,400 602,402 610,403 618,402 625,400 631,395 634,390"/>
<area shape="rect" href="#Adv" title="Adv" alt="" coords="702,367,753,401"/>
<area shape="poly" href="#Predet" title="Predet" alt="" coords="65,457 63,451 59,446 52,441 44,439 34,438 25,439 16,441 10,446 5,451 4,457 5,462 10,468 16,472 25,475 34,475 44,475 52,472 59,468 63,462"/>
<area shape="poly" href="#Pron" title="Pron" alt="" coords="133,457 132,451 129,446 123,441 116,439 108,438 99,439 92,441 86,446 83,451 82,457 83,462 86,468 92,472 99,475 108,475 116,475 123,472 129,468 132,462"/>
<area shape="rect" href="#PN" title="PN" alt="" coords="150,440,202,474"/>
<area shape="poly" href="#Det" title="Det" alt="" coords="270,457 269,451 265,446 260,441 252,439 244,438 237,439 229,441 224,446 220,451 219,457 220,462 224,468 229,472 237,475 244,475 252,475 260,472 265,468 269,462"/>
<area shape="poly" href="#CN" title="CN" alt="" coords="339,457 337,451 334,446 328,441 321,439 313,438 305,439 298,441 292,446 289,451 287,457 289,462 292,468 298,472 305,475 313,475 321,475 328,472 334,468 337,462"/>
<area shape="poly" href="#ListNP" title="ListNP" alt="" coords="420,457 419,451 414,446 407,441 398,439 388,438 378,439 369,441 362,446 358,451 356,457 358,462 362,468 369,472 378,475 388,475 398,475 407,472 414,468 419,462"/>
<area shape="poly" href="#AdV" title="AdV" alt="" coords="489,457 488,451 484,446 479,441 471,439 463,438 455,439 448,441 442,446 439,451 437,457 439,462 442,468 448,472 455,475 463,475 471,475 479,472 484,468 488,462"/>
<area shape="rect" href="#V" title="V,V2,V3,V*,V2*" alt="" coords="506,440,616,474"/>
<area shape="poly" href="#AP" title="AP" alt="" coords="685,457 684,451 680,446 674,441 667,439 659,438 651,439 644,441 639,446 635,451 634,457 635,462 639,468 644,472 651,475 659,475 667,475 674,472 680,468 684,462"/>
<area shape="poly" href="#Subj" title="Subj" alt="" coords="753,457 752,451 749,446 743,441 736,439 728,438 720,439 713,441 707,446 703,451 702,457 703,462 707,468 713,472 720,475 728,475 736,475 743,472 749,468 752,462"/>
<area shape="poly" href="#ListAdj" title="ListAdj" alt="" coords="837,457 836,451 831,446 824,441 814,439 804,438 794,439 784,441 777,446 772,451 770,457 772,462 777,468 784,472 794,475 804,475 814,475 824,472 831,468 836,462"/>
<area shape="poly" href="#Art" title="Art" alt="" coords="90,529 89,523 85,518 80,514 73,511 65,510 57,511 50,514 44,518 40,523 39,529 40,535 44,540 50,544 57,547 65,548 73,547 80,544 85,540 89,535"/>
<area shape="poly" href="#Quant" title="Quant" alt="" coords="166,529 165,523 161,518 154,514 146,511 137,510 128,511 120,514 113,518 109,523 108,529 109,535 113,540 120,544 128,547 137,548 146,547 154,544 161,540 165,535"/>
<area shape="poly" href="#Num" title="Num" alt="" coords="237,529 235,523 232,518 226,514 218,511 210,510 202,511 195,514 189,518 185,523 184,529 185,535 189,540 195,544 202,547 210,548 218,547 226,544 232,540 235,535"/>
<area shape="poly" href="#Ord" title="Ord" alt="" coords="305,529 304,523 300,518 295,514 288,511 280,510 272,511 265,514 259,518 255,523 254,529 255,535 259,540 265,544 272,547 280,548 288,547 295,544 300,540 304,535"/>
<area shape="rect" href="#N" title="N,N2,N3" alt="" coords="323,512,387,546"/>
<area shape="poly" href="#RS" title="RS" alt="" coords="456,529 454,523 451,518 445,514 438,511 430,510 422,511 415,514 409,518 406,523 404,529 406,535 409,540 415,544 422,547 430,548 438,547 445,544 451,540 454,535"/>
<area shape="poly" href="#Card" title="Card" alt="" coords="236,601 235,595 231,590 226,586 218,583 210,582 202,583 195,586 189,590 186,595 184,601 186,607 189,612 195,616 202,619 210,620 218,619 226,616 231,612 235,607"/>
<area shape="poly" href="#Numeral" title="Numeral,Digits" alt="" coords="216,674 214,668 206,662 194,658 179,656 162,655 145,656 130,658 118,662 110,668 107,674 110,679 118,685 130,689 145,691 162,692 179,691 194,689 206,685 214,679"/>
<area shape="poly" href="#AdN" title="AdN" alt="" coords="285,674 283,668 280,662 274,658 267,656 259,655 251,656 244,658 238,662 234,668 233,674 234,679 238,685 244,689 251,691 259,692 267,691 274,689 280,685 283,679"/>
<area shape="poly" href="#CAdv" title="CAdv" alt="" coords="288,746 286,740 282,735 276,731 268,728 259,727 250,728 242,731 235,735 231,740 230,746 231,752 235,757 242,761 250,764 259,765 268,764 276,761 282,757 286,752"/>
<area shape="poly" href="#RCl" title="RCl" alt="" coords="456,601 454,595 451,590 445,586 438,583 430,582 422,583 415,586 409,590 406,595 404,601 406,607 409,612 415,616 422,619 430,620 438,619 445,616 451,612 454,607"/>
<area shape="poly" href="#AdA" title="AdA" alt="" coords="617,529 615,523 612,518 606,514 599,511 591,510 583,511 576,514 570,518 566,523 565,529 566,535 570,540 576,544 583,547 591,548 599,547 606,544 612,540 615,535"/>
<area shape="rect" href="#A" title="A, A2" alt="" coords="634,512,685,546"/>
<area shape="poly" href="#ListAP" title="ListAP" alt="" coords="767,529 765,523 760,518 753,514 744,511 734,510 725,511 716,514 708,518 704,523 702,529 704,535 708,540 716,544 725,547 734,548 744,547 753,544 760,540 765,535"/>
<area shape="poly" href="#IP" title="IP" alt="" coords="895,384 894,379 890,373 885,369 877,366 870,366 862,366 854,369 849,373 845,379 844,384 845,390 849,395 854,400 862,402 870,403 877,402 885,400 890,395 894,390"/>
<area shape="poly" href="#IAdv" title="IAdv" alt="" coords="966,384 965,379 961,373 955,369 947,366 939,366 931,366 923,369 917,373 913,379 912,384 913,390 917,395 923,400 931,402 939,403 947,402 955,400 961,395 965,390"/>
<area shape="poly" href="#ClSlash" title="ClSlash" alt="" coords="1050,384 1048,379 1043,373 1036,369 1026,366 1016,366 1006,366 996,369 989,373 984,379 982,384 984,390 989,395 996,400 1006,402 1016,403 1026,402 1036,400 1043,395 1048,390"/>
<area shape="poly" href="#IDet" title="IDet" alt="" coords="906,457 904,451 901,446 895,441 888,439 880,438 872,439 865,441 859,446 856,451 854,457 856,462 859,468 865,472 872,475 880,475 888,475 895,472 901,468 904,462"/>
<area shape="poly" href="#VPSlash" title="VPSlash" alt="" coords="1052,457 1050,451 1045,446 1037,441 1027,439 1016,438 1005,439 995,441 987,446 982,451 980,457 982,462 987,468 995,472 1005,475 1016,475 1027,475 1037,472 1045,468 1050,462"/>
<area shape="poly" href="#IQuant" title="IQuant" alt="" coords="912,529 910,523 906,518 899,514 890,511 880,510 870,511 861,514 854,518 850,523 848,529 850,535 854,540 861,544 870,547 880,548 890,547 899,544 906,540 910,535"/>
<area shape="poly" href="#RP" title="RP" alt="" coords="456,674 454,668 451,662 445,658 438,656 430,655 422,656 415,658 409,662 406,668 404,674 406,679 409,685 415,689 422,691 430,692 438,691 445,689 451,685 454,679"/>
</map>

View File

@@ -0,0 +1,19 @@
The chart below shows the categories in a hierarchical top-down order.
The edges do not define the complete dependency structure; if they did,
the graph would have many many more edges, and also many cycles. The precise
meaning of a directed edge from //C// to //D// is: there is a constructor
of //C// that takes //D// as an argument. What the constructors exactly are,
and what other arguments they take, is described by separate tables for
each category.
| [categories.png] |
%!include(html): ''categories-imagemap.html''
The rectangular boxes mark open lexical categories, which have constructors
also in the ``Paradigms`` modules.

View File

@@ -0,0 +1,149 @@
digraph categories {
size = "11,11" ;
node [href="#\N"];
Text [style = "solid", shape = "ellipse"];
Text -> Punct [style = "solid"];
Text -> Phr [style = "solid"];
Punct [style = "solid", shape = "ellipse"];
Phr [style = "solid", shape = "ellipse"];
Phr -> PConj [style = "solid"];
Phr -> Utt [style = "solid"];
Phr -> Voc [style = "solid"];
PConj [style = "solid", shape = "ellipse"];
Voc [style = "solid", shape = "ellipse"];
Utt [style = "solid", shape = "ellipse"];
Utt -> Imp [style = "solid"];
Utt -> S [style = "solid"];
Utt -> QS [style = "solid"];
Imp [style = "solid", shape = "ellipse"];
S [style = "solid", shape = "ellipse"];
S -> Tense [style = "solid"];
S -> Ant [style = "solid"];
S -> Pol [style = "solid"];
S -> Cl [style = "solid"];
S -> ListS [style = "solid"];
S -> Conjs [style = "solid"];
Conjs [label = "Conj", href="#Conj", style = "solid", shape = "ellipse"];
Tense [style = "solid", shape = "ellipse"];
Ant [style = "solid", shape = "ellipse"];
Pol [style = "solid", shape = "ellipse"];
Cl [style = "solid", shape = "ellipse"];
Cl -> NP [style = "solid"];
Cl -> VP [style = "solid"];
Cl -> Adv [style = "solid"];
Adv [style = "solid", shape = "rectangle"];
Adv -> Subj [style = "solid"];
Adv -> ListAdj [style = "solid"];
NP [style = "solid", shape = "ellipse"];
NP -> Predet [style = "solid"];
NP -> Pron [style = "solid"];
NP -> PN [style = "solid"];
NP -> Det [style = "solid"];
NP -> CN [style = "solid"];
NP -> ListNP [style = "solid"];
Predet [style = "solid", shape = "ellipse"];
Pron [style = "solid", shape = "ellipse"];
PN [style = "solid", shape = "rectangle"];
Det [style = "solid", shape = "ellipse"];
Det -> Art [style = "solid"];
Det -> Quant [style = "solid"];
Det -> Num [style = "solid"];
Det -> Ord [style = "solid"];
Art [label = "Art", style = "solid", shape = "ellipse"];
Quant [label = "Quant", style = "solid", shape = "ellipse"];
Num [style = "solid", shape = "ellipse"];
Num -> Card [style = "solid"];
Card [style = "solid", shape = "ellipse"];
Card -> Numerals [style = "solid"];
Card -> AdN [style = "solid"];
AdN [style = "solid", shape = "ellipse"];
AdN -> CAdv [style = "solid"];
Numerals [label = "Numeral,Digits", href="#Numeral", style = "solid", shape = "ellipse"];
Ord [style = "solid", shape = "ellipse"];
CN [style = "solid", shape = "ellipse"];
CN -> Ns [style = "solid"];
CN -> RS [style = "solid"];
Ns [label = "N,N2,N3", href="#N", style = "solid", shape = "rectangle"];
VP [style = "solid", shape = "ellipse"];
VP -> AdV [style = "solid"];
VP -> Vs [style = "solid"];
VP -> AP [style = "solid"];
AdV [style = "solid", shape = "ellipse"];
Vs [label = "V,V2,V3,V*,V2*", href="#V", style = "solid", shape = "rectangle"];
AP [style = "solid", shape = "ellipse"];
AP -> AdA [style = "solid"];
AP -> As [style = "solid"];
AP -> ListAP [style = "solid"];
As [label = "A, A2", href="#A", style = "solid", shape = "rectangle"];
QS [style = "solid", shape = "ellipse"];
QS -> QCl [style = "solid"];
QCl [style = "solid", shape = "ellipse"];
QCl -> IP [style = "solid"];
QCl -> IAdv [style = "solid"];
QCl -> ClSlash [style = "solid"];
IP [style = "solid", shape = "ellipse"];
IP -> IDet [style = "solid"];
IDet [style = "solid", shape = "ellipse"];
IDet -> IQuant [style = "solid"];
IQuant [style = "solid", shape = "ellipse"];
IAdv [style = "solid", shape = "ellipse"];
ClSlash [style = "solid", shape = "ellipse"];
ClSlash -> VPSlash [style = "solid"];
VPSlash [style = "solid", shape = "ellipse"];
RS [style = "solid", shape = "ellipse"];
RS -> RCl [style = "solid"];
RCl [style = "solid", shape = "ellipse"];
RCl -> RP [style = "solid"];
RP [style = "solid", shape = "ellipse"];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View File

@@ -0,0 +1,34 @@
=Browsing the libraries with GF commands=
**New**: Browsing by syntax editor
[directly on the web ../../../demos/resource-api/editor.html].
All of the following assume
```
cd $GF_LIB_PATH
```
To try out inflection paradigms:
```
> i -path=alltenses -retain alltenses/ParadigmsGer.gfo
> cc mkN "Farbe"
```
To try out overloaded syntax, test lexicon, and inflection paradigms:
```
> i -path=alltenses -retain alltenses/TryGer.gfo
> cc mkCl (mkNP this_Quant (mkN "Farbe")) (mkA "dunkel")
```
% To look for a syntax tree in the overload API by parsing:
% ```
% > i -path=alltenses alltenses/OverLangEng.gf
% > p -cat=S -overload "this grammar is too big"
% ```
% To view linearizations in all languages by parsing from English:
% ```
% > i alltenses/langs.gfcm
% > p -cat=S -lang=LangEng "this grammar is too big" | tb
% ```

View File

@@ -0,0 +1,51 @@
The standard way of building an application has the following modules.
An abstract syntax:
```
abstract Music = {
cat
Kind,
Property ;
fun
PropKind : Kind -> Property -> Kind ;
Song : Kind ;
American : Property ;
}
```
A domain lexicon interface:
```
interface LexMusic = open Cat in {
oper
song_N : N ;
american_A : A ;
}
```
A functor on ``Syntax`` and the domain lexicon interface:
```
incomplete concrete MusicI of Music = open Syntax, MusicLex in {
lincat
Kind = CN ;
Property = AP ;
lin
PropKind k p = mkCN p k ;
Song = mkCN song_N ;
American = mkAP american_A ;
}
```
For each language, an instance of the domain lexicon:
```
instance LexMusicGer of LexMusic = CatGer ** open ParadigmsGer in {
oper
song_N = mkN "Lied" "Lieder" neuter ;
american_A = mkA "amerikanisch" ;
}
```
For each language, an instantiation of the functor:
```
--# -path=.:present:prelude
concrete MusicGer of Music = MusicI with
(Syntax = SyntaxGer),
(LexMusic = LexMusicGer) ;
```

View File

@@ -0,0 +1,26 @@
=Introduction=
This document contains the most important parts of the GF Resource Grammar API.
It has been machine-generated from the source files; each chapter gives a link
to the relevant source files, which give more information. Some of the files have
not yet been prepared so that the machine generated documentation has the right
format.
Since the character encoding is UTF-8 for Russian and Latin-1 for other
languages, you
may have to change the encoding preference of your browser when reading different
parts of the document.
The second-last chapter gives instructions on how to "browse" the library by
loading the grammars into the ``gf`` command editor.
**New**: Browsing by syntax editor
[directly on the web ../../../demos/resource-api/editor.html].
The last chapter contains a brief example of how application grammars can
import resource modules. At the same time, it illustrates a "design pattern" for
using the resource API to build functor-based applications

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff