Commit e89868c4 authored by POTTIER Francois's avatar POTTIER Francois

Split ENGINE into MONOLITHIC_ENGINE and INCREMENTAL_ENGINE.

parent b67d60a3
......@@ -273,9 +273,11 @@ end
(* --------------------------------------------------------------------------- *)
(* This signature describes the LR engine. *)
(* This signature describes the monolithic (traditional) LR engine. *)
module type ENGINE = sig
(* In this interface, the parser controls the lexer. *)
module type MONOLITHIC_ENGINE = sig
type state
......@@ -283,10 +285,6 @@ module type ENGINE = sig
type semantic_value
(* ------------------------------------------------------------------------- *)
(* The monolithic interface, where the parser controls the lexer. *)
(* An entry point to the engine requires a start state, a lexer, and a lexing
buffer. It either succeeds and produces a semantic value, or fails and
raises [Error]. *)
......@@ -299,10 +297,22 @@ module type ENGINE = sig
Lexing.lexbuf ->
semantic_value
(* ------------------------------------------------------------------------- *)
end
(* --------------------------------------------------------------------------- *)
(* This signature describes the incremental LR engine. *)
(* In this interface, the user controls the lexer, and the parser suspends
itself when it needs to read a new token. *)
(* The incremental interface, where the user controls the lexer and the
parser suspends itself when it needs to read a new token. *)
module type INCREMENTAL_ENGINE = sig
type state
type token
type semantic_value
(* The type ['a result] represents an intermediate or final result of the
parser. An intermediate result can be thought of as a suspension: it
......@@ -374,3 +384,18 @@ module type ENGINE = sig
is obtained. *)
end
(* --------------------------------------------------------------------------- *)
(* This signature describes the LR engine, which combines the monolithic
and incremental interfaces. *)
module type ENGINE = sig
include MONOLITHIC_ENGINE
include INCREMENTAL_ENGINE
with type state := state
and type token := token
and type semantic_value := semantic_value
end
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