mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
*** empty log message ***
This commit is contained in:
@@ -21,7 +21,8 @@ import Ident
|
|||||||
import Arch (ModTime)
|
import Arch (ModTime)
|
||||||
|
|
||||||
-- peb 25/5-04
|
-- peb 25/5-04
|
||||||
import CFtoCFG
|
-- import CFtoCFG
|
||||||
|
import qualified ConvertGrammar as Cnv
|
||||||
|
|
||||||
import List (nub,nubBy)
|
import List (nub,nubBy)
|
||||||
|
|
||||||
@@ -36,7 +37,8 @@ data ShellState = ShSt {
|
|||||||
srcModules :: G.SourceGrammar , -- saved resource modules
|
srcModules :: G.SourceGrammar , -- saved resource modules
|
||||||
cfs :: [(Ident,CF)] , -- context-free grammars
|
cfs :: [(Ident,CF)] , -- context-free grammars
|
||||||
-- peb 25/5-04:
|
-- peb 25/5-04:
|
||||||
cfParserInfos :: [(Ident, CFParserInfo)], -- parser information
|
-- cfParserInfos :: [(Ident, CFParserInfo)], -- parser information
|
||||||
|
cfParserInfos :: Cnv.CFParserInfo, -- peb 27/5-04
|
||||||
morphos :: [(Ident,Morpho)], -- morphologies
|
morphos :: [(Ident,Morpho)], -- morphologies
|
||||||
gloptions :: Options, -- global options
|
gloptions :: Options, -- global options
|
||||||
readFiles :: [(FilePath,ModTime)],-- files read
|
readFiles :: [(FilePath,ModTime)],-- files read
|
||||||
@@ -59,7 +61,8 @@ emptyShellState = ShSt {
|
|||||||
canModules = M.emptyMGrammar,
|
canModules = M.emptyMGrammar,
|
||||||
srcModules = M.emptyMGrammar,
|
srcModules = M.emptyMGrammar,
|
||||||
cfs = [],
|
cfs = [],
|
||||||
cfParserInfos = [], -- peb 25/5-04
|
-- cfParserInfos = [], -- peb 25/5-04
|
||||||
|
cfParserInfos = Cnv.emptyParserInfo, -- peb 27/5-04
|
||||||
morphos = [],
|
morphos = [],
|
||||||
gloptions = noOptions,
|
gloptions = noOptions,
|
||||||
readFiles = [],
|
readFiles = [],
|
||||||
@@ -78,7 +81,8 @@ data StateGrammar = StGr {
|
|||||||
cncId :: Ident,
|
cncId :: Ident,
|
||||||
grammar :: CanonGrammar,
|
grammar :: CanonGrammar,
|
||||||
cf :: CF,
|
cf :: CF,
|
||||||
cfParserInfo :: CFParserInfo, -- peb 25/5-04
|
-- cfParserInfo :: CFParserInfo, -- peb 25/5-04
|
||||||
|
cfParserInfo :: Cnv.CFParserInfo, -- peb 27/5-04
|
||||||
morpho :: Morpho,
|
morpho :: Morpho,
|
||||||
loptions :: Options
|
loptions :: Options
|
||||||
}
|
}
|
||||||
@@ -88,7 +92,8 @@ emptyStateGrammar = StGr {
|
|||||||
cncId = identC "#EMPTY", ---
|
cncId = identC "#EMPTY", ---
|
||||||
grammar = M.emptyMGrammar,
|
grammar = M.emptyMGrammar,
|
||||||
cf = emptyCF,
|
cf = emptyCF,
|
||||||
cfParserInfo = emptyParserInfo, -- peb 25/5-04
|
-- cfParserInfo = emptyParserInfo, -- peb 25/5-04
|
||||||
|
cfParserInfo = Cnv.emptyParserInfo, -- peb 27/5-04
|
||||||
morpho = emptyMorpho,
|
morpho = emptyMorpho,
|
||||||
loptions = noOptions
|
loptions = noOptions
|
||||||
}
|
}
|
||||||
@@ -96,6 +101,7 @@ emptyStateGrammar = StGr {
|
|||||||
-- analysing shell grammar into parts
|
-- analysing shell grammar into parts
|
||||||
stateGrammarST = grammar
|
stateGrammarST = grammar
|
||||||
stateCF = cf
|
stateCF = cf
|
||||||
|
--stateParserInfo= cfParserInfo
|
||||||
stateParserInfo= cfParserInfo
|
stateParserInfo= cfParserInfo
|
||||||
stateMorpho = morpho
|
stateMorpho = morpho
|
||||||
stateOptions = loptions
|
stateOptions = loptions
|
||||||
@@ -127,7 +133,8 @@ updateShellState opts sh (gr,(sgr,rts)) = do
|
|||||||
concr0 = ifNull Nothing (return . last) concrs
|
concr0 = ifNull Nothing (return . last) concrs
|
||||||
notInrts f = notElem f $ map fst rts
|
notInrts f = notElem f $ map fst rts
|
||||||
cfs <- mapM (canon2cf opts cgr) concrs --- would not need to update all...
|
cfs <- mapM (canon2cf opts cgr) concrs --- would not need to update all...
|
||||||
let parserInfos = map cf2parserInfo cfs -- peb 25/5-04
|
-- let parserInfos = map cf2parserInfo cfs -- peb 25/5-04
|
||||||
|
let parserInfos = Cnv.convertCanonToCFParserInfo gr -- peb 27/5-04
|
||||||
|
|
||||||
let funs = funRulesOf cgr
|
let funs = funRulesOf cgr
|
||||||
let cats = allCatsOf cgr
|
let cats = allCatsOf cgr
|
||||||
@@ -146,7 +153,8 @@ updateShellState opts sh (gr,(sgr,rts)) = do
|
|||||||
canModules = cgr,
|
canModules = cgr,
|
||||||
srcModules = src,
|
srcModules = src,
|
||||||
cfs = zip concrs cfs,
|
cfs = zip concrs cfs,
|
||||||
cfParserInfos = zip concrs parserInfos, -- peb 25/5-04
|
-- cfParserInfos = zip concrs parserInfos, -- peb 25/5-04
|
||||||
|
cfParserInfos = parserInfos, -- peb 27/5-04
|
||||||
morphos = zip concrs (map (mkMorpho cgr) concrs),
|
morphos = zip concrs (map (mkMorpho cgr) concrs),
|
||||||
gloptions = opts,
|
gloptions = opts,
|
||||||
readFiles = [ft | ft@(f,_) <- readFiles sh, notInrts f] ++ rts,
|
readFiles = [ft | ft@(f,_) <- readFiles sh, notInrts f] ++ rts,
|
||||||
@@ -191,7 +199,8 @@ purgeShellState sh = ShSt {
|
|||||||
canModules = M.MGrammar $ purge $ M.modules $ canModules sh,
|
canModules = M.MGrammar $ purge $ M.modules $ canModules sh,
|
||||||
srcModules = M.emptyMGrammar,
|
srcModules = M.emptyMGrammar,
|
||||||
cfs = cfs sh,
|
cfs = cfs sh,
|
||||||
cfParserInfos = cfParserInfos sh, -- peb 25/5-04
|
-- cfParserInfos = cfParserInfos sh, -- peb 25/5-04
|
||||||
|
cfParserInfos = cfParserInfos sh, -- peb 27/5-04
|
||||||
morphos = morphos sh,
|
morphos = morphos sh,
|
||||||
gloptions = gloptions sh,
|
gloptions = gloptions sh,
|
||||||
readFiles = [],
|
readFiles = [],
|
||||||
@@ -248,7 +257,8 @@ stateGrammarOfLang st l = StGr {
|
|||||||
cncId = l,
|
cncId = l,
|
||||||
grammar = can,
|
grammar = can,
|
||||||
cf = maybe emptyCF id (lookup l (cfs st)),
|
cf = maybe emptyCF id (lookup l (cfs st)),
|
||||||
cfParserInfo = maybe emptyParserInfo id (lookup l (cfParserInfos st)), -- peb 25/5-04
|
-- cfParserInfo = maybe emptyParserInfo id (lookup l (cfParserInfos st)), -- peb 25/5-04
|
||||||
|
cfParserInfo = cfParserInfos st, -- peb 27/5-04
|
||||||
morpho = maybe emptyMorpho id (lookup l (morphos st)),
|
morpho = maybe emptyMorpho id (lookup l (morphos st)),
|
||||||
loptions = errVal noOptions $ lookupOptionsCan can
|
loptions = errVal noOptions $ lookupOptionsCan can
|
||||||
}
|
}
|
||||||
@@ -278,7 +288,8 @@ stateAbstractGrammar st = StGr {
|
|||||||
cncId = identC "#Cnc", ---
|
cncId = identC "#Cnc", ---
|
||||||
grammar = canModules st, ---- only abstarct ones
|
grammar = canModules st, ---- only abstarct ones
|
||||||
cf = emptyCF,
|
cf = emptyCF,
|
||||||
cfParserInfo = emptyParserInfo,
|
-- cfParserInfo = emptyParserInfo, -- peb 25/5-04
|
||||||
|
cfParserInfo = Cnv.emptyParserInfo, -- peb 27/5-04
|
||||||
morpho = emptyMorpho,
|
morpho = emptyMorpho,
|
||||||
loptions = gloptions st ----
|
loptions = gloptions st ----
|
||||||
}
|
}
|
||||||
@@ -401,8 +412,8 @@ languageOn = languageOnOff True
|
|||||||
languageOff = languageOnOff False
|
languageOff = languageOnOff False
|
||||||
|
|
||||||
languageOnOff :: Bool -> Language -> ShellStateOper
|
languageOnOff :: Bool -> Language -> ShellStateOper
|
||||||
languageOnOff b lang (ShSt a c cs cg sg cfs pinfs ms os fs cats sts) =
|
languageOnOff b lang (ShSt a c cs cg sg cfs pinfos ms os fs cats sts) =
|
||||||
ShSt a c cs' cg sg cfs pinfs ms os fs cats sts where
|
ShSt a c cs' cg sg cfs pinfos ms os fs cats sts where
|
||||||
cs' = [if lang==l then ((l,c),b) else i | i@((l,c),_) <- cs]
|
cs' = [if lang==l then ((l,c),b) else i | i@((l,c),_) <- cs]
|
||||||
|
|
||||||
{-
|
{-
|
||||||
@@ -419,12 +430,12 @@ removeLanguage :: Language -> ShellStateOper
|
|||||||
removeLanguage lang (ShSt (ab,gs,os)) = ShSt (ab,removeAssoc lang gs, os)
|
removeLanguage lang (ShSt (ab,gs,os)) = ShSt (ab,removeAssoc lang gs, os)
|
||||||
-}
|
-}
|
||||||
changeOptions :: (Options -> Options) -> ShellStateOper
|
changeOptions :: (Options -> Options) -> ShellStateOper
|
||||||
changeOptions f (ShSt a c cs can src cfs pinfs ms os ff ts ss) =
|
changeOptions f (ShSt a c cs can src cfs pinfos ms os ff ts ss) =
|
||||||
ShSt a c cs can src cfs pinfs ms (f os) ff ts ss
|
ShSt a c cs can src cfs pinfos ms (f os) ff ts ss
|
||||||
|
|
||||||
changeModTimes :: [(FilePath,ModTime)] -> ShellStateOper
|
changeModTimes :: [(FilePath,ModTime)] -> ShellStateOper
|
||||||
changeModTimes mfs (ShSt a c cs can src cfs pinfs ms os ff ts ss) =
|
changeModTimes mfs (ShSt a c cs can src cfs pinfos ms os ff ts ss) =
|
||||||
ShSt a c cs can src cfs pinfs ms os ff' ts ss
|
ShSt a c cs can src cfs pinfos ms os ff' ts ss
|
||||||
where
|
where
|
||||||
ff' = mfs ++ [mf | mf@(f,_) <- ff, notElem f (map fst mfs)]
|
ff' = mfs ++ [mf | mf@(f,_) <- ff, notElem f (map fst mfs)]
|
||||||
|
|
||||||
|
|||||||
14
src/Makefile
14
src/Makefile
@@ -5,8 +5,7 @@ GHCFLAGS=-package lang -package util -fglasgow-exts
|
|||||||
GHCOPTFLAGS=-O -package lang -package util -fglasgow-exts
|
GHCOPTFLAGS=-O -package lang -package util -fglasgow-exts
|
||||||
GHCFUDFLAG=-package Fudgets
|
GHCFUDFLAG=-package Fudgets
|
||||||
|
|
||||||
HUGSTRACE = trace
|
HUGSINCLUDE =.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:parsing:conversions:trace:
|
||||||
HUGSINCLUDE =.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:parsing:conversions:$(HUGSTRACE):
|
|
||||||
BASICINCLUDE =-iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -iparsing -iparsers -iconversions -inotrace
|
BASICINCLUDE =-iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -iparsing -iparsers -iconversions -inotrace
|
||||||
GHCINCLUDE =-ifor-ghc $(BASICINCLUDE)
|
GHCINCLUDE =-ifor-ghc $(BASICINCLUDE)
|
||||||
GHCINCLUDENOFUD=-ifor-ghc-nofud $(BASICINCLUDE)
|
GHCINCLUDENOFUD=-ifor-ghc-nofud $(BASICINCLUDE)
|
||||||
@@ -38,8 +37,6 @@ justwindows:
|
|||||||
$(GHMAKE) $(GHCOPTFLAGS) $(WINDOWSINCLUDE) --make GF.hs -o gf2.exe ; strip gf2.exe ; mv gf2.exe ../bin/
|
$(GHMAKE) $(GHCOPTFLAGS) $(WINDOWSINCLUDE) --make GF.hs -o gf2.exe ; strip gf2.exe ; mv gf2.exe ../bin/
|
||||||
nofud-links:
|
nofud-links:
|
||||||
cd for-ghc-nofud ; rm -f *.hs ; ln -s ../for-ghc/Arch.hs ; ln -s ../for-hugs/ArchEdit.hs ; cd ..
|
cd for-ghc-nofud ; rm -f *.hs ; ln -s ../for-ghc/Arch.hs ; ln -s ../for-hugs/ArchEdit.hs ; cd ..
|
||||||
tracing:
|
|
||||||
make today ; $(GHMAKE) $(GHCFLAGS) -itrace $(GHCINCLUDENOFUD) --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/
|
|
||||||
|
|
||||||
batch:
|
batch:
|
||||||
$(GHMAKE) $(GHCFLAGS) $(GHCINCLUDE) --make GF2.hs -o gf2 ; strip gf2
|
$(GHMAKE) $(GHCFLAGS) $(GHCINCLUDE) --make GF2.hs -o gf2 ; strip gf2
|
||||||
@@ -59,3 +56,12 @@ javac:
|
|||||||
cd java ; javac *.java ; cd ..
|
cd java ; javac *.java ; cd ..
|
||||||
help:
|
help:
|
||||||
cd util ; runhugs MkHelpFile ; mv HelpFile.hs .. ; cd ..
|
cd util ; runhugs MkHelpFile ; mv HelpFile.hs .. ; cd ..
|
||||||
|
|
||||||
|
# added by peb:
|
||||||
|
tracing:
|
||||||
|
$(GHMAKE) $(GHCFLAGS) -itrace $(GHCINCLUDENOFUD) --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/
|
||||||
|
newparser:
|
||||||
|
$(GHMAKE) $(GHCFLAGS) -itrace -ifor-ghc-nofud -iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -inewparsing -iparsers --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/
|
||||||
|
newhugs:
|
||||||
|
hugs -h10M -P.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:newparsing:trace:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user