Main.hs revision 7a4af22fba15f5a09421232c4b4e035429ab9c41
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder----------------------------------------------------------------
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder-- GMP
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder-- Copyright 2007, Lutz Schroeder and Georgel Calin
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder----------------------------------------------------------------
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maedermodule Main where
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maederimport Text.ParserCombinators.Parsec
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maederimport IO
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maederimport GMPAS
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maederimport GMPParser
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian MaederaskForInput = do
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder option <- getLine
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder putStrLn ("Please enter the name of the test file (or \"\" to stop):")
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder name <- getLine
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder if name == ""
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder then return ()
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder else do
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder input <- readFile ("./tests/" ++ name)
a64a0692ffff29e0846ca325b1811266a9f105e0Christian Maeder if read option == 1
c4e912fc181d72c8d0e0e38d0351278182f0d0b5Christian Maeder then runLex (par5er :: Parser (Formula Integer)) input
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder else if read option == 2
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder then runLex (par5er :: Parser (Formula BitString)) input
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder else if read option == 3
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder then runLex (par5er :: Parser (Formula ModalK)) input
86c119e3e74ba4b1b4ca728531282e9100789939Christian Maeder else if read option == 4
86c119e3e74ba4b1b4ca728531282e9100789939Christian Maeder then runLex (par5er :: Parser (Formula ModalKD)) input
86c119e3e74ba4b1b4ca728531282e9100789939Christian Maeder else runLex (par5er :: Parser (Formula Kars)) input
86c119e3e74ba4b1b4ca728531282e9100789939Christian Maeder askForInput
86c119e3e74ba4b1b4ca728531282e9100789939Christian Maeder return ()
49a475aee8bae6c05798d65fddf13ec6da66f0beChristian Maedermain = do
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder hSetBuffering stdin LineBuffering
c4e912fc181d72c8d0e0e38d0351278182f0d0b5Christian Maeder putStrLn ("Please enter \n" ++
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder " 1 for integer index\n" ++
30203b61afb4393c8e459470b3a16d1fe26acc7fChristian Maeder " 2 for bit-string index\n" ++
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder " 3 for K () index\n" ++
d703a61b7fa9f85d92ac8f768d7c290b7c0a41c5Christian Maeder " 4 for KD () index\n" ++
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maeder " another digit for string indexes")
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maeder askForInput
da245da15da78363c896e44ea97a14ab1f83eb50Christian Maeder