Commit b277b7f8 authored by POTTIER Francois's avatar POTTIER Francois

Removed the analysis [MINIMAL] and moved [CompletedNatWitness] and [Seq] to the attic.

parent 618dbcfd
(* See the commit entitled:
Removed the analysis [MINIMAL] and moved [CompletedNatWitness] and [Seq] to the attic.
*)
(* ------------------------------------------------------------------------ *)
(* For every nonterminal symbol [nt], compute a word of minimal length
generated by [nt]. This analysis subsumes [NONEMPTY] and [NULLABLE].
Indeed, [nt] produces a nonempty language if only if the minimal length is
finite; [nt] is nullable if only if the minimal length is zero. *)
(* This analysis is in principle more costly than the [NONEMPTY] and
[NULLABLE], so it is performed only on demand. In practice, it seems
to be very cheap: its cost is not measurable for any of the grammars
in our benchmark suite. *)
module MINIMAL =
GenericAnalysis
(struct
include CompletedNatWitness
type property = Terminal.t t
end)
(struct
open CompletedNatWitness
(* A terminal symbol has length 1. *)
let terminal = singleton
(* The length of an alternative is the minimum length of any branch. *)
let disjunction = min_lazy
(* The length of a sequence is the sum of the lengths of the members. *)
let conjunction _ = add_lazy
(* The epsilon sequence has length 0. *)
let epsilon = epsilon
end)
let () =
Error.logG 2 (fun f ->
for nt = Nonterminal.start to Nonterminal.n - 1 do
Printf.fprintf f "minimal(%s) = %s\n"
(Nonterminal.print false nt)
(CompletedNatWitness.print Terminal.print (MINIMAL.nonterminal nt))
done
)
......@@ -1119,35 +1119,6 @@ let () =
"%s generates the empty language." (Nonterminal.print false nt);
done
(* ------------------------------------------------------------------------ *)
(* For every nonterminal symbol [nt], compute a word of minimal length
generated by [nt]. This analysis subsumes [NONEMPTY] and [NULLABLE].
Indeed, [nt] produces a nonempty language if only if the minimal length is
finite; [nt] is nullable if only if the minimal length is zero. *)
(* This analysis is in principle more costly than the [NONEMPTY] and
[NULLABLE], so it is performed only on demand. In practice, it seems
to be very cheap: its cost is not measurable for any of the grammars
in our benchmark suite. *)
module MINIMAL =
GenericAnalysis
(struct
include CompletedNatWitness
type property = Terminal.t t
end)
(struct
open CompletedNatWitness
(* A terminal symbol has length 1. *)
let terminal = singleton
(* The length of an alternative is the minimum length of any branch. *)
let disjunction = min_lazy
(* The length of a sequence is the sum of the lengths of the members. *)
let conjunction _ = add_lazy
(* The epsilon sequence has length 0. *)
let epsilon = epsilon
end)
(* ------------------------------------------------------------------------ *)
(* Dump the analysis results. *)
......@@ -1162,11 +1133,6 @@ let () =
Printf.fprintf f "first(%s) = %s\n"
(Nonterminal.print false nt)
(TerminalSet.print (FIRST.nonterminal nt))
done;
for nt = Nonterminal.start to Nonterminal.n - 1 do
Printf.fprintf f "minimal(%s) = %s\n"
(Nonterminal.print false nt)
(CompletedNatWitness.print Terminal.print (MINIMAL.nonterminal nt))
done
)
......@@ -1449,9 +1415,6 @@ module Analysis = struct
let follow = follow
let minimal_symbol = MINIMAL.symbol
let minimal_prod = MINIMAL.production
end
(* ------------------------------------------------------------------------ *)
......
......@@ -438,17 +438,6 @@ module Analysis : sig
val follow: Nonterminal.t -> TerminalSet.t
(* [minimal_symbol sym] is the minimal length of a word generated by
the symbol [sym]. *)
val minimal_symbol: Symbol.t -> Terminal.t CompletedNatWitness.t
(* [minimal_prod prod i] is the minimal length of a word generated
by [prod/i], i.e., the suffix of production [prod] defined by
offset [i]. *)
val minimal_prod: Production.index -> int -> Terminal.t CompletedNatWitness.t
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