forked from GitHub/gf-core
remove all files that aren't used in GF-3.0
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
{-# OPTIONS_GHC -fglasgow-exts #-}
|
||||
module GF.GFCC.ComposOp (Compos(..),composOp,composOpM,composOpM_,composOpMonoid,
|
||||
composOpMPlus,composOpFold) where
|
||||
|
||||
import Control.Monad.Identity
|
||||
import Data.Monoid
|
||||
|
||||
class Compos t where
|
||||
compos :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b)
|
||||
-> (forall a. t a -> m (t a)) -> t c -> m (t c)
|
||||
|
||||
composOp :: Compos t => (forall a. t a -> t a) -> t c -> t c
|
||||
composOp f = runIdentity . composOpM (Identity . f)
|
||||
|
||||
composOpM :: (Compos t, Monad m) => (forall a. t a -> m (t a)) -> t c -> m (t c)
|
||||
composOpM = compos return ap
|
||||
|
||||
composOpM_ :: (Compos t, Monad m) => (forall a. t a -> m ()) -> t c -> m ()
|
||||
composOpM_ = composOpFold (return ()) (>>)
|
||||
|
||||
composOpMonoid :: (Compos t, Monoid m) => (forall a. t a -> m) -> t c -> m
|
||||
composOpMonoid = composOpFold mempty mappend
|
||||
|
||||
composOpMPlus :: (Compos t, MonadPlus m) => (forall a. t a -> m b) -> t c -> m b
|
||||
composOpMPlus = composOpFold mzero mplus
|
||||
|
||||
composOpFold :: Compos t => b -> (b -> b -> b) -> (forall a. t a -> b) -> t c -> b
|
||||
composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f)
|
||||
|
||||
newtype C b a = C { unC :: b }
|
||||
File diff suppressed because one or more lines are too long
@@ -1,109 +0,0 @@
|
||||
module GF.GFCC.SkelGFCC where
|
||||
|
||||
-- Haskell module generated by the BNF converter
|
||||
|
||||
import GF.GFCC.AbsGFCC
|
||||
import GF.Data.ErrM
|
||||
type Result = Err String
|
||||
|
||||
failure :: Show a => a -> Result
|
||||
failure x = Bad $ "Undefined case: " ++ show x
|
||||
|
||||
transCId :: CId -> Result
|
||||
transCId x = case x of
|
||||
CId str -> failure x
|
||||
|
||||
|
||||
transGrammar :: Grammar -> Result
|
||||
transGrammar x = case x of
|
||||
Grm cid cids abstract concretes -> failure x
|
||||
|
||||
|
||||
transAbstract :: Abstract -> Result
|
||||
transAbstract x = case x of
|
||||
Abs flags fundefs catdefs -> failure x
|
||||
|
||||
|
||||
transConcrete :: Concrete -> Result
|
||||
transConcrete x = case x of
|
||||
Cnc cid flags lindefs0 lindefs1 lindefs2 lindefs3 lindefs -> failure x
|
||||
|
||||
|
||||
transFlag :: Flag -> Result
|
||||
transFlag x = case x of
|
||||
Flg cid str -> failure x
|
||||
|
||||
|
||||
transCatDef :: CatDef -> Result
|
||||
transCatDef x = case x of
|
||||
Cat cid hypos -> failure x
|
||||
|
||||
|
||||
transFunDef :: FunDef -> Result
|
||||
transFunDef x = case x of
|
||||
Fun cid type' exp -> failure x
|
||||
|
||||
|
||||
transLinDef :: LinDef -> Result
|
||||
transLinDef x = case x of
|
||||
Lin cid term -> failure x
|
||||
|
||||
|
||||
transType :: Type -> Result
|
||||
transType x = case x of
|
||||
DTyp hypos cid exps -> failure x
|
||||
|
||||
|
||||
transExp :: Exp -> Result
|
||||
transExp x = case x of
|
||||
DTr cids atom exps -> failure x
|
||||
EEq equations -> failure x
|
||||
|
||||
|
||||
transAtom :: Atom -> Result
|
||||
transAtom x = case x of
|
||||
AC cid -> failure x
|
||||
AS str -> failure x
|
||||
AI n -> failure x
|
||||
AF d -> failure x
|
||||
AM n -> failure x
|
||||
AV cid -> failure x
|
||||
|
||||
|
||||
transTerm :: Term -> Result
|
||||
transTerm x = case x of
|
||||
R terms -> failure x
|
||||
P term0 term -> failure x
|
||||
S terms -> failure x
|
||||
K tokn -> failure x
|
||||
V n -> failure x
|
||||
C n -> failure x
|
||||
F cid -> failure x
|
||||
FV terms -> failure x
|
||||
W str term -> failure x
|
||||
TM -> failure x
|
||||
RP term0 term -> failure x
|
||||
|
||||
|
||||
transTokn :: Tokn -> Result
|
||||
transTokn x = case x of
|
||||
KS str -> failure x
|
||||
KP strs variants -> failure x
|
||||
|
||||
|
||||
transVariant :: Variant -> Result
|
||||
transVariant x = case x of
|
||||
Var strs0 strs -> failure x
|
||||
|
||||
|
||||
transHypo :: Hypo -> Result
|
||||
transHypo x = case x of
|
||||
Hyp cid type' -> failure x
|
||||
|
||||
|
||||
transEquation :: Equation -> Result
|
||||
transEquation x = case x of
|
||||
Equ exps exp -> failure x
|
||||
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
-- automatically generated by BNF Converter
|
||||
module Main where
|
||||
|
||||
|
||||
import IO ( stdin, hGetContents )
|
||||
import System ( getArgs, getProgName )
|
||||
|
||||
import GF.GFCC.LexGFCC
|
||||
import GF.GFCC.ParGFCC
|
||||
import GF.GFCC.SkelGFCC
|
||||
import GF.GFCC.PrintGFCC
|
||||
import GF.GFCC.AbsGFCC
|
||||
|
||||
|
||||
|
||||
|
||||
import GF.Data.ErrM
|
||||
|
||||
type ParseFun a = [Token] -> Err a
|
||||
|
||||
myLLexer = myLexer
|
||||
|
||||
type Verbosity = Int
|
||||
|
||||
putStrV :: Verbosity -> String -> IO ()
|
||||
putStrV v s = if v > 1 then putStrLn s else return ()
|
||||
|
||||
runFile :: (Print a, Show a) => Verbosity -> ParseFun a -> FilePath -> IO ()
|
||||
runFile v p f = putStrLn f >> readFile f >>= run v p
|
||||
|
||||
run :: (Print a, Show a) => Verbosity -> ParseFun a -> String -> IO ()
|
||||
run v p s = let ts = myLLexer s in case p ts of
|
||||
Bad s -> do putStrLn "\nParse Failed...\n"
|
||||
putStrV v "Tokens:"
|
||||
putStrV v $ show ts
|
||||
putStrLn s
|
||||
Ok tree -> do putStrLn "\nParse Successful!"
|
||||
showTree v tree
|
||||
|
||||
|
||||
|
||||
showTree :: (Show a, Print a) => Int -> a -> IO ()
|
||||
showTree v tree
|
||||
= do
|
||||
putStrV v $ "\n[Abstract Syntax]\n\n" ++ show tree
|
||||
putStrV v $ "\n[Linearized tree]\n\n" ++ printTree tree
|
||||
|
||||
main :: IO ()
|
||||
main = do args <- getArgs
|
||||
case args of
|
||||
[] -> hGetContents stdin >>= run 2 pGrammar
|
||||
"-s":fs -> mapM_ (runFile 0 pGrammar) fs
|
||||
fs -> mapM_ (runFile 2 pGrammar) fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user