Main.hs revision 97aef8ef18cd9aa4bb30e95f4e8b49b0b82dea22
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder----------------------------------------------------------------
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder-- GMP
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder-- Copyright 2007, Lutz Schroeder and Georgel Calin
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder----------------------------------------------------------------
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maedermodule Main where
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maederimport Text.ParserCombinators.Parsec
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maederimport IO
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maeder
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maederimport GMPAS
9d0567bda351efa4286f38e85fb3e41ecd3683eaChristian Maederimport GMPParser
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder
20bd79f8844604c145510c616fecdaf47eba2fdbChristian MaederaskForInput = do
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder option <- getLine
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder putStrLn ("Please enter the name of the test file (or \"\" to stop):")
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder name <- getLine
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder if name == ""
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder then return ()
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder else do
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder input <- readFile ("./tests/" ++ name)
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder if read option == 1
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder then runLex (par5er :: Parser (Formula Integer)) input
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder else if read option == 2
20bd79f8844604c145510c616fecdaf47eba2fdbChristian Maeder then runLex (par5er :: Parser (Formula [Integer])) input
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder else runLex (par5er :: Parser (Formula Kars)) input
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder askForInput
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder return ()
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maedermain = do
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder hSetBuffering stdin LineBuffering
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder putStrLn ("Please enter \n 1 for integer indexes\n 2 for bit-string indexes\n another digit for string indexes")
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder askForInput
2119c0874c93fc1cdfea381bcfea69e8fdb8b6e2Christian Maeder