Commit 3ca15e38 authored by POTTIER Francois's avatar POTTIER Francois

Moved [Printers] and [ErrorReporting] into [MenhirLib].

parent 707da3ac
......@@ -78,19 +78,21 @@ DISTRIBUTED_FILES := AUTHORS CHANGES INSTALLATION LICENSE Makefile demos
LIBFILES := \
src/standard.mly \
src/infiniteArray.{ml,mli} \
src/LinearizedArray.{ml,mli} \
src/packedIntArray.{ml,mli} \
src/rowDisplacement.{ml,mli} \
src/IncrementalEngine.ml \
src/engineTypes.ml \
src/convert.{ml,mli} \
src/engine.{ml,mli} \
src/engineTypes.ml \
src/ErrorReporting.{ml,mli} \
src/general.{ml,mli} \
src/IncrementalEngine.ml \
src/infiniteArray.{ml,mli} \
src/inspectionTableFormat.ml \
src/inspectionTableInterpreter.{ml,mli} \
src/LinearizedArray.{ml,mli} \
src/packedIntArray.{ml,mli} \
src/Printers.{ml,mli} \
src/rowDisplacement.{ml,mli}\
src/tableFormat.ml \
src/tableInterpreter.{ml,mli} \
src/convert.{ml,mli}
src/tableInterpreter.{ml,mli}
package: clean
# Create a directory to store the distributed files temporarily.
......
In the following, "the Library" refers to the following files:
src/standard.mly
src/convert.{ml,mli}
src/engine.{ml,mli}
src/engineTypes.ml
src/ErrorReporting.{ml,mli}
src/general.{ml,mli}
src/IncrementalEngine.ml
src/infiniteArray.{ml,mli}
src/inspectionTableFormat.ml
src/inspectionTableInterpreter.{ml,mli}
src/LinearizedArray.{ml,mli}
src/packedIntArray.{ml,mli}
src/Printers.{ml,mli}
src/rowDisplacement.{ml,mli}
src/IncrementalEngine.ml
src/engineTypes.ml
src/engine.{ml,mli}
src/inspectionTableFormat.ml
src/inspectionTableInterpreter.{ml,mli}
src/tableFormat.ml
src/tableInterpreter.{ml,mli}
src/convert.{ml,mli}
src/general.{ml,mli}
while "the Generator" refers to all other files in this archive.
......
......@@ -38,6 +38,8 @@
Possibilité de coloriser ce qu'on a lu en indiquant ce qu'on a compris
(sortie HTML).
* Could we avoid listing the contents of MenhirLib in 4 different files?
* bundle the Coq library with menhir, and add demos/calc-coq
to show how it is used
......
......@@ -94,14 +94,14 @@ let print_element e : string =
(* TEMPORARY comment *)
module P =
Printers.Make (Parser.MenhirInterpreter) (struct
MenhirLib.Printers.Make (Parser.MenhirInterpreter) (struct
let print s = Printf.fprintf stderr "%s" s
let print_symbol s = print (print_symbol s)
let print_element = Some (fun s -> print (print_element s))
end)
module E =
ErrorReporting.Make(Parser.MenhirInterpreter) (struct
MenhirLib.ErrorReporting.Make(Parser.MenhirInterpreter) (struct
let terminal2token = terminal2token
end)
......
......@@ -1956,6 +1956,7 @@ near future.
% TEMPORARY symbol
% TEMPORARY document the inspection API
% document the modules that use the inspection API: Printers, ErrorReporting
% The directory \distrib{demos/calc-inspection} contains a demo that illustrates the use of the inspection API.
% ---------------------------------------------------------------------------------------------------------------------
......
module Make
(I : MenhirLib.IncrementalEngine.EVERYTHING)
(I : IncrementalEngine.EVERYTHING)
(User : sig
(* In order to submit artificial tokens to the parser, we need a function
......@@ -12,7 +12,7 @@ module Make
end)
= struct
open MenhirLib.General
open General
open I
open User
......@@ -92,7 +92,7 @@ module Make
List.fold_left (fun explanations item ->
test_shift_item t item @ explanations
) explanations (items_current env)
| AboutToReduce (_, prod) ->
| AboutToReduce _ ->
(* The parser wishes to reduce. Just follow. *)
investigate t (resume result) explanations
| HandlingError _ ->
......@@ -138,10 +138,11 @@ module Make
and endp = lexbuf.Lexing.lex_curr_p in
token, startp, endp
(* The following is a custom version of the loop found in [MenhirLib.Engine].
It drives the parser in the usual way, but keeps a checkpoint, which is
the last [InputNeeded] result. If a syntax error is detected, it goes back
to this state and analyzes it in order to produce a meaningful diagnostic. *)
(* The following is a custom version of the loop found in [Engine]. It
drives the parser in the usual way, but keeps a checkpoint, which is the
last [InputNeeded] result. If a syntax error is detected, it goes back to
this state and analyzes it in order to produce a meaningful
diagnostic. *)
exception Error of explanations
......@@ -154,7 +155,7 @@ module Make
let rec loop (read : reader) ({ checkpoint; current } : 'a result) : 'a =
match current with
| InputNeeded env ->
| InputNeeded _ ->
(* Update the checkpoint. *)
let checkpoint = current in
let triple = read() in
......
(* This module is part of MenhirLib. *)
module Make
(I : MenhirLib.IncrementalEngine.EVERYTHING)
(I : IncrementalEngine.EVERYTHING)
(User : sig
(* In order to submit artificial tokens to the parser, we need a function
......
module Make
(I : MenhirLib.IncrementalEngine.EVERYTHING)
(I : IncrementalEngine.EVERYTHING)
(User : sig
val print: string -> unit
val print_symbol: I.xsymbol -> unit
......@@ -56,7 +56,7 @@ module Make
(* Printing a stack as a list of symbols. *)
let print_stack stack =
MenhirLib.General.foldr (fun element () ->
General.foldr (fun element () ->
print_element element;
print space
) stack ();
......@@ -85,10 +85,10 @@ module Make
let print_current_state env =
print "Current LR(1) state: ";
match Lazy.force (stack env) with
| MenhirLib.General.Nil ->
| General.Nil ->
print "<some initial state>";
print newline
| MenhirLib.General.Cons (Element (current, _, _, _), _) ->
| General.Cons (Element (current, _, _, _), _) ->
print (string_of_int (Obj.magic current)); (* TEMPORARY safe conversion needed *)
print newline;
List.iter print_item (items current)
......
(* This module is part of MenhirLib. *)
module Make
(I : MenhirLib.IncrementalEngine.EVERYTHING)
(I : IncrementalEngine.EVERYTHING)
(User : sig
......
......@@ -19,16 +19,18 @@
# If you change this list, please also update the files LICENSE
# and GNUmakefile in the toplevel directory, and update the file
# menhirLib.mlpack in this directory.
<convert.cmx>: for-pack(MenhirLib)
<engine.cmx>: for-pack(MenhirLib)
<engineTypes.cmx>: for-pack(MenhirLib)
<ErrorReporting.cmx>: for-pack(MenhirLib)
<general.cmx>: for-pack(MenhirLib)
<IncrementalEngine.cmx>: for-pack(MenhirLib)
<infiniteArray.cmx>: for-pack(MenhirLib)
<inspectionTableFormat.cmx>: for-pack(MenhirLib)
<inspectionTableInterpreter.cmx>: for-pack(MenhirLib)
<LinearizedArray.cmx>: for-pack(MenhirLib)
<packedIntArray.cmx>: for-pack(MenhirLib)
<Printers.cmx>: for-pack(MenhirLib)
<rowDisplacement.cmx>: for-pack(MenhirLib)
<IncrementalEngine.cmx>: for-pack(MenhirLib)
<engineTypes.cmx>: for-pack(MenhirLib)
<engine.cmx>: for-pack(MenhirLib)
<inspectionTableFormat.cmx>: for-pack(MenhirLib)
<inspectionTableInterpreter.cmx>: for-pack(MenhirLib)
<tableFormat.cmx>: for-pack(MenhirLib)
<tableInterpreter.cmx>: for-pack(MenhirLib)
<convert.cmx>: for-pack(MenhirLib)
<general.cmx>: for-pack(MenhirLib)
# If you change this list, please also update the files LICENSE
# and GNUmakefile in the toplevel directory, and update the file
# _tags in this directory.
InfiniteArray
LinearizedArray
PackedIntArray
RowDisplacement
Convert
Engine
EngineTypes
ErrorReporting
General
IncrementalEngine
EngineTypes
Engine
InfiniteArray
InspectionTableFormat
InspectionTableInterpreter
LinearizedArray
PackedIntArray
Printers
RowDisplacement
TableFormat
TableInterpreter
Convert
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