Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
i7
peregrine
Commits
a4645dde
Commit
a4645dde
authored
May 06, 2014
by
Philipp Meyer
Browse files
Added output of input file in main
parent
c4a94af6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Main.hs
View file @
a4645dde
...
...
@@ -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
src/PetriNet.hs
View file @
a4645dde
...
...
@@ -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
))
++
"
\n
Places: "
++
unwords
(
places
net
)
++
"
\n
Transitions: "
++
unwords
(
transitions
net
)
++
"
\n
Arcs:
\n
"
++
unlines
(
map
(
\
(
l
,
r
,
w
)
->
l
++
" ->"
++
(
if
w
/=
1
then
"["
++
show
w
++
"]"
else
[]
)
++
" "
++
r
)
...
...
src/Property.hs
View file @
a4645dde
...
...
@@ -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
++
" }"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment