summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile
diff options
context:
space:
mode:
authorThomas Hallgren <th-github@altocumulus.org>2019-02-21 14:43:53 +0100
committerThomas Hallgren <th-github@altocumulus.org>2019-02-21 14:43:53 +0100
commita928e4657e396cde8e11a6e33071927246eb2f7a (patch)
tree7d84d4ae849cb34c6699a127cbe9d68ee2514bf2 /src/compiler/GF/Compile
parentb6fd9a7744dd170950d7ffb654c11b036564fb81 (diff)
Need aeson>=1.3
Also remove ununsed GF.Compile.PGFtoAbstract
Diffstat (limited to 'src/compiler/GF/Compile')
-rw-r--r--src/compiler/GF/Compile/PGFtoAbstract.hs42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/compiler/GF/Compile/PGFtoAbstract.hs b/src/compiler/GF/Compile/PGFtoAbstract.hs
deleted file mode 100644
index 032a53f81..000000000
--- a/src/compiler/GF/Compile/PGFtoAbstract.hs
+++ /dev/null
@@ -1,42 +0,0 @@
--- | Extract the abstract syntax from a PGF and convert to it
--- the AST for canonical GF grammars
-module GF.Compile.PGFtoAbstract(abstract2canonical) where
-import qualified Data.Map as M
-import PGF(CId,mkCId,showCId,wildCId,unType,abstractName)
-import PGF.Internal(abstract,cats,funs)
-import GF.Grammar.Canonical
-
-
-abstract2canonical pgf = Abstract (gId (abstractName pgf)) cs fs
- where
- abstr = abstract pgf
- cs = [CatDef (gId c) (convHs' hs) |
- (c,(hs,_,_)) <- M.toList (cats abstr),
- c `notElem` predefCat]
- fs = [FunDef (gId f) (convT ty) | (f,(ty,ar,_,_)) <- M.toList (funs abstr)]
-
-predefCat = map mkCId ["Float","Int","String"]
-
-convHs' = map convH'
-convH' (bt,name,ty) =
- case unType ty of
- ([],name,[]) -> gId name -- !!
-
-convT t =
- case unType t of
- (hypos,name,[]) -> Type (convHs hypos) (TypeApp (gId name) []) -- !!
-
-convHs = map convH
-
-convH (bt,name,ty) = TypeBinding (gId name) (convT ty)
-
---------------------------------------------------------------------------------
-
-class FromCId i where gId :: CId -> i
-
-instance FromCId FunId where gId = FunId . showCId
-instance FromCId CatId where gId = CatId . showCId
-instance FromCId ModId where gId = ModId . showCId
-
-instance FromCId VarId where
- gId i = if i==wildCId then Anonymous else VarId (showCId i)