* [  ] is a kind of [ Sexp ] with more semantics . It is used as a principal 
     " serializable " format of [ Planet ] . 

     For example : 

     { [ ( foo { : bar # baz ( ; Comment ( text " Hello World " ) ( text ` Hello World 
     2 ` ) ) } ) ] }
    "serializable" format of [Planet].

    For example :

    {[ (foo {:bar #baz ( ; Comment (text "Hello World") (text `Hello World
    2`))}) ]} *)

open Bedrock

(** {2 Types} *)

(** Describe a quote. *)
type quote =
  | Double
  | Backtick

* Describe a [  ] expression .
type t =
  | Atom of string (** Simple atom, like [foo], [bar].*)
  | Tag of string (** Atom with [:] as a prefix, like [:bar].*)
  | Keyword of string (** Atom with [#] as a prefix, like [#foo]. *)
  | String of (quote * string) (** A String, like ["foo"], [`bar`].*)
* A list of [  ] , like [ ( foo " bar " ) ] .
* A list of [  ] , like [ { foo bar } ]

* { 2 Build  fragments }

(** Build an [atom]. *)
val atom : string -> t

(** Build a [tag]. *)
val tag : string -> t

(** Build a [keyword]. *)
val keyword : string -> t

(** Build a [string]. *)
val string : ?quote:quote -> string -> t

(** Build a [node]. *)
val node : t list -> t

(** Build a [block]. *)
val block : t list -> t

(** A double-quote. *)
val double_quote : quote

(** A back tick. *)
val back_tick : quote

(** K/V shortcut *)
val kv : ?k:(string -> t) -> ?v:(string -> t) -> string -> string -> t

(** {2 Deserialization} *)

(** From [char Stream.t] to [Qexp.t]. *)
val from_stream : char Stream.t -> t Result.t

(** From [string] to [Qexp.t]. *)
val from_string : string -> t Result.t

(** From [bytes] to [Qexp.t]. *)
val from_bytes : bytes -> t Result.t

* { 2 Serialization }

(** From [Qexp.t] to [string] *)
val to_string : t -> string

(** From [Qexp.t] to [bytes] *)
val to_bytes : t -> bytes

(** From [Qexp.t] to [char Stream.t] *)
val to_stream : t -> char Stream.t

(** Format for [printf] *)
val pp : Format.formatter -> t -> unit

(** {2 Utils} *)

val extract_root : t -> t list Result.t

* {2 Types} 
* Describe a quote. 
* Simple atom, like [foo], [bar].
* Atom with [:] as a prefix, like [:bar].
* Atom with [#] as a prefix, like [#foo]. 
* A String, like ["foo"], [`bar`].
* Build an [atom]. 
* Build a [tag]. 
* Build a [keyword]. 
* Build a [string]. 
* Build a [node]. 
* Build a [block]. 
* A double-quote. 
* A back tick. 
* K/V shortcut 
* {2 Deserialization} 
* From [char Stream.t] to [Qexp.t]. 
* From [string] to [Qexp.t]. 
* From [bytes] to [Qexp.t]. 
* From [Qexp.t] to [string] 
* From [Qexp.t] to [bytes] 
* From [Qexp.t] to [char Stream.t] 
* Format for [printf] 
* {2 Utils} 
* [  ] is a kind of [ Sexp ] with more semantics . It is used as a principal 
     " serializable " format of [ Planet ] . 

     For example : 

     { [ ( foo { : bar # baz ( ; Comment ( text " Hello World " ) ( text ` Hello World 
     2 ` ) ) } ) ] }
    "serializable" format of [Planet].

    For example :

    {[ (foo {:bar #baz ( ; Comment (text "Hello World") (text `Hello World
    2`))}) ]} *)

open Bedrock


type quote =
  | Double
  | Backtick

* Describe a [  ] expression .
type t =
* A list of [  ] , like [ ( foo " bar " ) ] .
* A list of [  ] , like [ { foo bar } ]

* { 2 Build  fragments }

val atom : string -> t

val tag : string -> t

val keyword : string -> t

val string : ?quote:quote -> string -> t

val node : t list -> t

val block : t list -> t

val double_quote : quote

val back_tick : quote

val kv : ?k:(string -> t) -> ?v:(string -> t) -> string -> string -> t


val from_stream : char Stream.t -> t Result.t

val from_string : string -> t Result.t

val from_bytes : bytes -> t Result.t

* { 2 Serialization }

val to_string : t -> string

val to_bytes : t -> bytes

val to_stream : t -> char Stream.t

val pp : Format.formatter -> t -> unit


val extract_root : t -> t list Result.t
