forked from GitHub/gf-core
removed dep. on GFCCRaw
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module GF.Command.PPrTree (pTree, prExp, tree2exp) where
|
||||
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.Macros
|
||||
import qualified GF.Command.ParGFShell as P
|
||||
import GF.Command.PrintGFShell
|
||||
|
||||
@@ -17,7 +17,7 @@ module GF.Compile.ShellState where
|
||||
import GF.Data.Operations
|
||||
import GF.Canon.GFC
|
||||
import GF.Canon.AbsGFC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw(CId(CId))
|
||||
import GF.GFCC.CId
|
||||
--import GF.GFCC.DataGFCC(mkGFCC)
|
||||
import GF.Canon.CanonToGFCC
|
||||
import GF.Grammar.Macros
|
||||
|
||||
@@ -24,7 +24,7 @@ import GF.Formalism.FCFG
|
||||
|
||||
import GF.GFCC.Macros --hiding (prt)
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
|
||||
import GF.Data.BacktrackM
|
||||
import GF.Data.SortedList
|
||||
|
||||
@@ -18,7 +18,7 @@ module GF.Conversion.Types where
|
||||
|
||||
import qualified GF.Infra.Ident as Ident (Ident(..), wildIdent, isWildIdent)
|
||||
import qualified GF.Canon.AbsGFC as AbsGFC (CIdent(..), Label(..))
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as AbsGFCC (CId(..))
|
||||
import qualified GF.GFCC.CId
|
||||
import qualified GF.Grammar.Grammar as Grammar (Term)
|
||||
|
||||
import GF.Formalism.GCFG
|
||||
|
||||
@@ -19,7 +19,7 @@ import GF.Devel.PrintGFCC
|
||||
import qualified GF.GFCC.Macros as CM
|
||||
import qualified GF.GFCC.DataGFCC as C
|
||||
import qualified GF.GFCC.DataGFCC as D
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.Infra.Option ----
|
||||
import GF.Data.Operations
|
||||
import GF.Text.UTF8
|
||||
|
||||
@@ -18,7 +18,7 @@ module GF.Devel.GFCCtoHaskell (grammar2haskell, grammar2haskellGADT) where
|
||||
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
|
||||
import GF.Data.Operations
|
||||
import GF.Text.UTF8
|
||||
|
||||
@@ -2,7 +2,7 @@ module GF.Devel.GFCCtoJS (gfcc2js,gfcc2grammarRef) where
|
||||
|
||||
import qualified GF.GFCC.Macros as M
|
||||
import qualified GF.GFCC.DataGFCC as D
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import qualified GF.JavaScript.AbsJS as JS
|
||||
import qualified GF.JavaScript.PrintJS as JS
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import qualified GF.Grammar.Lookup as Look
|
||||
import qualified GF.GFCC.Macros as CM
|
||||
import qualified GF.GFCC.DataGFCC as C
|
||||
import qualified GF.GFCC.DataGFCC as D
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import qualified GF.Grammar.Abstract as A
|
||||
import qualified GF.Grammar.Macros as GM
|
||||
--import qualified GF.Grammar.Compute as Compute
|
||||
|
||||
@@ -38,7 +38,7 @@ import Data.Array
|
||||
import qualified Data.Map as Map
|
||||
|
||||
import GF.Formalism.Utilities
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as AbsGFCC
|
||||
import qualified GF.GFCC.CId as AbsGFCC
|
||||
import GF.Infra.PrintClass
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import GF.GFCC.Linearize
|
||||
import GF.GFCC.Generate
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.Raw.ConvertGFCC
|
||||
import GF.GFCC.Raw.ParGFCCRaw
|
||||
import GF.Command.PPrTree
|
||||
|
||||
14
src/GF/GFCC/CId.hs
Normal file
14
src/GF/GFCC/CId.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
module GF.GFCC.CId (
|
||||
module GF.GFCC.Raw.AbsGFCCRaw,
|
||||
prCId,
|
||||
cId
|
||||
) where
|
||||
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId(CId))
|
||||
|
||||
prCId :: CId -> String
|
||||
prCId (CId s) = s
|
||||
|
||||
cId :: String -> CId
|
||||
cId = CId
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module GF.GFCC.CheckGFCC (checkGFCC, checkGFCCio, checkGFCCmaybe) where
|
||||
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.ErrM
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module GF.GFCC.DataGFCC where
|
||||
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.Infra.CompactPrint
|
||||
import GF.Text.UTF8
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module GF.GFCC.Generate where
|
||||
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
|
||||
import qualified Data.Map as M
|
||||
import System.Random
|
||||
|
||||
@@ -2,7 +2,7 @@ module GF.GFCC.Linearize where
|
||||
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import Data.Map
|
||||
import Data.List
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module GF.GFCC.Macros where
|
||||
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.DataGFCC
|
||||
----import GF.GFCC.PrintGFCC
|
||||
import Data.Map
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module GF.GFCC.OptimizeGFCC where
|
||||
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.DataGFCC
|
||||
|
||||
import GF.Data.Operations
|
||||
|
||||
@@ -59,7 +59,7 @@ toGFCC (Grm [
|
||||
|
||||
toType :: RExp -> Type
|
||||
toType e = case e of
|
||||
App cat [App (CId "hypo") hypos, App (CId "arg") exps] ->
|
||||
App cat [App (CId "H") hypos, App (CId "X") exps] ->
|
||||
DTyp (lmap toHypo hypos) cat (lmap toExp exps)
|
||||
_ -> error $ "type " ++ show e
|
||||
|
||||
@@ -70,7 +70,7 @@ toHypo e = case e of
|
||||
|
||||
toExp :: RExp -> Exp
|
||||
toExp e = case e of
|
||||
App fun [App (CId "abs") xs, App (CId "arg") exps] ->
|
||||
App fun [App (CId "B") xs, App (CId "X") exps] ->
|
||||
DTr [x | AId x <- xs] (AC fun) (lmap toExp exps)
|
||||
App (CId "Eq") _ -> EEq [] ----
|
||||
AMet -> DTr [] (AM 0) []
|
||||
@@ -125,8 +125,8 @@ fromType :: Type -> RExp
|
||||
fromType e = case e of
|
||||
DTyp hypos cat exps ->
|
||||
App cat [
|
||||
App (CId "hypo") (lmap fromHypo hypos),
|
||||
App (CId "arg") (lmap fromExp exps)]
|
||||
App (CId "H") (lmap fromHypo hypos),
|
||||
App (CId "X") (lmap fromExp exps)]
|
||||
|
||||
fromHypo :: Hypo -> RExp
|
||||
fromHypo e = case e of
|
||||
@@ -135,7 +135,7 @@ fromHypo e = case e of
|
||||
fromExp :: Exp -> RExp
|
||||
fromExp e = case e of
|
||||
DTr xs (AC fun) exps ->
|
||||
App fun [App (CId "abs") (lmap AId xs), App (CId "arg") (lmap fromExp exps)]
|
||||
App fun [App (CId "B") (lmap AId xs), App (CId "X") (lmap fromExp exps)]
|
||||
DTr xs (AM _) exps -> AMet ----
|
||||
EEq _ -> App (CId "Eq") [] ----
|
||||
_ -> error $ "exp " ++ show e
|
||||
|
||||
@@ -10,101 +10,3 @@ AMet. RExp ::= "?" ;
|
||||
terminator RExp "" ;
|
||||
|
||||
token CId (('_' | letter) (letter | digit | '\'' | '_')*) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{-
|
||||
Grm. Grammar ::=
|
||||
"grammar" CId "(" [CId] ")" "(" [Flag] ")" ";"
|
||||
Abstract ";"
|
||||
[Concrete] ;
|
||||
|
||||
Abs. Abstract ::=
|
||||
"abstract" "{"
|
||||
"flags" [Flag]
|
||||
"fun" [FunDef]
|
||||
"cat" [CatDef]
|
||||
"}" ;
|
||||
|
||||
Cnc. Concrete ::=
|
||||
"concrete" CId "{"
|
||||
"flags" [Flag]
|
||||
"lin" [LinDef]
|
||||
"oper" [LinDef]
|
||||
"lincat" [LinDef]
|
||||
"lindef" [LinDef]
|
||||
"printname" [LinDef]
|
||||
"param" [LinDef] -- lincats with param value names
|
||||
"}" ;
|
||||
|
||||
Flg. Flag ::= CId "=" String ;
|
||||
Cat. CatDef ::= CId "[" [Hypo] "]" ;
|
||||
|
||||
Fun. FunDef ::= CId ":" Type "=" Exp ;
|
||||
Lin. LinDef ::= CId "=" Term ;
|
||||
|
||||
DTyp. Type ::= "[" [Hypo] "]" CId [Exp] ; -- dependent type
|
||||
DTr. Exp ::= "[" "(" [CId] ")" Atom [Exp] "]" ; -- term with bindings
|
||||
|
||||
AC. Atom ::= CId ;
|
||||
AS. Atom ::= String ;
|
||||
AI. Atom ::= Integer ;
|
||||
AF. Atom ::= Double ;
|
||||
AM. Atom ::= "?" Integer ;
|
||||
|
||||
R. Term ::= "[" [Term] "]" ; -- record/table
|
||||
P. Term ::= "(" Term "!" Term ")" ; -- projection/selection
|
||||
S. Term ::= "(" [Term] ")" ; -- concatenated sequence
|
||||
K. Term ::= Tokn ; -- token
|
||||
V. Term ::= "$" Integer ; -- argument
|
||||
C. Term ::= Integer ; -- parameter value/label
|
||||
F. Term ::= CId ; -- global constant
|
||||
FV. Term ::= "[|" [Term] "|]" ; -- free variation
|
||||
W. Term ::= "(" String "+" Term ")" ; -- prefix + suffix table
|
||||
TM. Term ::= "?" ; -- lin of metavariable
|
||||
|
||||
KS. Tokn ::= String ;
|
||||
KP. Tokn ::= "[" "pre" [String] "[" [Variant] "]" "]" ;
|
||||
Var. Variant ::= [String] "/" [String] ;
|
||||
|
||||
|
||||
RP. Term ::= "(" Term "@" Term ")"; -- DEPRECATED: record parameter alias
|
||||
|
||||
terminator Concrete ";" ;
|
||||
terminator Flag ";" ;
|
||||
terminator CatDef ";" ;
|
||||
terminator FunDef ";" ;
|
||||
terminator LinDef ";" ;
|
||||
separator CId "," ;
|
||||
separator Term "," ;
|
||||
terminator Exp "" ;
|
||||
terminator String "" ;
|
||||
separator Variant "," ;
|
||||
|
||||
|
||||
|
||||
-- the following are needed if dependent types or HOAS or defs are present
|
||||
|
||||
Hyp. Hypo ::= CId ":" Type ;
|
||||
AV. Atom ::= "$" CId ;
|
||||
|
||||
EEq. Exp ::= "{" [Equation] "}" ; -- list of pattern eqs; primitive: []
|
||||
Equ. Equation ::= [Exp] "->" Exp ; -- patterns are encoded as exps
|
||||
|
||||
separator Hypo "," ;
|
||||
terminator Equation ";" ;
|
||||
|
||||
-}
|
||||
|
||||
@@ -8,7 +8,7 @@ module GF.GFCC.ShowLinearize (
|
||||
import GF.GFCC.Linearize
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
--import GF.GFCC.PrintGFCC ----
|
||||
|
||||
import GF.Data.Operations
|
||||
|
||||
@@ -22,7 +22,7 @@ import qualified GF.Parsing.FCFG.Active as Active
|
||||
import GF.Parsing.FCFG.PInfo
|
||||
|
||||
import GF.GFCC.DataGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import GF.GFCC.Macros
|
||||
import GF.GFCC.ErrM
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import GF.Formalism.FCFG
|
||||
import GF.Data.SortedList
|
||||
import GF.Data.Assoc
|
||||
import GF.Parsing.FCFG.Range
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as AbsGFCC
|
||||
import qualified GF.GFCC.CId as AbsGFCC
|
||||
|
||||
import Data.Array
|
||||
import Data.Maybe
|
||||
|
||||
@@ -25,7 +25,7 @@ import qualified GF.Grammar.Grammar as Grammar
|
||||
import qualified GF.Grammar.Macros as Macros
|
||||
import qualified GF.Canon.AbsGFC as AbsGFC
|
||||
import qualified GF.GFCC.DataGFCC as AbsGFCC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw (CId (..))
|
||||
import GF.GFCC.CId
|
||||
import qualified GF.GFCC.ErrM as ErrM
|
||||
import qualified GF.Infra.Ident as Ident
|
||||
import GF.CF.CFIdent (CFCat, cfCat2Ident, CFTok, wordsCFTok, prCFTok)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
module GF.Speech.GrammarToVoiceXML (grammar2vxml) where
|
||||
|
||||
import GF.Canon.CanonToGFCC (canon2gfcc)
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as C
|
||||
import qualified GF.GFCC.CId as C
|
||||
import GF.GFCC.DataGFCC (GFCC(..), Abstr(..))
|
||||
import GF.GFCC.Macros
|
||||
import qualified GF.Canon.GFC as GFC
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
module GF.Speech.TransformCFG where
|
||||
|
||||
import GF.Canon.CanonToGFCC (canon2gfcc)
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as C
|
||||
import qualified GF.GFCC.CId as C
|
||||
import GF.GFCC.Macros (lookType,catSkeleton)
|
||||
import GF.GFCC.DataGFCC (GFCC)
|
||||
import GF.Conversion.Types
|
||||
|
||||
Reference in New Issue
Block a user