From fdc39cf18c3cb8be2c142bef4a1bf80432a0cb3d Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 3 Nov 2007 22:37:18 +0000 Subject: [PATCH] started command interpreter for gfcc --- src/GF/Command/Interpreter.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/GF/Command/Interpreter.hs diff --git a/src/GF/Command/Interpreter.hs b/src/GF/Command/Interpreter.hs new file mode 100644 index 000000000..cebe4ef28 --- /dev/null +++ b/src/GF/Command/Interpreter.hs @@ -0,0 +1,26 @@ +module GF.Command.Interpreter where + +import GF.Command.AbsGFShell +import GF.Command.ParGFShell +import GF.GFCC.API + +import GF.Command.ErrM + + +interpretCommandLine :: MultiGrammar -> CommandLine -> IO () +interpretCommandLine gr line = case line of + CEmpty -> return () + CLine pipes -> mapM_ interPipe pipes + where + interPipe (PComm cs) = do + ts <- intercs [] cs + mapM_ (putStrLn . showTree) ts + intercs trees [] = return trees + intercs trees (c:cs) = do + trees2 <- interc trees c + intercs trees2 cs + interc = interpret gr + +interpret :: MultiGrammar -> [Tree] -> Command -> IO [Tree] +interpret gr trees comm = case (trees,command comm) of + _ -> return trees ----