Commit 6978b22a authored by POTTIER Francois's avatar POTTIER Francois Committed by POTTIER Francois

New function [Lr0.reductions_table].

parent e386eb24
......@@ -630,3 +630,8 @@ let add_reduction prod tok reductions =
let add_reductions prod toks reductions =
TerminalSet.fold (add_reduction prod) toks reductions
let reductions_table state =
List.fold_left (fun reductions (toks, prod) ->
add_reductions prod toks reductions
) TerminalMap.empty (reductions state)
......@@ -80,11 +80,15 @@ val core: lr1state -> node
val start: node -> lr1state
(* Information about the transitions and reductions at a state. *)
(* Information about the transitions at a state. *)
val transitions: lr1state -> lr1state SymbolMap.t
val transition: Symbol.t -> lr1state -> lr1state
(* Information about the reductions at a state. *)
(* See also [reductions_table] further on. *)
val reductions: lr1state -> (TerminalSet.t * Production.index) list
(* Equality of states. The two states must have the same core. Then,
......@@ -155,3 +159,7 @@ val add_reduction: Production.index -> Terminal.t -> reductions -> reductions
token in the set [toks] to the table [reductions]. *)
val add_reductions: Production.index -> TerminalSet.t -> reductions -> reductions
(* A table of the reductions at a state. *)
val reductions_table: lr1state -> reductions
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