Commit c708eea4 authored by POTTIER Francois's avatar POTTIER Francois

New function [Invariant.may_reduce].

parent 3015bd68
(* invariant.mli *)
(* [may_reduce s prod] tells whether state [s] may reduce production [prod]. *)
val may_reduce: Lr1.node -> Production.index -> bool
(* invariant.ml *)
let may_reduce node prod =
Lr1.NodeSet.mem node (production_where prod)
(* tableBackend.ml *)
(* Encodings of entries in the enabled reductions bitmap. *)
......
......@@ -264,6 +264,9 @@ let production_where (prod : Production.index) : Lr1.NodeSet.t =
(* The production [prod] is never reduced. *)
Lr1.NodeSet.empty
let may_reduce node prod =
Lr1.NodeSet.mem node (production_where prod)
let ever_reduced prod =
not (Lr1.NodeSet.is_empty (production_where prod))
......@@ -929,4 +932,3 @@ let () =
let () =
if Error.errors() then
exit 1
......@@ -116,6 +116,10 @@ val errorpeeker: Lr1.node -> bool
(* ------------------------------------------------------------------------- *)
(* Information about which productions are reduced and where. *)
(* [may_reduce s prod] tells whether state [s] may reduce production [prod]. *)
val may_reduce: Lr1.node -> Production.index -> bool
(* [ever_reduced prod] tells whether production [prod] is ever reduced. *)
val ever_reduced: Production.index -> bool
......@@ -140,4 +144,3 @@ val has_default_reduction : Lr1.node -> (Production.index * TerminalSet.t) optio
outgoing transition along [symbol]. *)
val universal: Symbol.t -> bool
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