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
3183b7f2
Commit
3183b7f2
authored
Oct 19, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added [acceptable].
parent
387f748a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
3 deletions
+42
-3
TODO
TODO
+1
-1
src/IncrementalEngine.ml
src/IncrementalEngine.ml
+17
-0
src/engine.ml
src/engine.ml
+24
-2
No files found.
TODO
View file @
3183b7f2
...
...
@@ -122,7 +122,7 @@
* Suite des patchs de Frédéric Bour.
API d'inspection complète.
Documenter loop_handle_undo, loop_test.
Documenter loop_handle_undo, loop_test
, acceptable
.
Exposer le nombre d'états (pour la mémoisation).
Idem pour les productions.
Fonctions d'affichage pour les types terminal, nonterminal, etc.?
...
...
src/IncrementalEngine.ml
View file @
3183b7f2
...
...
@@ -140,6 +140,23 @@ module type INCREMENTAL_ENGINE = sig
(
env
->
'
accu
->
'
accu
)
->
'
a
checkpoint
->
'
accu
->
'
accu
(* The function [loop_test] can be used, after an error has been detected, to
dynamically test which tokens would have been accepted at this point. We
provide this test, ready for use. *)
(* For completeness, one must undo any spurious reductions before carrying out
this test -- that is, one must apply [acceptable] to the FIRST checkpoint
that is passed by [loop_handle_undo] to its failure continuation. *)
(* This test causes some semantic actions to be run! The semantic actions
should be side-effect free, or their side-effects should be harmless. *)
(* The position [pos] is used as the start and end positions of the
hypothetical token, and may be picked up by the semantic actions. We
suggest using the position where the error was detected. *)
val
acceptable
:
'
a
checkpoint
->
token
->
Lexing
.
position
->
bool
(* The abstract type ['a lr1state] describes the non-initial states of the
LR(1) automaton. The index ['a] represents the type of the semantic value
associated with this state's incoming symbol. *)
...
...
src/engine.ml
View file @
3183b7f2
...
...
@@ -585,8 +585,8 @@ module Make (T : TABLE) = struct
user function [f] to the [env] just before shifting and to the old [accu].
Otherwise, the accumulator is not updated, i.e., [accu] is returned. *)
(*
It is desirable that the semantic actions be side-effect free, or that
their side-effects be harmless (replayable)
. *)
(*
This test causes some semantic actions to be run! The semantic actions
should be side-effect free, or their side-effects should be harmless
. *)
let
rec
loop_test
f
checkpoint
accu
=
match
checkpoint
with
...
...
@@ -612,6 +612,28 @@ module Make (T : TABLE) = struct
(* --------------------------------------------------------------------------- *)
(* The function [loop_test] can be used, after an error has been detected, to
dynamically test which tokens would have been accepted at this point. We
provide this test, ready for use. *)
(* For completeness, one must undo any spurious reductions before carrying out
this test -- that is, one must apply [acceptable] to the FIRST checkpoint
that is passed by [loop_handle_undo] to its failure continuation. *)
(* This test causes some semantic actions to be run! The semantic actions
should be side-effect free, or their side-effects should be harmless. *)
(* The position [pos] is used as the start and end positions of the
hypothetical token, and may be picked up by the semantic actions. We
suggest using the position where the error was detected. *)
let
acceptable
checkpoint
token
pos
=
let
triple
=
(
token
,
pos
,
pos
)
in
let
checkpoint
=
offer
checkpoint
triple
in
loop_test
(
fun
_env
_accu
->
true
)
checkpoint
false
(* --------------------------------------------------------------------------- *)
(* The type ['a lr1state] describes the (non-initial) states of the LR(1)
automaton. The index ['a] represents the type of the semantic value
associated with the state's incoming symbol. *)
...
...
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