*** empty log message ***

This commit is contained in:
peb
2004-06-02 11:17:15 +00:00
parent 78f88812b8
commit ea15514395
7 changed files with 72 additions and 26 deletions

View File

@@ -407,8 +407,8 @@ begindocument =
"\\setlength{\\parskip}{2mm}" ++++
"\\setlength{\\parindent}{0mm}" ++++
"\\setlength{\\oddsidemargin}{0mm}" ++++
"\\setlength{\\evensidemargin}{-2mm}" ++++
"\\setlength{\\topmargin}{-8mm}" ++++
("\\setlength{\\evensidemargin}{"++"-2mm}") ++++ -- peb 27/5-04: to prevent hugs-mode
("\\setlength{\\topmargin}{"++"-8mm}") ++++ -- from treating the rest as comments
"\\setlength{\\textheight}{240mm}" ++++
"\\setlength{\\textwidth}{158mm}" ++++
"\\begin{document}\n"
@@ -416,6 +416,7 @@ begindocument =
enddocument =
"\n\\end{document}\n"
sortByLongest :: [[a]] -> [[a]]
sortByLongest = sortBy longer where
longer x y
@@ -426,11 +427,14 @@ sortByLongest = sortBy longer where
x' = length x
y' = length y
-- "combinations" is the same as "sequence"!!!
-- peb 30/5-04
combinations :: [[a]] -> [[a]]
combinations t = case t of
[] -> [[]]
aa:uu -> [a:u | a <- aa, u <- combinations uu]
mkTextFile :: String -> IO ()
mkTextFile name = do
s <- readFile name

View File

@@ -37,12 +37,15 @@ import GrammarToHaskell
-- the cf parsing algorithms
import ChartParser -- or some other CF Parser
import NewChartParser
import NewerChartParser
import qualified ParseCFviaCFG as PCF
--import qualified ParseGFCviaCFG as PGFC
--import NewChartParser
--import NewerChartParser
-- grammar conversions -- peb 19/4-04
-- see also customGrammarPrinter
import qualified ConvertGrammar as Cnv
import qualified PrintParser as Prt
import MyParser
@@ -174,9 +177,11 @@ customGrammarPrinter =
-- add your own grammar printers here
-- grammar conversions, (peb)
,(strCI "gfc_show", show . grammar2canon . stateGrammarST)
,(strCI "tnf", prCanon . Cnv.convertCanonToTNF . stateGrammarST)
,(strCI "mcfg", Cnv.prMCFG . Cnv.convertCanonToMCFG . stateGrammarST)
,(strCI "mcfg_cf", Cnv.prCFG . Cnv.convertCanonToCFG . stateGrammarST)
-- ,(strCI "tnf", prCanon . Cnv.convertCanonToTNF . stateGrammarST)
,(strCI "emcfg", Prt.prt . Cnv.convertCanonToEMCFG . stateGrammarST)
,(strCI "emcfg_cf", Prt.prt . Cnv.convertCanonViaEMCFGtoCFG . stateGrammarST)
,(strCI "mcfg", Prt.prt . Cnv.convertCanonToMCFG . stateGrammarST)
,(strCI "mcfg_cf", Prt.prt . Cnv.convertCanonToCFG . stateGrammarST)
,(strCI "mcfg_show", show . Cnv.convertCanonToMCFG . stateGrammarST)
--- also include printing via grammar2syntax!
]
@@ -262,11 +267,14 @@ customParser =
,(strCI "myparser", myParser)
-- add your own parsers here
]
-- 31/5-04, peb:
++ [ (strCI ("new"++name), PCF.parse descr . stateCF) |
(descr, names) <- PCF.alternatives, name <- names ]
-- 21/5-04, peb:
++ [ (strCI ("new"++name), newChartParser descr . stateCF) |
(descr, names) <- newChartParserAlternatives, name <- names ]
++ [ (strCI ("newer"++name), newerChartParser descr . stateParserInfo) |
(descr, names) <- newerChartParserAlternatives, name <- names ]
-- ++ [ (strCI ("new"++name), newChartParser descr . stateCF) |
-- (descr, names) <- newChartParserAlternatives, name <- names ]
-- ++ [ (strCI ("newer"++name), newerChartParser descr . stateParserInfo) |
-- (descr, names) <- newerChartParserAlternatives, name <- names ]
++ moreCustomParser
customTokenizer =

View File

@@ -20,7 +20,7 @@ import Option
import Custom
import ShellState
import qualified ExportParser as N
import qualified ParseGFCviaCFG as N
import Operations
@@ -43,9 +43,9 @@ parseStringC opts0 sg cat s
---- to test peb's new parser 6/10/2003
| oElem newParser opts0 = do
let pm = maybe "" id $ getOptVal opts0 useParser -- -parser=pm
gr = grammar sg
gr = stateGrammarST sg
ct = cfCat2Cat cat
ts <- checkErr $ N.newParser pm gr (cfCat2Cat cat) s
ts <- checkErr $ N.newParser pm sg ct s -- peb 27/5-04 (changed gr -> sg)
mapM (checkErr . (annotate gr)) ts
| otherwise = do
@@ -58,11 +58,13 @@ parseStringC opts0 sg cat s
tokens2trms opts sg cn parser (tok s)
tokens2trms :: Options ->StateGrammar ->Ident -> CFParser -> [CFTok] -> Check [Tree]
tokens2trms opts sg cn parser as = do
let res@(trees,info) = parser as
ts0 <- return $ cfParseResults res -- removed nub, peb 25/5-04
-- ts0 <- return $ nub (cfParseResults res) -- nub gives quadratic behaviour!
-- SortedList.nubsort is O(n log n)
tokens2trms opts sg cn parser toks = trees2trms opts sg cn toks trees info
where result = parser toks
info = snd result
trees = {- nub $ -} cfParseResults result -- peb 25/5-04: removed nub (O(n^2))
trees2trms :: Options -> StateGrammar -> Ident -> [CFTok] -> [CFTree] -> String -> Check [Tree]
trees2trms opts sg cn as ts0 info = do
ts <- case () of
_ | null ts0 -> checkWarn "No success in cf parsing" >> return []
_ | raw -> do