From 345934b3dccf6b416e6a74a05750c152f38c55d7 Mon Sep 17 00:00:00 2001 From: Nikolai Kudasov Date: Fri, 22 Dec 2023 01:09:22 +0300 Subject: [PATCH] Remove more ignored files from repo --- .../src/Language/EO/Phi/Syntax/ErrM.hs | 91 ------------------- .../src/Language/EO/Phi/Syntax/Skel.hs | 59 ------------ .../src/Language/EO/Phi/Syntax/Test.hs | 76 ---------------- 3 files changed, 226 deletions(-) delete mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs delete mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs delete mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs deleted file mode 100644 index fb27b4f4c..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs +++ /dev/null @@ -1,91 +0,0 @@ --- File generated by the BNF Converter (bnfc 2.9.5). - -{-# LANGUAGE CPP #-} - -#if __GLASGOW_HASKELL__ >= 708 ---------------------------------------------------------------------------- --- Pattern synonyms exist since ghc 7.8. - --- | BNF Converter: Error Monad. --- --- Module for backwards compatibility. --- --- The generated parser now uses @'Either' String@ as error monad. --- This module defines a type synonym 'Err' and pattern synonyms --- 'Bad' and 'Ok' for 'Left' and 'Right'. - -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE FlexibleInstances #-} - -module Language.EO.Phi.Syntax.ErrM where - -import Prelude (id, const, Either(..), String) - -import Control.Monad (MonadPlus(..)) -import Control.Applicative (Alternative(..)) -#if __GLASGOW_HASKELL__ >= 808 -import Control.Monad (MonadFail(..)) -#endif - --- | Error monad with 'String' error messages. -type Err = Either String - -pattern Bad msg = Left msg -pattern Ok a = Right a - -#if __GLASGOW_HASKELL__ >= 808 -instance MonadFail Err where - fail = Bad -#endif - -instance Alternative Err where - empty = Left "Err.empty" - (<|>) Left{} = id - (<|>) x@Right{} = const x - -instance MonadPlus Err where - mzero = empty - mplus = (<|>) - -#else ---------------------------------------------------------------------------- --- ghc 7.6 and before: use old definition as data type. - --- | BNF Converter: Error Monad - --- Copyright (C) 2004 Author: Aarne Ranta --- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE. - -module Language.EO.Phi.Syntax.ErrM where - --- the Error monad: like Maybe type with error msgs - -import Control.Applicative (Applicative(..), Alternative(..)) -import Control.Monad (MonadPlus(..), liftM) - -data Err a = Ok a | Bad String - deriving (Read, Show, Eq, Ord) - -instance Monad Err where - return = Ok - Ok a >>= f = f a - Bad s >>= _ = Bad s - -instance Applicative Err where - pure = Ok - (Bad s) <*> _ = Bad s - (Ok f) <*> o = liftM f o - -instance Functor Err where - fmap = liftM - -instance MonadPlus Err where - mzero = Bad "Err.mzero" - mplus (Bad _) y = y - mplus x _ = x - -instance Alternative Err where - empty = mzero - (<|>) = mplus - -#endif diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs deleted file mode 100644 index 2cfe2f044..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs +++ /dev/null @@ -1,59 +0,0 @@ --- File generated by the BNF Converter (bnfc 2.9.5). - --- Templates for pattern matching on abstract syntax - -{-# OPTIONS_GHC -fno-warn-unused-matches #-} - -module Language.EO.Phi.Syntax.Skel where - -import Prelude (($), Either(..), String, (++), Show, show) -import qualified Language.EO.Phi.Syntax.Abs - -type Err = Either String -type Result = Err String - -failure :: Show a => a -> Result -failure x = Left $ "Undefined case: " ++ show x - -transBytes :: Language.EO.Phi.Syntax.Abs.Bytes -> Result -transBytes x = case x of - Language.EO.Phi.Syntax.Abs.Bytes string -> failure x - -transFunction :: Language.EO.Phi.Syntax.Abs.Function -> Result -transFunction x = case x of - Language.EO.Phi.Syntax.Abs.Function string -> failure x - -transLabelId :: Language.EO.Phi.Syntax.Abs.LabelId -> Result -transLabelId x = case x of - Language.EO.Phi.Syntax.Abs.LabelId string -> failure x - -transAlphaIndex :: Language.EO.Phi.Syntax.Abs.AlphaIndex -> Result -transAlphaIndex x = case x of - Language.EO.Phi.Syntax.Abs.AlphaIndex string -> failure x - -transProgram :: Show a => Language.EO.Phi.Syntax.Abs.Program' a -> Result -transProgram x = case x of - Language.EO.Phi.Syntax.Abs.Program _ bindings -> failure x - -transObject :: Show a => Language.EO.Phi.Syntax.Abs.Object' a -> Result -transObject x = case x of - Language.EO.Phi.Syntax.Abs.Formation _ bindings -> failure x - Language.EO.Phi.Syntax.Abs.Application _ object bindings -> failure x - Language.EO.Phi.Syntax.Abs.Dispatch _ object attribute -> failure x - Language.EO.Phi.Syntax.Abs.Termination _ -> failure x - -transBinding :: Show a => Language.EO.Phi.Syntax.Abs.Binding' a -> Result -transBinding x = case x of - Language.EO.Phi.Syntax.Abs.AlphaBinding _ attribute object -> failure x - Language.EO.Phi.Syntax.Abs.EmptyBinding _ attribute -> failure x - Language.EO.Phi.Syntax.Abs.DeltaBinding _ bytes -> failure x - Language.EO.Phi.Syntax.Abs.LambdaBinding _ function -> failure x - -transAttribute :: Show a => Language.EO.Phi.Syntax.Abs.Attribute' a -> Result -transAttribute x = case x of - Language.EO.Phi.Syntax.Abs.Phi _ -> failure x - Language.EO.Phi.Syntax.Abs.Rho _ -> failure x - Language.EO.Phi.Syntax.Abs.Sigma _ -> failure x - Language.EO.Phi.Syntax.Abs.VTX _ -> failure x - Language.EO.Phi.Syntax.Abs.Label _ labelid -> failure x - Language.EO.Phi.Syntax.Abs.Alpha _ alphaindex -> failure x diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs deleted file mode 100644 index 1e846af00..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs +++ /dev/null @@ -1,76 +0,0 @@ --- File generated by the BNF Converter (bnfc 2.9.5). - --- | Program to test parser. - -module Main where - -import Prelude - ( ($), (.) - , Either(..) - , Int, (>) - , String, (++), concat, unlines - , Show, show - , IO, (>>), (>>=), mapM_, putStrLn - , FilePath - , getContents, readFile - ) -import System.Environment ( getArgs ) -import System.Exit ( exitFailure ) -import Control.Monad ( when ) - -import Language.EO.Phi.Syntax.Abs () -import Language.EO.Phi.Syntax.Lex ( Token, mkPosToken ) -import Language.EO.Phi.Syntax.Par ( pProgram, myLexer ) -import Language.EO.Phi.Syntax.Print ( Print, printTree ) -import Language.EO.Phi.Syntax.Skel () - -type Err = Either String -type ParseFun a = [Token] -> Err a -type Verbosity = Int - -putStrV :: Verbosity -> String -> IO () -putStrV v s = when (v > 1) $ putStrLn s - -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 = - case p ts of - Left err -> do - putStrLn "\nParse Failed...\n" - putStrV v "Tokens:" - mapM_ (putStrV v . showPosToken . mkPosToken) ts - putStrLn err - exitFailure - Right tree -> do - putStrLn "\nParse Successful!" - showTree v tree - where - ts = myLexer s - showPosToken ((l,c),t) = concat [ show l, ":", show c, "\t", show t ] - -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 - -usage :: IO () -usage = do - putStrLn $ unlines - [ "usage: Call with one of the following argument combinations:" - , " --help Display this help message." - , " (no arguments) Parse stdin verbosely." - , " (files) Parse content of files verbosely." - , " -s (files) Silent mode. Parse content of files silently." - ] - -main :: IO () -main = do - args <- getArgs - case args of - ["--help"] -> usage - [] -> getContents >>= run 2 pProgram - "-s":fs -> mapM_ (runFile 0 pProgram) fs - fs -> mapM_ (runFile 2 pProgram) fs -