Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
5a9d6760
Commit
5a9d6760
authored
Jan 08, 2015
by
POTTIER Francois
Browse files
Removed the old encoding of [lr0_items].
parent
1c37e833
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/tableBackend.ml
View file @
5a9d6760
...
...
@@ -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_items
2
"
,
"lr0_items"
,
linearize_and_marshal1
items
)
...
...
@@ -1051,7 +1035,6 @@ let program =
rhs
()
::
lr0_core
()
::
lr0_items
()
::
lr0_items2
()
::
[]
)
::
[]
...
...
src/tableFormat.ml
View file @
5a9d6760
...
...
@@ -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
src/tableInterpreter.ml
View file @
5a9d6760
...
...
@@ -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 shar
e co
de wi
th [
rh
s] ab
ove
*)
let
(
data
,
entry
)
=
T
.
lr0_items
2
in
(*
Now us
e
[
co
re] to look up
th
e
[
lr0_item
s]
t
ab
le.
*)
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment