diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2007-09-24 08:19:29 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2007-09-24 08:19:29 +0000 |
| commit | 36e091d0a1339ab363be2ad9d27608020636e569 (patch) | |
| tree | f643ca95604ca98aa49cf4f9e6a7c53b5fb53406 /src/GF/FCFG/ToFCFG.hs | |
| parent | 6aacec3591e0e6e1d3ddca4605f6467e302cb65f (diff) | |
remove FCFG folder
Diffstat (limited to 'src/GF/FCFG/ToFCFG.hs')
| -rw-r--r-- | src/GF/FCFG/ToFCFG.hs | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/GF/FCFG/ToFCFG.hs b/src/GF/FCFG/ToFCFG.hs deleted file mode 100644 index 57e67113d..000000000 --- a/src/GF/FCFG/ToFCFG.hs +++ /dev/null @@ -1,101 +0,0 @@ ----------------------------------------------------------------------- --- | --- Maintainer : Aarne Ranta --- Stability : (stable) --- Portability : (portable) --- --- mapping from GF-internal FGrammar to bnfc-defined FCFG ------------------------------------------------------------------------------ - -module GF.FCFG.ToFCFG (printFGrammar) where - -import GF.Formalism.FCFG -import GF.Formalism.SimpleGFC -import GF.Infra.Ident -import qualified GF.FCFG.AbsFCFG as F - -import GF.FCFG.PrintFCFG (printTree) - -import qualified GF.Canon.AbsGFC as C - -import Control.Monad (liftM) -import Data.List (groupBy) -import Data.Array - -import GF.Formalism.Utilities -import GF.Formalism.GCFG - -import GF.Infra.Print - -type FToken = String - --- this is the main function used -printFGrammar :: FGrammar -> String -printFGrammar = undefined {- printTree . fgrammar - -fgrammar :: FCFGrammar FCat Name FToken -> F.FGrammar -fgrammar = F.FGr . map frule - -frule :: FCFRule FCat Name FToken -> F.FRule -frule (FRule ab rhs) = - F.FR (abstract ab) [[fsymbol sym | (_,sym) <- assocs syms] | (_,syms) <- assocs rhs] - -abstract :: Abstract FCat Name -> F.Abstract -abstract (Abs cat cats n) = F.Abs (fcat cat) (map fcat cats) (name n) - -fsymbol :: FSymbol FCat FToken -> F.FSymbol -fsymbol fs = case fs of - FSymCat fc i j -> F.FSymCat (fcat fc) (toInteger i) (toInteger j) - FSymTok s -> F.FSymTok s - -fcat :: FCat -> F.FCat -fcat (FCat i id ps pts) = - F.FC (toInteger i) (ident id) [map pathel p | Path p <- ps] - [F.PtT (map pathel p) (term t) | (Path p,t) <- pts] - -name :: Name -> F.Name -name (Name id profs) = F.Nm (ident id) (map profile profs) - -pathel :: Either C.Label (Term SCat FToken) -> F.PathEl -pathel lt = case lt of - Left lab -> F.PLabel $ label lab - Right trm -> F.PTerm $ term trm - -path (Path p) = map pathel p - -profile :: Profile (SyntaxForest Fun) -> F.Profile -profile p = case p of - Unify is -> F.Unify (map toInteger is) - Constant sf -> F.Const (forest sf) - -forest :: SyntaxForest Fun -> F.Forest -forest f = case f of - FMeta -> F.FMeta - FNode id fss -> F.FNode (ident id) (map (map forest) fss) - FString s -> F.FString s - FInt i -> F.FInt i - FFloat d -> F.FFloat d - -term :: Term SCat FToken -> F.Term -term tr = case tr of - Arg i id p -> F.Arg (toInteger i) (ident id) (path p) - Rec rs -> F.Rec [F.Ass (label l) (term t) | (l,t) <- rs] - Tbl cs -> F.Tbl [F.Cas (term p) (term v) | (p,v) <- cs] - c :^ ts -> F.Constr (constr c) (map term ts) - t :. l -> F.Proj (term t) (label l) - t :++ u -> F.Concat (term t) (term u) - t :! u -> F.Select (term t) (term u) - Variants ts -> F.Vars $ map term ts - Token s -> F.Tok s - Empty -> F.Empty - -label :: C.Label -> F.Label -label b = case b of - C.L x -> F.L $ ident x - C.LV i -> F.LV i - -ident :: Ident -> F.Ident -ident = F.Ident . prIdent --- is information lost? - -constr (C.CIQ m c) = F.CIQ (ident m) (ident c) --}
\ No newline at end of file |
