Commit 1f9d3661 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Comments in the engine. The issue with the very first call to the lexer

in the special case where the language is empty or {epsilon} is now fixed.
parent abb0189f
...@@ -8,16 +8,6 @@ ...@@ -8,16 +8,6 @@
(they need --external-tokens and --only-tokens) (they need --external-tokens and --only-tokens)
Then, one could remove Makefile.shared and ocamldep.wrapper. Then, one could remove Makefile.shared and ocamldep.wrapper.
* engine.ml: initial call to [run env true] should be [run env false]
if the initial state has a default reduction on #
i.e. if only the empty word is accepted!
I think currently the code back-end is OK
and the table back-end is wrong (void.mly)
in theory, [entry] in [engine.ml]
should be parameterized by [please_discard]
which should be [false] iff the initial state
has a default reduction on #
* Changes that could be applied to the code back-end: * Changes that could be applied to the code back-end:
[action] could now be inlined into [run] [action] could now be inlined into [run]
[initiate] and [bookkeeping] could be merged? [initiate] and [bookkeeping] could be merged?
......
...@@ -959,7 +959,7 @@ let runpushcellunless shiftreduce s e = ...@@ -959,7 +959,7 @@ let runpushcellunless shiftreduce s e =
invoke the lexer, so the [run] function for an initial state must invoke the lexer, so the [run] function for an initial state must
do it. (Except in the very special case where the initial state do it. (Except in the very special case where the initial state
has a default reduction on [#] -- this means the grammar recognizes has a default reduction on [#] -- this means the grammar recognizes
only the empty word.) *) only the empty word. We have ruled out this case.) *)
let gettoken s defred e = let gettoken s defred e =
match Lr1.incoming_symbol s, defred with match Lr1.incoming_symbol s, defred with
......
...@@ -343,10 +343,12 @@ module Make (T : TABLE) = struct ...@@ -343,10 +343,12 @@ module Make (T : TABLE) = struct
(* Begin parsing. *) (* Begin parsing. *)
(* The parameter [please_discard] here is [true], which means we know
that we must read at least one token. This claim relies on the fact
that we have ruled out the two special cases where a start symbol
recognizes the empty language or the singleton language {epsilon}. *)
run env true run env true
(* TEMPORARY in principle [please_discard] here should be [false]
if the state [s] has a default reduction on [#], that is, if
this starting state accepts only the empty word. *)
(* [offer env triple] is invoked by the user in response to a result of the (* [offer env triple] is invoked by the user in response to a result of the
form [InputNeeded env]. [offer] is just a synonym for [discard]. *) form [InputNeeded env]. [offer] is just a synonym for [discard]. *)
......
Supports Markdown
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