Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
7d8b7d27
Commit
7d8b7d27
authored
Sep 29, 2015
by
POTTIER Francois
Browse files
Added [has_default_reduction] to the incremental API.
parent
09e5937e
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
7d8b7d27
2015/09/29:
Added [has_default_reduction] to the incremental API.
2015/09/25:
Modified the meaning of --canonical to allow default reductions to take
place. There implies no loss of precision in terms of lookahead sets,
...
...
doc/main.tex
View file @
7d8b7d27
...
...
@@ -2145,6 +2145,18 @@ current lookahead token. It is legal to invoke this function only after at
least one token has been offered to the parser via
\verb
+
offer
+
. In other
words, it is illegal to invoke it in an initial state.
%% val has_default_reduction
\begin{verbatim}
val has
_
default
_
reduction: env -> bool
\end{verbatim}
The function
\verb
+
has_default_reduction
+
tells whether the parser is about to perform a default reduction.
In particular, when applied to an environment
\verb
+
env
+
taken from a result of
the form
\verb
+
AboutToReduce (env, prod)
+
, it tells whether the reduction
that is about to take place is a default reduction.
% ------------------------------------------------------------------------------
\subsection
{
Inspection API
}
...
...
src/IncrementalEngine.ml
View file @
7d8b7d27
...
...
@@ -100,6 +100,13 @@ module type INCREMENTAL_ENGINE = sig
val
positions
:
env
->
Lexing
.
position
*
Lexing
.
position
(* This tells whether the parser is about to perform a default reduction.
In particular, when applied to an environment taken from a result of
the form [AboutToReduce (env, prod)], this tells whether the reduction
that is about to take place is a default reduction. *)
val
has_default_reduction
:
env
->
bool
end
(* This signature is a fragment of the inspection API that is made available
...
...
src/engine.ml
View file @
7d8b7d27
...
...
@@ -577,5 +577,19 @@ module Make (T : TABLE) = struct
assert
(
startp
!=
dummy_pos
&&
endp
!=
dummy_pos
);
startp
,
endp
(* --------------------------------------------------------------------------- *)
(* Access to information about default reductions. *)
(* We can make this a function of states, or a function of environments. For
now, the latter appears simpler. *)
let
has_default_reduction
env
:
bool
=
T
.
default_reduction
env
.
current
(
fun
_env
_prod
->
true
)
(
fun
_env
->
false
)
env
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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