forked from GitHub/gf-core
Founding the newly structured GF2.0 cvs archive.
This commit is contained in:
25
src/GF/Canon/TestGFC.hs
Normal file
25
src/GF/Canon/TestGFC.hs
Normal file
@@ -0,0 +1,25 @@
|
||||
-- automatically generated by BNF Converter
|
||||
module TestGFC where
|
||||
|
||||
import LexGFC
|
||||
import ParGFC
|
||||
import SkelGFC
|
||||
import PrintGFC
|
||||
import AbsGFC
|
||||
|
||||
import ErrM
|
||||
|
||||
type ParseFun a = [Token] -> Err a
|
||||
|
||||
myLLexer = myLexer
|
||||
|
||||
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 (myLLexer 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
|
||||
Reference in New Issue
Block a user