Commit e518bc58 authored by POTTIER Francois's avatar POTTIER Francois

Removed a special case in the table back-end for productions that are never reduced.

We now treat them normally and generate code for them in the semantic action table.
This is important because they could be reduced via the inspection API;
see the function [force_reduction] in [IncrementalEngine].
parent 7ac08f52
......@@ -288,37 +288,20 @@ let semantic_action prod =
EFun (
[ PVar env ],
if Invariant.ever_reduced prod then
(* Access the stack and current state via the environment. *)
(* Access the stack and current state via the environment. *)
(* In fact, the current state needs be bound here only if this is
an epsilon production. Otherwise, the variable [state] will be
bound by the pattern produced by [reducecellparams] above. *)
(* In fact, the current state needs be bound here only if this is
an epsilon production. Otherwise, the variable [state] will be
bound by the pattern produced by [reducecellparams] above. *)
ELet (
ELet (
[ PVar stack, ERecordAccess (EVar env, fstack) ] @
(if Production.length prod = 0 then [ PVar state, ERecordAccess (EVar env, fcurrent) ] else []),
[ PVar stack, ERecordAccess (EVar env, fstack) ] @
(if Production.length prod = 0 then [ PVar state, ERecordAccess (EVar env, fcurrent) ] else []),
(* Then, *)
reducebody prod
)
else
(* For productions that are never reduced, generate no code. *)
(* We do this mainly because [Invariant.prodstack] does not
support productions that are never reduced. *)
EComment (
"a production never reduced",
EApp (EVar "assert", [ EData ("false", []) ])
)
reducebody prod
)
)
(* Export the number of start productions. *)
......
Markdown is supported
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