diff options
Diffstat (limited to 'ocaml/scripts/show_pill.ml')
| -rw-r--r-- | ocaml/scripts/show_pill.ml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ocaml/scripts/show_pill.ml b/ocaml/scripts/show_pill.ml new file mode 100644 index 0000000..07874fb --- /dev/null +++ b/ocaml/scripts/show_pill.ml @@ -0,0 +1,18 @@ +open Nock_lib + +let rec show noun depth limit = + if depth = 0 || limit = 0 then "..." + else match noun with + | Noun.Atom z -> Z.to_string z + | Noun.Cell (h, t) -> + Printf.sprintf "[%s %s]" (show h (depth-1) (limit-1)) (show t (depth-1) (limit-1)) + +let () = + if Array.length Sys.argv < 2 then exit 1; + let path = Sys.argv.(1) in + let ic = open_in_bin path in + let len = in_channel_length ic in + let data = really_input_string ic len in + close_in ic; + let noun = Serial.cue (Bytes.of_string data) in + Printf.printf "structure=%s\n" (show noun 6 100) |
