Skip to content
Snippets Groups Projects
Commit 21aaad31 authored by Jaime Arias's avatar Jaime Arias
Browse files

replace names in the test example

parent 0002dc4e
No related branches found
No related tags found
No related merge requests found
...@@ -885,11 +885,19 @@ class InterpreterParser(Parser): ...@@ -885,11 +885,19 @@ class InterpreterParser(Parser):
label = "init" label = "init"
init_op = self.maude.operators([label], [], "State", []) init_op = self.maude.operators([label], [], "State", [])
# tick
tick = "tickOk" tick = "tickOk"
# clocks
clocks = [clock for clock in model.clocks] clocks = [clock for clock in model.clocks]
clocks_str = f"({', '.join(clocks)})" if len(clocks) else "empty" clocks_str = f"({', '.join(clocks)})" if len(clocks) else "empty"
# params
params = [param for param in model.parameters] params = [param for param in model.parameters]
params_str = f"({', '.join(params)})" if len(params) else "empty" params_str = f"({', '.join(params)})" if len(params) else "empty"
# variables
# TODO: add variables to the imitator parser (antlr)
variables = [] variables = []
vars_str = f"({', '.join(variables)})" if len(variables) else "empty" vars_str = f"({', '.join(variables)})" if len(variables) else "empty"
......
...@@ -6,20 +6,21 @@ mod MODEL is ...@@ -6,20 +6,21 @@ mod MODEL is
ops idle sugar coffee cdone : -> Location [ctor] . ops idle sugar coffee cdone : -> Location [ctor] .
ops press cup sleep coffee : -> Action [ctor] . ops press cup sleep coffee : -> Action [ctor] .
ops machine : -> Agent [ctor] . ops machine : -> Agent [ctor] .
ops x y : -> Clock [ctor] . ops x y : -> Clock [ctor] .
ops p1 p2 p3 : -> Parameter [ctor] . ops p1 p2 p3 : -> Parameter [ctor] .
op Coffee : -> Automaton . op Machine : -> Automaton .
eq Coffee = < coffee @ idle | (@ idle inv True : eq Machine = < machine @ idle |
(when True local bstart do { x := 0 ; y := 0 } goto addsugar)), (@ idle inv True :
(@ addsugar inv y <= p2 : (when True local press do { x := 0 ; y := 0 } goto sugar)),
(when p1 <= x local bsugar do { x := 0 } goto addsugar ; (@ sugar inv y <= p2 :
when y = p2 local cup goto preparing)), (when p1 <= x local press do { x := 0 } goto sugar ;
(@ preparing inv y <= p3 : when y = p2 local cup goto coffee)),
(when y = p3 local coffee do { x := 0 } goto done)) , (@ coffee inv y <= p3 :
(@ done inv x <= c(10) : (when y = p3 local coffee do { x := 0 } goto cdone)) ,
(when x = c(10) local sleep goto idle ; (@ cdone inv x <= c(10) :
when True local bstart do { x := 0 ; y := 0 } goto addsugar)) (when x = c(10) local sleep goto idle ;
when True local press do { x := 0 ; y := 0 } goto sugar))
> . > .
op init : -> State . op init : -> State .
...@@ -40,4 +41,4 @@ mod MODEL is ...@@ -40,4 +41,4 @@ mod MODEL is
endm endm
search [1] init =>* { < coffee @ done | SSTDEF > } < tick: tickNotOk clocks: CLOCKS parameters: PARAMS dvariables: DVARS > . search [1] init =>* { < machine @ cdone | SSTDEF > } < tick: tickNotOk clocks: CLOCKS parameters: PARAMS dvariables: DVARS > .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment