summaryrefslogtreecommitdiff
path: root/src/PGF/Data.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
committerkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
commitf85232947e74ee7ef8c7b0ad2338212e7e68f1be (patch)
tree667b886a5e3a4b026a63d4e3597f32497d824761 /src/PGF/Data.hs
parentd88a865faff59c98fc91556ff8700b10ee5f2df8 (diff)
reorganize the directories under src, and rescue the JavaScript interpreter from deprecated
Diffstat (limited to 'src/PGF/Data.hs')
-rw-r--r--src/PGF/Data.hs95
1 files changed, 0 insertions, 95 deletions
diff --git a/src/PGF/Data.hs b/src/PGF/Data.hs
deleted file mode 100644
index 38027e96e..000000000
--- a/src/PGF/Data.hs
+++ /dev/null
@@ -1,95 +0,0 @@
-module PGF.Data (module PGF.Data, module PGF.Expr, module PGF.Type, module PGF.PMCFG) where
-
-import PGF.CId
-import PGF.Expr hiding (Value, Env, Tree)
-import PGF.Type
-import PGF.PMCFG
-
-import qualified Data.Map as Map
-import qualified Data.Set as Set
-import qualified Data.IntMap as IntMap
-import Data.List
-
--- internal datatypes for PGF
-
--- | An abstract data type representing multilingual grammar
--- in Portable Grammar Format.
-data PGF = PGF {
- absname :: CId ,
- cncnames :: [CId] ,
- gflags :: Map.Map CId String, -- value of a global flag
- abstract :: Abstr ,
- concretes :: Map.Map CId Concr
- }
-
-data Abstr = Abstr {
- aflags :: Map.Map CId String, -- value of a flag
- funs :: Map.Map CId (Type,Int,[Equation]), -- type, arrity and definition of function
- cats :: Map.Map CId [Hypo], -- context of a cat
- catfuns :: Map.Map CId [CId] -- funs to a cat (redundant, for fast lookup)
- }
-
-data Concr = Concr {
- cflags :: Map.Map CId String, -- value of a flag
- lins :: Map.Map CId Term, -- lin of a fun
- opers :: Map.Map CId Term, -- oper generated by subex elim
- lincats :: Map.Map CId Term, -- lin type of a cat
- lindefs :: Map.Map CId Term, -- lin default of a cat
- printnames :: Map.Map CId Term, -- printname of a cat or a fun
- paramlincats :: Map.Map CId Term, -- lin type of cat, with printable param names
- parser :: Maybe ParserInfo -- parser
- }
-
-data Term =
- R [Term]
- | P Term Term
- | S [Term]
- | K Tokn
- | V Int
- | C Int
- | F CId
- | FV [Term]
- | W String Term
- | TM String
- deriving (Eq,Ord,Show)
-
-data Tokn =
- KS String
- | KP [String] [Alternative]
- deriving (Eq,Ord,Show)
-
-
--- merge two GFCCs; fails is differens absnames; priority to second arg
-
-unionPGF :: PGF -> PGF -> PGF
-unionPGF one two = case absname one of
- n | n == wildCId -> two -- extending empty grammar
- | n == absname two -> one { -- extending grammar with same abstract
- concretes = Map.union (concretes two) (concretes one),
- cncnames = union (cncnames one) (cncnames two)
- }
- _ -> one -- abstracts don't match ---- print error msg
-
-emptyPGF :: PGF
-emptyPGF = PGF {
- absname = wildCId,
- cncnames = [] ,
- gflags = Map.empty,
- abstract = error "empty grammar, no abstract",
- concretes = Map.empty
- }
-
--- | This is just a 'CId' with the language name.
--- A language name is the identifier that you write in the
--- top concrete or abstract module in GF after the
--- concrete/abstract keyword. Example:
---
--- > abstract Lang = ...
--- > concrete LangEng of Lang = ...
-type Language = CId
-
-readLanguage :: String -> Maybe Language
-readLanguage = readCId
-
-showLanguage :: Language -> String
-showLanguage = showCId