package dune-private-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Canonical S-expressions

This module provides minimal support for reading and writing S-expressions in canonical form.

https://en.wikipedia.org/wiki/Canonical_S-expressions

Note that because the canonical representation of S-expressions is so simple, this module doesn't go out of his way to provide a fully generic parser and printer and instead just provides a few simple functions. If you are using fancy input sources, simply copy the parser and adapt it. The format is so simple that it's pretty difficult to get it wrong by accident.

To avoid a dependency on a particular S-expression library, the only module of this library is parameterised by the type of S-expressions.

let rec print = function
  | Atom str -> Printf.printf "%d:%s" (String.length s)
  | List l -> List.iter print l
module type Sexp = sig ... end
module Make (Sexp : Sexp) : sig ... end
OCaml

Innovation. Community. Security.