Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pta2maude
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
real-time maude
pta2maude
Commits
f9591485
Commit
f9591485
authored
1 year ago
by
Jaime Arias
Browse files
Options
Downloads
Patches
Plain Diff
wip: add preamble
parent
7acf221f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pta2maude/src/Parser.py
+34
-2
34 additions, 2 deletions
pta2maude/src/Parser.py
pta2maude/tests/examples/coffee-intrpr.maude
+15
-15
15 additions, 15 deletions
pta2maude/tests/examples/coffee-intrpr.maude
with
49 additions
and
17 deletions
pta2maude/src/Parser.py
+
34
−
2
View file @
f9591485
...
...
@@ -315,7 +315,7 @@ class NoCollapsingParser(Parser):
variables
.
append
(
self
.
maude
.
variables
(
clocks
,
self
.
var_type
))
if
parameters
:
variables
.
append
(
self
.
maude
.
variables
(
parameters
,
self
.
var_type
))
""
variables_str
=
"
\n
"
.
join
(
variables
)
# define location constructors
...
...
@@ -830,7 +830,39 @@ class InterpreterParser(Parser):
super
().
__init__
(
var_type
)
def
_get_preamble
(
self
,
model
:
Model
)
->
str
:
return
""
clocks
=
model
.
clocks
parameters
=
model
.
parameters
# locations
locations
=
[
loc
.
name
for
automaton
in
model
.
automata
for
loc
in
automaton
.
locations
]
locations_str
=
self
.
maude
.
operators
(
locations
,
[],
"
Location
"
,
[
"
ctor
"
])
# actions
actions
=
[
a
for
a
in
model
.
actions
]
actions_str
=
self
.
maude
.
operators
(
actions
,
[],
"
Action
"
,
[
"
ctor
"
])
# automata label
names
=
[
automaton
.
name
for
automaton
in
model
.
automata
]
names_str
=
self
.
maude
.
operators
(
names
,
[],
"
Agent
"
,
[
"
ctor
"
])
# clocks
clocks
=
[
clock
for
clock
in
model
.
clocks
]
clocks_str
=
self
.
maude
.
operators
(
clocks
,
[],
"
Clock
"
,
[
"
ctor
"
])
# parameters
parameters
=
[
param
for
param
in
model
.
parameters
]
parameters_str
=
self
.
maude
.
operators
(
parameters
,
[],
"
Parameter
"
,
[
"
ctor
"
])
preamble
=
f
"""
{
locations_str
}
{
actions_str
}
{
names_str
}
{
clocks_str
}
{
parameters_str
}
"""
return
preamble
def
_get_search_cmd
(
self
)
->
str
:
return
""
...
...
This diff is collapsed.
Click to expand it.
pta2maude/tests/examples/coffee-intrpr.maude
+
15
−
15
View file @
f9591485
load Semantics .
mod
COFFEE
is
mod
MODEL
is
extending DYNAMICS .
ops idle
add
sugar
preparing
done
: -> Location [ctor] .
ops
bstart bsugar cu
p coffee
sleep
: -> Action [ctor] .
ops
coffee
: -> Agent [ctor] .
ops x
1 x2
: -> Clock [ctor] .
ops idle sugar
coffee c
done : -> Location [ctor] .
ops
press cup slee
p coffee : -> Action [ctor] .
ops
machine
: -> Agent [ctor] .
ops x
y
: -> Clock [ctor] .
ops p1 p2 p3 : -> Parameter [ctor] .
op Coffee : -> Automaton .
eq Coffee = < coffee @ idle | (@ idle inv True :
(when True local bstart do { x
1
:= 0 ;
x2
:= 0 } goto addsugar)),
(@ addsugar inv
x2
<= p2 :
(when p1 <= x
1
local bsugar do { x
1
:= 0 } goto addsugar ;
when
x2
= p2 local cup goto preparing)),
(@ preparing inv
x2
<= p3 :
(when
x2
= p3 local coffee do { x
1
:= 0 } goto done)) ,
(@ done inv x
1
<= c(10) :
(when x
1
= c(10) local sleep goto idle ;
when True local bstart do { x
1
:= 0 ;
x2
:= 0 } goto addsugar))
(when True local bstart do { x := 0 ;
y
:= 0 } goto addsugar)),
(@ addsugar inv
y
<= p2 :
(when p1 <= x local bsugar do { x := 0 } goto addsugar ;
when
y
= p2 local cup goto preparing)),
(@ preparing inv
y
<= p3 :
(when
y
= p3 local coffee do { x := 0 } goto done)) ,
(@ done inv x <= c(10) :
(when x = c(10) local sleep goto idle ;
when True local bstart do { x := 0 ;
y
:= 0 } goto addsugar))
> .
op init : -> State .
eq init = { Coffee }
< tick: tickOk
clocks: (x
1
: 0/1,
x2
: 0/1)
clocks: (x : 0/1,
y
: 0/1)
parameters: (p1 : 1, p2 : 1, p3 : 1)
dvariables: empty >
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment