Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
5cf9df2c
Commit
5cf9df2c
authored
Mar 31, 2017
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New functions [production_index] and [find_production] in the incremental API.
parent
16c5fbe7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
4 deletions
+30
-4
TODO
TODO
+1
-2
src/Engine.ml
src/Engine.ml
+3
-2
src/EngineTypes.ml
src/EngineTypes.ml
+3
-0
src/IncrementalEngine.ml
src/IncrementalEngine.ml
+7
-0
src/TableInterpreter.ml
src/TableInterpreter.ml
+13
-0
src/referenceInterpreter.ml
src/referenceInterpreter.ml
+3
-0
No files found.
TODO
View file @
5cf9df2c
...
...
@@ -19,6 +19,7 @@
force_reduction
input_needed
feed (inspection API)
production numbers (production_index, find_production)
menhirLib: possibly incompatible change of type 'a env
* Implementing may_reduce by looping over the action table may be too
...
...
@@ -50,14 +51,12 @@
allows exposing current state even when it is an initial state?
meta-initial state with transition to the real initial states?
remonter aussi la fonction element: 'a checkpoint -> int -> element de CompCert
ajouter la bijection entre production et int (i2p, p2i)
* Suite des patchs de Frédéric Bour.
API d'inspection complète.
Documenter loop_handle_undo, loop_test (let it just return an option), acceptable.
Exposer le nombre d'états (pour la mémoisation).
Idem pour les productions.
Fonctions d'affichage pour les types terminal, nonterminal, etc.?
Fonctions d'isomorphisme entre token et 'a terminal * 'a?
* BUG: the warning "this production is never reduced" is sound but incomplete.
...
...
src/Engine.ml
View file @
5cf9df2c
...
...
@@ -23,8 +23,9 @@ open EngineTypes
module
Make
(
T
:
TABLE
)
=
struct
(* This propagates type and exception definitions. The function [number],
too, is defined by this [include] declaration. *)
(* This propagates type and exception definitions. The functions [number],
[production_index], [find_production], too, are defined by this [include]
declaration. *)
include
T
...
...
src/EngineTypes.ml
View file @
5cf9df2c
...
...
@@ -142,6 +142,9 @@ module type TABLE = sig
type
production
val
production_index
:
production
->
int
val
find_production
:
int
->
production
(* If a state [s] has a default reduction on production [prod], then, upon
entering [s], the automaton should reduce [prod] without consulting the
lookahead token. The following function allows determining which states
...
...
src/IncrementalEngine.ml
View file @
5cf9df2c
...
...
@@ -226,6 +226,13 @@ module type INCREMENTAL_ENGINE = sig
val
number
:
_
lr1state
->
int
(* Productions are numbered. *)
(* [find_production i] requires the index [i] to be valid. Use with care. *)
val
production_index
:
production
->
int
val
find_production
:
int
->
production
(* [find_default_reduction s] returns [Some prod] if the state [s] has a
default reduction of production [prod], and returns [None] otherwise. *)
...
...
src/TableInterpreter.ml
View file @
5cf9df2c
...
...
@@ -65,6 +65,19 @@ module MakeEngineTable (T : TableFormat.TABLES) = struct
type
production
=
int
(* In principle, only non-start productions are exposed to the user,
at type [production] or at type [int]. This is checked dynamically. *)
let
non_start_production
i
=
assert
(
T
.
start
<=
i
&&
i
-
T
.
start
<
Array
.
length
T
.
semantic_action
)
let
production_index
i
=
non_start_production
i
;
i
let
find_production
i
=
non_start_production
i
;
i
let
default_reduction
state
defred
nodefred
env
=
let
code
=
PackedIntArray
.
get
T
.
default_reduction
state
in
if
code
=
0
then
...
...
src/referenceInterpreter.ml
View file @
5cf9df2c
...
...
@@ -57,6 +57,9 @@ module T = struct
type
production
=
Production
.
index
let
production_index
=
Production
.
p2i
let
find_production
=
Production
.
i2p
let
default_reduction
(
s
:
state
)
defred
nodefred
env
=
match
Invariant
.
has_default_reduction
s
with
|
Some
(
prod
,
_
)
->
...
...
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