some more printing

This commit is contained in:
aarne
2004-04-19 15:33:45 +00:00
parent 9b47f67467
commit bd9ba5ce39
9 changed files with 62 additions and 30 deletions

View File

@@ -437,6 +437,7 @@ getHarmony : Str -> Str = \u -> case u of {
"kk" => ku + "k" ; "kk" => ku + "k" ;
"pp" => ku + "p" ; "pp" => ku + "p" ;
"tt" => ku + "t" ; "tt" => ku + "t" ;
"nk" => ku + "ng" ;
"nt" => ku + "nn" ; "nt" => ku + "nn" ;
"mp" => ku + "mm" ; "mp" => ku + "mm" ;
"rt" => ku + "rr" ; "rt" => ku + "rr" ;
@@ -446,7 +447,7 @@ getHarmony : Str -> Str = \u -> case u of {
_ => "" _ => ""
} ; } ;
"rk" => kul + case o of { "rk" => kul + case o of {
"i" => "rj" ; "i" => "j" ;
_ => "" _ => ""
} ; } ;
"hk" => kukk ; -- *tahko-tahon "hk" => kukk ; -- *tahko-tahon

View File

@@ -60,18 +60,28 @@ oper
nKukko : (kukko,kukon,kukkoja : Str) -> Gender -> N ; nKukko : (kukko,kukon,kukkoja : Str) -> Gender -> N ;
-- For convenience, we define 1-argument paradigms as producing the
-- nonhuman gender; the following function changes this:
humanN : N -> N ;
-- A special case are nouns with no alternations: -- A special case are nouns with no alternations:
-- the vowel harmony is inferred from the last letter, -- the vowel harmony is inferred from the last letter,
-- which must be one of "o", "u", "ö", "y". -- which must be one of "o", "u", "ö", "y".
nTalo : (talo : Str) -> Gender -> N ; nTalo : (talo : Str) -> N ;
-- Another special case are nouns where the last two consonants -- Another special case are nouns where the last two consonants
-- undergo regular weak-grade alternation: -- undergo regular weak-grade alternation:
-- "kukko - kukon", "rutto - ruton", "hyppy - hypyn", "sampo - sammon", -- "kukko - kukon", "rutto - ruton", "hyppy - hypyn", "sampo - sammon",
-- "kunto - kunnon", "sisältö - sisällön", . -- "kunto - kunnon", "sisältö - sisällön", .
nLukko : (lukko : Str) -> Gender -> N ; nLukko : (lukko : Str) -> N ;
-- "arpi - arven", "sappi - sapen", "kampi - kammen";"sylki - syljen"
nArpi : (arpi : Str) -> N ;
nSylki : (sylki : Str) -> N ;
-- Foreign words ending in consonants are actually similar to words like -- Foreign words ending in consonants are actually similar to words like
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached -- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
@@ -80,18 +90,18 @@ oper
-- 1-syllabic words ending in "n" would have variant plural genitive and -- 1-syllabic words ending in "n" would have variant plural genitive and
-- partitive forms, like "sultanien"/"sultaneiden", which are not covered.) -- partitive forms, like "sultanien"/"sultaneiden", which are not covered.)
nLinux : (linuxia : Str) -> Gender -> N ; nLinux : (linuxia : Str) -> N ;
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara", -- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara",
-- "rytinä". -- "rytinä".
nPeruna : (peruna : Str) -> Gender -> N ; nPeruna : (peruna : Str) -> N ;
-- The following paradigm covers both nouns ending in an aspirated "e", such as -- The following paradigm covers both nouns ending in an aspirated "e", such as
-- "rae", "perhe", "savuke", and also many ones ending in a consonant -- "rae", "perhe", "savuke", and also many ones ending in a consonant
-- ("rengas", "kätkyt"). The singular nominative and essive are given. -- ("rengas", "kätkyt"). The singular nominative and essive are given.
nRae : (rae, rakeena : Str) -> Gender -> N ; nRae : (rae, rakeena : Str) -> N ;
-- The following covers nouns with partitive "ta"/"tä", such as -- The following covers nouns with partitive "ta"/"tä", such as
-- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes -- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes
@@ -102,28 +112,32 @@ oper
-- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu", -- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu",
-- are inflected according to the following. -- are inflected according to the following.
nPuu : (puu : Str) -> Gender -> N ; nPuu : (puu : Str) -> N ;
-- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by -- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by
-- the following. -- the following.
nSuo : (suo : Str) -> Gender -> N ; nSuo : (suo : Str) -> N ;
-- Many adjectives but also nouns have the nominative ending "nen" which in other -- Many adjectives but also nouns have the nominative ending "nen" which in other
-- cases becomes "s": "nainen", "ihminen", "keltainen". -- cases becomes "s": "nainen", "ihminen", "keltainen".
-- To capture the vowel harmony, we use the partitive form as the argument. -- To capture the vowel harmony, we use the partitive form as the argument.
nNainen : (naista : Str) -> Gender -> N ; nNainen : (naista : Str) -> N ;
-- The following covers some nouns ending with a consonant, e.g. -- The following covers some nouns ending with a consonant, e.g.
-- "tilaus", "kaulin", "paimen", "laidun". -- "tilaus", "kaulin", "paimen", "laidun".
nTilaus : (tilaus,tilauksena : Str) -> Gender -> N ; nTilaus : (tilaus,tilauksena : Str) -> Gender -> N ;
-- Special case:
nKulaus : (kulaus : Str) -> N ;
-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris". -- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris".
-- The partitive form is taken to get the vowel harmony. -- The partitive form is taken to get the vowel harmony.
nNauris : (naurista : Str) -> Gender -> N ; nNauris : (naurista : Str) -> N ;
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen", -- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
-- have only their last part inflected. -- have only their last part inflected.
@@ -231,17 +245,24 @@ oper
mkNoun a b c d e f g h i j ** {g = k ; lock_N = <>} ; mkNoun a b c d e f g h i j ** {g = k ; lock_N = <>} ;
nKukko = \a,b,c,g -> sKukko a b c ** {g = g ; lock_N = <>} ; nKukko = \a,b,c,g -> sKukko a b c ** {g = g ; lock_N = <>} ;
nLukko = \a,g -> sLukko a ** {g = g ; lock_N = <>} ;
nTalo = \a,g -> sTalo a ** {g = g ; lock_N = <>} ; humanN = \n -> {s = n.s ; lock_N = n.lock_N ; g = human} ;
nLinux = \a,g -> sLinux a ** {g = g ; lock_N = <>} ;
nPeruna = \a,g -> sPeruna a ** {g = g ; lock_N = <>} ; nLukko = \a -> sLukko a ** {g = nonhuman ; lock_N = <>} ;
nRae = \a,b,g -> sRae a b ** {g = g ; lock_N = <>} ; nTalo = \a -> sTalo a ** {g = nonhuman ; lock_N = <>} ;
nArpi = \a -> sArpi a ** {g = nonhuman ; lock_N = <>} ;
nSylki = \a -> sSylki a ** {g = nonhuman ; lock_N = <>} ;
nLinux = \a -> sLinux a ** {g = nonhuman ; lock_N = <>} ;
nPeruna = \a -> sPeruna a ** {g = nonhuman ; lock_N = <>} ;
nRae = \a,b -> sRae a b ** {g = nonhuman ; lock_N = <>} ;
nSusi = \a,b,c,g -> sSusi a b c ** {g = g ; lock_N = <>} ; nSusi = \a,b,c,g -> sSusi a b c ** {g = g ; lock_N = <>} ;
nPuu = \a,g -> sPuu a ** {g = g ; lock_N = <>} ; nPuu = \a -> sPuu a ** {g = nonhuman ; lock_N = <>} ;
nSuo = \a,g -> sSuo a ** {g = g ; lock_N = <>} ; nSuo = \a -> sSuo a ** {g = nonhuman ; lock_N = <>} ;
nNainen = \a,g -> sNainen a ** {g = g ; lock_N = <>} ; nNainen = \a -> sNainen a ** {g = nonhuman ; lock_N = <>} ;
nTilaus = \a,b,g -> sTilaus a b ** {g = g ; lock_N = <>} ; nTilaus = \a,b,g -> sTilaus a b ** {g = g ; lock_N = <>} ;
nNauris = \a,g -> sNauris a ** {g = g ; lock_N = <>} ; nKulaus = \a -> nTilaus a (init a + "ksen" + getHarmony (last
(init a))) nonhuman ;
nNauris = \a -> sNauris a ** {g = nonhuman ; lock_N = <>} ;
nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ; nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;

View File

@@ -22,7 +22,7 @@ import CF
import CFIdent import CFIdent
---import UseGrammar ---import UseGrammar
import PPrCF import PPrCF
import List (intersperse) import List (intersperse,nub)
header :: String header :: String
header = unlines ["#ABNF 1.0 ISO-8859-1;\n", header = unlines ["#ABNF 1.0 ISO-8859-1;\n",
@@ -38,7 +38,7 @@ prSRGC :: [CFCat] -> CF -> String
prSRGC [] _ = [] prSRGC [] _ = []
prSRGC (c:cs) cf = "$" ++ prCFCat c ++ " = " ++ items ++ ";\n"++ prSRGC cs cf prSRGC (c:cs) cf = "$" ++ prCFCat c ++ " = " ++ items ++ ";\n"++ prSRGC cs cf
where items = concat $ intersperse " | " $ where items = concat $ intersperse " | " $
map f $ map valItemsCF (rulesForCFCat cf c) map f $ nub $ map valItemsCF (rulesForCFCat cf c)
f [] = "$NULL" f [] = "$NULL"
f xs = unwords $ map prSRGItem xs f xs = unwords $ map prSRGItem xs

View File

@@ -14,7 +14,12 @@ import Operations
import Monad import Monad
-- a decompiler. AR 12/6/2003 -- a decompiler. AR 12/6/2003 -- 19/4/2004
canon2sourceGrammar :: CanonGrammar -> Err G.SourceGrammar
canon2sourceGrammar gr = do
ms' <- mapM canon2sourceModule $ M.modules gr
return $ M.MGrammar ms'
canon2sourceModule :: CanonModule -> Err G.SourceModule canon2sourceModule :: CanonModule -> Err G.SourceModule
canon2sourceModule (i,mi) = do canon2sourceModule (i,mi) = do

View File

@@ -210,9 +210,7 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
| oElem showAll opts -> returnArg (AString txtHelpFile) sa | oElem showAll opts -> returnArg (AString txtHelpFile) sa
| otherwise -> returnArg (AString txtHelpFileSummary) sa | otherwise -> returnArg (AString txtHelpFileSummary) sa
CPrintGrammar CPrintGrammar -> returnArg (AString (optPrintGrammar opts gro)) sa
| oElem showOld opts -> returnArg (AString $ printGrammarOld (canModules st)) sa
| otherwise -> returnArg (AString (optPrintGrammar opts gro)) sa
CPrintGlobalOptions -> justOutput (putStrLn $ prShellStateInfo st) sa CPrintGlobalOptions -> justOutput (putStrLn $ prShellStateInfo st) sa
CPrintInformation c -> justOutput (useIOE () $ showInformation opts st c) sa CPrintInformation c -> justOutput (useIOE () $ showInformation opts st c) sa
CPrintLanguages -> justOutput CPrintLanguages -> justOutput

View File

@@ -19,10 +19,11 @@ import Option
import CF import CF
import CFIdent import CFIdent
---- import CFtoGrammar import CanonToGrammar
import PPrCF import PPrCF
import PrLBNF import PrLBNF
import PrGrammar import PrGrammar
import PrOld
import MkGFC import MkGFC
import CFtoSRG import CFtoSRG
@@ -145,7 +146,9 @@ customGrammarPrinter =
customData "Grammar printers, selected by option -printer=x" $ customData "Grammar printers, selected by option -printer=x" $
[ [
(strCI "gfc", prCanon . stateGrammarST) -- DEFAULT (strCI "gfc", prCanon . stateGrammarST) -- DEFAULT
,(strCI "gf", err id prGrammar . canon2sourceGrammar . stateGrammarST)
,(strCI "cf", prCF . stateCF) ,(strCI "cf", prCF . stateCF)
,(strCI "old", printGrammarOld . stateGrammarST)
,(strCI "srg", prSRG . stateCF) ,(strCI "srg", prSRG . stateCF)
,(strCI "lbnf", prLBNF . stateCF) ,(strCI "lbnf", prLBNF . stateCF)
,(strCI "morpho", prMorpho . stateMorpho) ,(strCI "morpho", prMorpho . stateMorpho)

View File

@@ -347,8 +347,10 @@ q, quit: q
-parser=earley Earley algorithm -parser=earley Earley algorithm
-parser=chart bottom-up chart parser -parser=chart bottom-up chart parser
-printer: format in which the grammar is printed. The default is gf. -printer: format in which the grammar is printed. The default is gfc.
-printer=gfc GFC grammar
-printer=gf GF grammar -printer=gf GF grammar
-printer=old old GF grammar
-printer=cf context-free grammar -printer=cf context-free grammar
*-printer=happy source file for Happy parser generator *-printer=happy source file for Happy parser generator
-printer=srg speech recognition grammar -printer=srg speech recognition grammar

View File

@@ -360,11 +360,13 @@ txtHelpFile =
"\n -parser=earley Earley algorithm" ++ "\n -parser=earley Earley algorithm" ++
"\n -parser=chart bottom-up chart parser" ++ "\n -parser=chart bottom-up chart parser" ++
"\n" ++ "\n" ++
"\n-printer: format in which the grammar is printed. The default is gf." ++ "\n-printer: format in which the grammar is printed. The default is gfc." ++
"\n -printer=gfc GFC grammar" ++
"\n -printer=gf GF grammar" ++ "\n -printer=gf GF grammar" ++
"\n -printer=old old GF grammar" ++
"\n -printer=cf context-free grammar" ++ "\n -printer=cf context-free grammar" ++
"\n *-printer=happy source file for Happy parser generator" ++ "\n *-printer=happy source file for Happy parser generator" ++
"\n *-printer=srg speech recognition grammar" ++ "\n -printer=srg speech recognition grammar" ++
"\n *-printer=haskell abstract syntax in Haskell, with transl to/from GF" ++ "\n *-printer=haskell abstract syntax in Haskell, with transl to/from GF" ++
"\n -printer=morpho full-form lexicon, long format" ++ "\n -printer=morpho full-form lexicon, long format" ++
"\n *-printer=latex LaTeX file (for the tg command)" ++ "\n *-printer=latex LaTeX file (for the tg command)" ++

View File

@@ -1 +1 @@
module Today where today = "Fri Apr 16 18:06:59 CEST 2004" module Today where today = "Mon Apr 19 17:59:02 CEST 2004"