From 53fe26a2a483bf8091572a761fd272107ad0cdfe Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 29 Mar 2005 12:26:34 +0000 Subject: [PATCH] removed deprecated stuff; changed parser default --- src/GF/CF/ChartParser.hs | 8 +- src/GF/UseGrammar/Custom.hs | 30 ++---- src/GF/UseGrammar/MoreCustom.hs | 44 -------- src/GF/UseGrammar/RealMoreCustom.hs | 159 ---------------------------- src/Makefile | 8 +- 5 files changed, 12 insertions(+), 237 deletions(-) delete mode 100644 src/GF/UseGrammar/MoreCustom.hs delete mode 100644 src/GF/UseGrammar/RealMoreCustom.hs diff --git a/src/GF/CF/ChartParser.hs b/src/GF/CF/ChartParser.hs index d7ee48a53..f17cfdf69 100644 --- a/src/GF/CF/ChartParser.hs +++ b/src/GF/CF/ChartParser.hs @@ -5,15 +5,15 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/03/29 11:17:56 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.7 $ +-- > CVS $Date: 2005/03/29 13:26:34 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.8 $ -- -- Bottom-up Kilbury chart parser from "Pure Functional Parsing", chapter 5. -- OBSOLETE -- should use new MCFG parsers instead ----------------------------------------------------------------------------- -module ChartParser {-# DEPRECATED "Use ParseCF instead" #-} +module ChartParser {- # DEPRECATED "Use ParseCF instead" #-} (chartParser) where -- import Tracing diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs index 4bd5cc435..9b77123ce 100644 --- a/src/GF/UseGrammar/Custom.hs +++ b/src/GF/UseGrammar/Custom.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/03/29 11:17:56 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.48 $ +-- > CVS $Date: 2005/03/29 13:26:37 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.49 $ -- -- A database for customizable GF shell commands. -- @@ -85,8 +85,6 @@ import VisualizeGrammar (visualizeCanonGrammar, visualizeSourceGrammar) import MyParser -import MoreCustom -- either small/ or big/. The one in Small is empty. - import UseIO import Monad @@ -220,7 +218,6 @@ customGrammarParser = ------ (strCI "gf", compileModule noOptions) -- DEFAULT -- add your own grammar parsers here ] - ++ moreCustomGrammarParser customGrammarPrinter = @@ -263,7 +260,6 @@ customGrammarPrinter = ,(strCI "finite", prCanon . Fin.convertGrammar . stateGrammarST) --- also include printing via grammar2syntax! ] - ++ moreCustomGrammarPrinter customMultiGrammarPrinter = customData "Printers for multiple grammars, selected by option -printer=x" $ @@ -273,7 +269,6 @@ customMultiGrammarPrinter = ,(strCI "cfgm", prCanonAsCFGM) ,(strCI "graph", visualizeCanonGrammar) ] - ++ moreCustomMultiGrammarPrinter customSyntaxPrinter = @@ -281,7 +276,6 @@ customSyntaxPrinter = [ -- add your own grammar printers here ] - ++ moreCustomSyntaxPrinter customTermPrinter = @@ -290,7 +284,6 @@ customTermPrinter = (strCI "gf", const prt) -- DEFAULT -- add your own term printers here ] - ++ moreCustomTermPrinter customTermCommand = customData "Term transformers, selected by option -transform=x" $ @@ -320,7 +313,6 @@ customTermCommand = --- ,(strCI "delete", \g t -> [MM.mExp0]) -- add your own term commands here ] - ++ moreCustomTermCommand customEditCommand = customData "Editor state transformers, selected by option -edit=x" $ @@ -335,7 +327,6 @@ customEditCommand = ,(strCI "transfer", const return) --- done ad hoc on top level -- add your own edit commands here ] - ++ moreCustomEditCommand customStringCommand = customData "String filters, selected by option -filter=x" $ @@ -349,24 +340,18 @@ customStringCommand = ,(strCI "length", const $ show . length) -- add your own string commands here ] - ++ moreCustomStringCommand customParser = customData "Parsers, selected by option -parser=x" $ [ - (strCI "chart", chartParser . stateCF) + (strCI "chart", PCF.parse "ibn" . stateCF) + ,(strCI "old", chartParser . stateCF) ,(strCI "myparser", myParser) -- add your own parsers here ] -- 31/5-04, peb: - ++ [ (strCI ("new"++name), PCF.parse descr . stateCF) | + ++ [ (strCI ("chart"++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 ] - ++ moreCustomParser customTokenizer = customData "Tokenizers, selected by option -lexer=x" $ @@ -385,7 +370,6 @@ customTokenizer = ,(strCI "codeCHigh", const $ lexC2M' True) -- add your own tokenizers here ] - ++ moreCustomTokenizer customUntokenizer = customData "Untokenizers, selected by option -unlexer=x" $ @@ -402,7 +386,6 @@ customUntokenizer = ,(strCI "bind", const $ performBinds) -- backward compat -- add your own untokenizers here ] - ++ moreCustomUntokenizer customUniCoding = customData "Alphabet codings, selected by option -coding=x" $ @@ -424,4 +407,3 @@ customUniCoding = ,(strCI "extendedarabic", mkExtendedArabic) ,(strCI "extradiacritics", mkExtraDiacritics) ] - ++ moreCustomUniCoding diff --git a/src/GF/UseGrammar/MoreCustom.hs b/src/GF/UseGrammar/MoreCustom.hs deleted file mode 100644 index 27dffcace..000000000 --- a/src/GF/UseGrammar/MoreCustom.hs +++ /dev/null @@ -1,44 +0,0 @@ ----------------------------------------------------------------------- --- | --- Module : MoreCustom --- Maintainer : AR --- Stability : (stable) --- Portability : (portable) --- --- > CVS $Date: 2005/02/24 11:46:39 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.5 $ --- --- (Description of the module) ------------------------------------------------------------------------------ - -module MoreCustom where - --- All these lists are supposed to be empty! --- Items should be added to ../Custom.hs instead. - -moreCustomGrammarParser, - moreCustomGrammarPrinter, - moreCustomMultiGrammarPrinter, - moreCustomSyntaxPrinter, - moreCustomTermPrinter, - moreCustomTermCommand, - moreCustomEditCommand, - moreCustomStringCommand, - moreCustomParser, - moreCustomTokenizer, - moreCustomUntokenizer, - moreCustomUniCoding :: [a] - -moreCustomGrammarParser = [] -moreCustomGrammarPrinter = [] -moreCustomMultiGrammarPrinter = [] -moreCustomSyntaxPrinter = [] -moreCustomTermPrinter = [] -moreCustomTermCommand = [] -moreCustomEditCommand = [] -moreCustomStringCommand = [] -moreCustomParser = [] -moreCustomTokenizer = [] -moreCustomUntokenizer = [] -moreCustomUniCoding = [] diff --git a/src/GF/UseGrammar/RealMoreCustom.hs b/src/GF/UseGrammar/RealMoreCustom.hs deleted file mode 100644 index 86cb2623d..000000000 --- a/src/GF/UseGrammar/RealMoreCustom.hs +++ /dev/null @@ -1,159 +0,0 @@ ----------------------------------------------------------------------- --- | --- Module : MoreCustom --- Maintainer : AR --- Stability : (stable) --- Portability : (portable) --- --- > CVS $Date: 2005/02/24 11:46:39 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.5 $ --- --- databases for customizable commands. AR 21\/11\/2001 --- --- Extends "Custom". --- --- obsolete??? ------------------------------------------------------------------------------ - -module MoreCustom where - -import Operations -import Text -import Tokenize -import UseGrammar -import qualified UseSyntax as S -import ShellState -import Editing -import Paraphrases -import Option -import CF -import CFIdent --- (CFTok, tS) - -import EBNF -import CFtoGrammar -import PPrCF - -import CFtoHappy -import Morphology -import GrammarToHaskell -import GrammarToCanon (showCanon) -import GrammarToXML -import qualified SyntaxToLatex as L -import GFTex -import MkResource -import SeparateOper - --- the cf parsing algorithms -import ChartParser -- or some other CF Parser -import Earley -- such as this one ----- import HappyParser -- or this... - -import qualified PPrSRG as SRG -import PPrGSL - -import qualified TransPredCalc as PC - --- databases for customizable commands. AR 21/11/2001 --- Extends ../Custom. - -moreCustomGrammarParser :: CustomData (FilePath -> IOE C.CanonGrammar) -moreCustomGrammarParser = - [ - (strCIm "gfl", S.parseGrammar . extractGFLatex) - ,(strCIm "tex", S.parseGrammar . extractGFLatex) - ,(strCIm "ebnf", pAsGrammar pEBNFasGrammar) - ,(strCIm "cf", pAsGrammar pCFAsGrammar) --- add your own grammar parsers here - ] - where - -- use a parser with no imports or flags - pAsGrammar p = err Bad (\g -> return (([],noOptions),g)) . p - - -moreCustomGrammarPrinter :: CustomData (StateGrammar -> String) -moreCustomGrammarPrinter = - [ - (strCIm "happy", cf2HappyS . stateCF) - ,(strCIm "srg", SRG.prSRG . stateCF) - ,(strCIm "gsl", prGSL . stateCF) - ,(strCIm "gfhs", show . stateGrammarST) - ,(strCIm "haskell", grammar2haskell . st2grammar . stateGrammarST) - ,(strCIm "xml", unlines . prDTD . grammar2dtd . stateAbstract) - ,(strCIm "fullform",prFullForm . stateMorpho) - ,(strCIm "resource",prt . st2grammar . mkResourceGrammar . stateGrammarST) - ,(strCIm "resourcetypes", - prt . operTypeGrammar . st2grammar . mkResourceGrammar . stateGrammarST) - ,(strCIm "resourcedefs", - prt . operDefGrammar . st2grammar . mkResourceGrammar . stateGrammarST) --- add your own grammar printers here ---- also include printing via grammar2syntax! - ] - -moreCustomMultiGrammarPrinter :: CustomData (CanonGrammar -> String) -moreCustomMultiGrammarPrinter = [] - -moreCustomSyntaxPrinter :: CustomData (GF.Grammar -> String) -moreCustomSyntaxPrinter = - [ - (strCIm "gf", S.prSyntax) -- DEFAULT - ,(strCIm "latex", L.syntax2latexfile) --- add your own grammar printers here - ] - -moreCustomTermPrinter :: CustomData (StateGrammar -> Tree -> String) -moreCustomTermPrinter = - [ - (strCIm "xml", \g t -> unlines $ prElementX $ term2elemx (stateAbstract g) t) --- add your own term printers here - ] - -moreCustomTermCommand :: CustomData (StateGrammar -> Tree -> [Tree]) -moreCustomTermCommand = - [ - (strCIm "predcalc", \_ t -> PC.transfer t) --- add your own term commands here - ] - -moreCustomEditCommand :: CustomData (StateGrammar -> Action) -moreCustomEditCommand = - [ --- add your own edit commands here - ] - -moreCustomStringCommand :: CustomData (StateGrammar -> String -> String) -moreCustomStringCommand = - [ --- add your own string commands here - ] - -moreCustomParser :: CustomData (StateGrammar -> CFCat -> CFParser) -moreCustomParser = - [ - (strCIm "chart", chartParser . stateCF) - ,(strCIm "earley", earleyParser . stateCF) --- ,(strCIm "happy", const $ lexHaskell) --- ,(strCIm "td", const $ lexText) --- add your own parsers here - ] - -moreCustomTokenizer :: CustomData (StateGrammar -> String -> [CFTok]) -moreCustomTokenizer = - [ --- add your own tokenizers here - ] - -moreCustomUntokenizer :: CustomData (StateGrammar -> String -> String) -moreCustomUntokenizer = - [ --- add your own untokenizers here - ] - -moreCustomUniCoding :: CustomData (String -> String) -moreCustomUniCoding = - [ --- add your own codings here - ] - -strCIm :: String -> CommandId -strCIm = id diff --git a/src/Makefile b/src/Makefile index eee2b5505..3ba9d882d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,8 +8,8 @@ GHCOPTFLAGS=-O2 $(GHCFLAGS) GHCFUDFLAG= JAVAFLAGS=-target 1.4 -source 1.4 -HUGSINCLUDE =.:{Hugs}/libraries:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:newparsing:cfgm:speech:visualization: BASICINCLUDE =-iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -inewparsing -iparsers -icfgm -ispeech -ivisualization + GHCINCLUDE =-ifor-ghc $(BASICINCLUDE) GHCINCLUDENOFUD=-ifor-ghc-nofud $(BASICINCLUDE) GHCINCLUDEGFT =-ifor-gft $(BASICINCLUDE) @@ -78,10 +78,8 @@ justwindows: nofud-links: mkdir -p for-ghc-nofud - rm -f for-ghc-nofud/*.hs + rm -f for-ghc-nofud/Arch.hs ln -s ../for-ghc/Arch.hs for-ghc-nofud - ln -s ../for-hugs/ArchEdit.hs for-ghc-nofud - api: $(GHMAKE) $(GHCFLAGS) $(GHCINCLUDE) API.hs @@ -100,8 +98,6 @@ distclean: clean -rm -f *.tgz *.zip -rm -rf $(DIST_DIR) $(BIN_DIST_DIR) -hugs: - hugs -h10M -P$(HUGSINCLUDE) ghci-nofud: $(GHCI) $(GHCFLAGS) $(GHCINCLUDENOFUD) today: