blob: 07874fb2b9c8e8dd118c700f345a38456ff2ef5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
|