some small example using s-expressions
Ashish Agarwal
agarwal1975 at gmail.com
Wed Nov 21 15:24:02 GMT 2012
In _oasis, add sexplib.syntax to BuildDepends.
Make your _tags file like this:
$ cat _tags
# OASIS_START
# OASIS_STOP
<.ml{,i}>: syntax_camlp4o
Then, create some type defs:
$ cat a.ml
type t = A | B of int
with sexp
And similarly add "with sexp" in your .mli files if you want the sexp
converters available in the interface. You'll get extra functions t_of_sexp
and sexp_of_t. Biocaml does this, so you can see that code for an example.
On Wed, Nov 21, 2012 at 3:00 AM, Francois Berenger <
francois.berenger.working at gmail.com> wrote:
> Hello,
>
> I am looking for some introduction to using s-expressions.
>
> A small and simple example would be enough
> for me to get started:
>
> I'd like to know:
> - what to change in my code to enable them (just add ' with sexp' after
> some type declaration?)
> - what to change in my build system to enable them (I use oasis)
>
> Thanks a lot,
> Francois.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/core/attachments/20121121/10203650/attachment-0001.html>
More information about the core
mailing list