Commit 16dc78d0 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Define [print_stack_symbols].

parent 63af26b3
......@@ -57,3 +57,16 @@ let stack_symbols (node : Lr1.node) : Symbol.t array =
let () =
Time.tick "Computing stack symbols"
(* Printing. *)
let buffer =
Buffer.create 1024
let print_stack_symbols node =
stack_symbols node |> Array.iter (fun symbol ->
Printf.bprintf buffer " %s" (Symbol.print symbol)
);
let s = Buffer.contents buffer in
Buffer.clear buffer;
s
......@@ -21,3 +21,9 @@ open Grammar
the stack is the end of the array. *)
val stack_symbols: Lr1.node -> Symbol.t array
(* [print_stack_symbols s] is a printed representation of the known
prefix of the stack at state [s]. Every symbol is preceded with
a space. *)
val print_stack_symbols: Lr1.node -> string
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