From b1402e8bd6a68a891b00a214d6cf184d66defe19 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 22 Sep 2003 13:16:55 +0000 Subject: Founding the newly structured GF2.0 cvs archive. --- src/GF/Source/TestGF.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/GF/Source/TestGF.hs (limited to 'src/GF/Source/TestGF.hs') diff --git a/src/GF/Source/TestGF.hs b/src/GF/Source/TestGF.hs new file mode 100644 index 000000000..f1c8e49a1 --- /dev/null +++ b/src/GF/Source/TestGF.hs @@ -0,0 +1,22 @@ +-- automatically generated by BNF Converter +module TestGF where + +import LexGF +import ParGF +import SkelGF +import PrintGF +import AbsGF +import ErrM + +type ParseFun a = [Token] -> Err a + +runFile :: (Print a, Show a) => ParseFun a -> FilePath -> IO() +runFile p f = readFile f >>= run p + +run :: (Print a, Show a) => ParseFun a -> String -> IO() +run p s = case (p (myLexer s)) of + Bad s -> do putStrLn "\nParse Failed...\n" + putStrLn s + Ok tree -> do putStrLn "\nParse Successful!" + putStrLn $ "\n[Abstract Syntax]\n\n" ++ show tree + putStrLn $ "\n[Linearized tree]\n\n" ++ printTree tree -- cgit v1.2.3