summaryrefslogtreecommitdiff
path: root/src/GF/Devel/Grammar/Modules.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-12-04 07:48:37 +0000
committeraarne <aarne@cs.chalmers.se>2007-12-04 07:48:37 +0000
commita7b68870508b90ab1a9e635489ff4e687713d166 (patch)
tree59e56e88392ef3df3ee1d1b7ae967c46637ab1bc /src/GF/Devel/Grammar/Modules.hs
parent0e1831abb488346ae6b57b01b9ee99a1a4d9b75f (diff)
moved some modules to Devel.Grammar
Diffstat (limited to 'src/GF/Devel/Grammar/Modules.hs')
-rw-r--r--src/GF/Devel/Grammar/Modules.hs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/GF/Devel/Grammar/Modules.hs b/src/GF/Devel/Grammar/Modules.hs
new file mode 100644
index 000000000..774cc6387
--- /dev/null
+++ b/src/GF/Devel/Grammar/Modules.hs
@@ -0,0 +1,49 @@
+module GF.Devel.Grammar.Modules where
+
+import GF.Devel.Grammar.Judgements
+import GF.Devel.Grammar.Terms
+import GF.Infra.Ident
+
+import GF.Data.Operations
+
+import Control.Monad
+import Data.Map
+
+
+data GF = GF {
+ gfabsname :: Maybe Ident ,
+ gfcncnames :: [Ident] ,
+ gflags :: Map Ident String , -- value of a global flag
+ gfmodules :: Map Ident Module
+ }
+
+emptyGF :: GF
+emptyGF = GF Nothing [] empty empty
+
+data Module = Module {
+ mtype :: ModuleType,
+ minterfaces :: [(Ident,Ident)], -- non-empty for functors
+ minstances :: [((Ident,MInclude),[(Ident,Ident)])], -- non-empty for instant'ions
+ mextends :: [(Ident,MInclude)],
+ mopens :: [(Ident,Ident)], -- used name, original name
+ mflags :: Map Ident String,
+ mjments :: Map Ident (Either Judgement Ident) -- def or indirection
+ }
+
+emptyModule :: Ident -> Module
+emptyModule m = Module MTGrammar [] [] [] [] empty empty
+
+listJudgements :: Module -> [(Ident,Either Judgement Ident)]
+listJudgements = assocs . mjments
+
+data ModuleType =
+ MTAbstract
+ | MTConcrete Ident
+ | MTGrammar
+
+data MInclude =
+ MIAll
+ | MIExcept [Ident]
+ | MIOnly [Ident]
+
+