24.09., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit a4645dde authored by Philipp Meyer's avatar Philipp Meyer

Added output of input file in main

parent c4a94af6
......@@ -3,12 +3,22 @@ module Main where
import System.Environment (getArgs)
import Parser (parseFile)
import PetriNet
import Property
checkProperty :: PetriNet -> Property -> Bool
checkProperty net p = True
main :: IO ()
main = do
args <- getArgs
putStrLn "Safety and Liveness Analysis of Petri Nets with SMT solvers"
let file = head args
net <- parseFile file
print net
putStrLn "Safety and Liveness Analysis of Petri Nets with SMT solvers"
putStrLn $ "Reading \"" ++ file ++ "\""
(net,properties) <- parseFile file
putStrLn $ "Analyzing " ++ show net
mapM_ (\p -> do
putStrLn $ "Checking " ++ show p
putStrLn $ show $ checkProperty net p
) properties
......@@ -14,10 +14,11 @@ data PetriNet = PetriNet {
}
instance Show PetriNet where
show net = "Petri net " ++ name net ++ "\n" ++
"Places: " ++ unwords (places net) ++ "\n" ++
"Transitions: " ++ unwords (transitions net) ++ "\n" ++
"Arcs:\n" ++ unlines
show net = "Petri net" ++
(if null (name net) then "" else " " ++ show (name net)) ++
"\nPlaces: " ++ unwords (places net) ++
"\nTransitions: " ++ unwords (transitions net) ++
"\nArcs:\n" ++ unlines
(map (\(l,r,w) -> l ++ " ->" ++
(if w /= 1 then "[" ++ show w ++ "]" else []) ++
" " ++ r)
......
......@@ -29,9 +29,9 @@ data Op = Gt | Ge | Eq | Le | Lt
instance Show Op where
show Gt = ">"
show Ge = ">="
show Ge = ""
show Eq = "="
show Le = "<="
show Le = ""
show Lt = "<"
data LinearInequation = LinIneq Term Op Term
......@@ -62,6 +62,8 @@ instance Show PropertyType where
data Property = Property String PropertyType Formula
instance Show Property where
show (Property name ptype formula) = show ptype ++ " " ++ show name ++
" { " ++ show formula ++ " }"
show (Property name ptype formula) =
show ptype ++ " property " ++
(if null name then "" else show name ++ " ") ++
"{ " ++ show formula ++ " }"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment