summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/ast.ml4
-rw-r--r--frontend/parser.mly1
-rw-r--r--frontend/typing.ml11
3 files changed, 3 insertions, 13 deletions
diff --git a/frontend/ast.ml b/frontend/ast.ml
index c561cef..d55626d 100644
--- a/frontend/ast.ml
+++ b/frontend/ast.ml
@@ -69,10 +69,6 @@ and state = {
st_locals : var_def list;
body : eqn ext list;
until : transition list;
- (* these two rst info are determined after parsing, in typing.ml when
- the variable list is extracted *)
- mutable i_rst : bool; (* resettable by S -> S transition *)
- mutable o_rst : bool; (* resettable by S' -> S transition *)
}
and transition = (expr ext) * (id ext) * bool (* bool : does it reset ? *)
diff --git a/frontend/parser.mly b/frontend/parser.mly
index 672bb9a..e8a6ecf 100644
--- a/frontend/parser.mly
+++ b/frontend/parser.mly
@@ -126,7 +126,6 @@ state:
st_locals = v;
body = b;
until = until;
- i_rst = false; o_rst = false; (* calculated later *)
} }
trans(TT):
diff --git a/frontend/typing.ml b/frontend/typing.ml
index d814bbe..883e8e0 100644
--- a/frontend/typing.ml
+++ b/frontend/typing.ml
@@ -178,17 +178,12 @@ let rec extract_all_vars rp (node, prefix, eqs) n_vars =
vars_of_expr c @ do_branch a @ do_branch b
in do_branch b
| AST_automaton (aid, states, ret) ->
- (* Determine which states can be reset *)
- let rst_trans = List.flatten
+ let rst_states = List.flatten
(List.map (fun (st, _) ->
- List.map (fun (_, (id, _), _) -> (st.st_name, id))
+ List.map (fun (_, (id, _), _) -> id)
(List.filter (fun (_, _, rst) -> rst) st.until))
states)
in
- List.iter (fun (st, _) ->
- st.i_rst <- List.mem (st.st_name, st.st_name) rst_trans;
- st.o_rst <- List.exists (fun (a, b) -> b = st.st_name && a <> b) rst_trans)
- states;
let do_state (st, _) =
let tvars =
@@ -197,7 +192,7 @@ let rec extract_all_vars rp (node, prefix, eqs) n_vars =
in
let st_scope = (node, aid^"."^st.st_name^".", st.body) in
let svars = vars_in_node node st.st_locals in
- (if st.i_rst || st.o_rst then
+ (if List.mem st.st_name rst_states then
[false, node^"/"^aid^"."^st.st_name^".must_reset", bool_type]
else [])
@ svars @ tvars @ clock_vars rp st_scope @