Commit 9341e786 authored by POTTIER Francois's avatar POTTIER Francois

Removed some more uses of [lazy].

parent a9857feb
......@@ -53,7 +53,7 @@ let until_finite p1 p2 =
| Finite _ ->
p1
| Infinity ->
Lazy.force p2
p2()
let add p1 p2 =
match p1, p2 with
......
......@@ -16,6 +16,6 @@ val add: t -> t -> t
val min_lazy: t -> (unit -> t) -> t
val add_lazy: t -> (unit -> t) -> t
val until_finite: t -> t Lazy.t -> t
val until_finite: t -> (unit -> t) -> t
val print: t -> string
......@@ -57,7 +57,7 @@ let until_finite p1 p2 =
| Finite _ ->
p1
| Infinity ->
Lazy.force p2
p2()
let add p1 p2 =
match p1, p2 with
......
......@@ -21,6 +21,6 @@ val add: 'a t -> 'a t -> 'a t
val min_lazy: 'a t -> (unit -> 'a t) -> 'a t
val add_lazy: 'a t -> (unit -> 'a t) -> 'a t
val until_finite: 'a t -> 'a t Lazy.t -> 'a t
val until_finite: 'a t -> (unit -> 'a t) -> 'a t
val print: ('a -> string) -> 'a t -> string
......@@ -77,21 +77,18 @@ let first prod i z =
let foreach_terminal (f : Terminal.t -> property) : property =
Terminal.fold (fun t accu ->
(* A feeble attempt at being slightly lazy. Not essential. *)
P.min_lazy accu (fun () -> f t)
) P.bottom
let foreach_terminal_in toks (f : Terminal.t -> property) : property =
TerminalSet.fold (fun t accu ->
(* A feeble attempt at being slightly lazy. Not essential. *)
P.min_lazy accu (fun () -> f t)
) toks P.bottom
let foreach_terminal_until_finite (f : Terminal.t -> property) : property =
Terminal.fold (fun t accu ->
(* Here, laziness is important. We stop as soon as we obtain a
finite result. *)
P.until_finite accu (lazy (f t))
(* We stop as soon as we obtain a finite result. *)
P.until_finite accu (fun () -> f t)
) P.bottom
(* This computes a minimum over the productions associated with [nt]. *)
......@@ -338,7 +335,7 @@ let backward s' : property =
accu
else
P.until_finite accu (lazy (
P.until_finite accu (fun () ->
Printf.fprintf stderr
"Attempting to go from state %d to an error in state %d:\n%!"
......@@ -351,7 +348,7 @@ let backward s' : property =
P.bottom
)
))
)
) P.bottom
(* Test. *)
......
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