Commit fe033df0 authored by POTTIER Francois's avatar POTTIER Francois

Split the functor [TableInterpreter.Make] into a composition

of the functors [TableInterpreter.MakeEngineTable] and [Engine.Make].
This should be easier to understand and more flexible.
parent 7296f579
......@@ -11,9 +11,7 @@
(* *)
(******************************************************************************)
module Make (T : TableFormat.TABLES)
= Engine.Make (struct
module MakeEngineTable (T : TableFormat.TABLES) = struct
type state =
int
......@@ -229,4 +227,4 @@ module Make (T : TableFormat.TABLES)
end
end)
end
......@@ -11,8 +11,9 @@
(* *)
(******************************************************************************)
(* This module instantiates the generic [Engine] with a thin decoding layer
for the generated tables. Like [Engine], it is part of [MenhirLib]. *)
(* This module provides a thin decoding layer for the generated tables, thus
providing an API that is suitable for use by [Engine.Make]. It is part of
[MenhirLib]. *)
(* The exception [Error] is declared within the generated parser. This is
preferable to pre-declaring it here, as it ensures that each parser gets
......@@ -21,10 +22,10 @@
(* This functor is invoked by the generated parser. *)
module Make (T : TableFormat.TABLES)
: EngineTypes.ENGINE with type state = int
and type token = T.token
and type semantic_value = Obj.t
and type production = int
module MakeEngineTable
(T : TableFormat.TABLES)
: EngineTypes.TABLE
with type state = int
and type token = T.token
and type semantic_value = Obj.t
and type production = int
......@@ -29,8 +29,11 @@ module Run (T : sig end) = struct
let menhirlib =
"MenhirLib"
let make_engine_table =
menhirlib ^ ".TableInterpreter.MakeEngineTable"
let make_engine =
menhirlib ^ ".TableInterpreter.Make"
menhirlib ^ ".Engine.Make"
let make_symbol =
menhirlib ^ ".InspectionTableInterpreter.Symbols"
......@@ -82,6 +85,9 @@ let tables =
let symbols =
"Symbols"
let et =
"ET"
let ti =
"TI"
......@@ -1038,8 +1044,10 @@ let program =
SIModuleDef (interpreter, MStruct (
(* Apply the functor [TableInterpreter.Make] to the tables. *)
SIModuleDef (ti, MApp (MVar make_engine, MVar tables)) ::
(* Apply the functor [TableInterpreter.MakeEngineTable] to the tables. *)
SIModuleDef (et, MApp (MVar make_engine_table, MVar tables)) ::
(* Apply the functor [Engine.Make] to obtain an engine. *)
SIModuleDef (ti, MApp (MVar make_engine, MVar et)) ::
SIInclude (MVar ti) ::
listiflazy Settings.inspection (fun () ->
......
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