Commit 5a9d6760 authored by POTTIER Francois's avatar POTTIER Francois

Removed the old encoding of [lr0_items].

parent 1c37e833
......@@ -915,23 +915,7 @@ let lr0_core () =
(* A table that maps an LR(0) state to a set of LR(0) items. *)
let encode_lr0_item item =
EIntConst (Item.marshal item)
let lr0_items () =
assert Settings.inspection;
define_and_measure (
"lr0_items",
EArray (Array.to_list (Array.init Lr0.n (fun (node : Lr0.node) ->
elist (List.map encode_lr0_item (Item.Set.elements (Lr0.items node)))
)))
)
(* TEMPORARY these lists share suffixes, which in principle could be
physically shared. Or perhaps we could use some form of packed
array? *)
let lr0_items2 () =
assert Settings.inspection;
let items : int array array =
Array.init Lr0.n (fun node ->
......@@ -939,7 +923,7 @@ let lr0_items2 () =
)
in
define_and_measure (
"lr0_items2",
"lr0_items",
linearize_and_marshal1 items
)
......@@ -1051,7 +1035,6 @@ let program =
rhs() ::
lr0_core() ::
lr0_items() ::
lr0_items2() ::
[]
) ::
[]
......
......@@ -147,13 +147,12 @@ module type INSPECTION_TABLES = sig
val lr0_core: PackedIntArray.t
(* A mapping of every LR(0) state to its set of LR(0) items.
Each item is represented in its packed form (see [Item])
as an integer. *)
(* A mapping of every LR(0) state to its set of LR(0) items. Each item is
represented in its packed form (see [Item]) as an integer. Thus the
mapping is an array of arrays of integers, which is linearized and
packed, like [rhs]. *)
val lr0_items: int list array
val lr0_items2: PackedIntArray.t * PackedIntArray.t
val lr0_items: PackedIntArray.t * PackedIntArray.t
end
......@@ -197,10 +197,11 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
let export t =
(t lsr 7, t mod 128)
let items2 s =
let items s =
(* Map [s] to its LR(0) core. *)
let core = PackedIntArray.get T.lr0_core s in
(* TEMPORARY share code with [rhs] above *)
let (data, entry) = T.lr0_items2 in
(* Now use [core] to look up the [lr0_items] table. *)
let (data, entry) = T.lr0_items in
let items : int list =
LinearizedArray.read_row_via
(PackedIntArray.get data)
......@@ -209,11 +210,4 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
in
List.map export items
let items s =
let core = PackedIntArray.get T.lr0_core s in
let answer1 = List.map export T.lr0_items.(core) in
let answer2 = items2 s in
assert (answer1 = answer2);
answer1
end
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