I don't know how to accomplish this in general, but I'll ask about one instance in particular for clarity:
Sexplib looks interesting to me. I want to play around with it. I've downloaded it, installed it just fine (I'm pretty sure, anyway), etc. I want to use the "with sexp" syntax extension in a toplevel. How would I go about doing this? All the examples I've found of its use assume you already know how to make the toplevel and/or compile with the syntax extensions.
My best shot at it was something like this:
ocamlmktop -I +site-lib/sexplib -pp "camlp4 -I +site-lib/sexplib pa_sexp_conv.cma" -o sexplib-top
When I run this toplevel, I can open Sexplib
just fine, but when I try using the with sexp
syntax extension, I get a syntax error.
It is XXI century already - use ocamlfind :
Objective Caml version 3.11.2
# #use "topfind";;
- : unit = ()
# #camlp4o;;
/usr/lib/ocaml/dynlink.cma: loaded
/usr/lib/ocaml/camlp4: added to search path
/usr/lib/ocaml/camlp4/camlp4o.cma: loaded
Camlp4 Parsing version 3.11.2
# #require "sexplib.syntax";;
/usr/lib/ocaml/unix.cma: loaded
/usr/lib/ocaml/bigarray.cma: loaded
/usr/lib/ocaml/nums.cma: loaded
/usr/lib/ocaml/num-top: added to search path
/usr/lib/ocaml/num-top/num_top.cma: loaded
/usr/lib/ocaml/sexplib: added to search path
/usr/lib/ocaml/sexplib/sexplib.cma: loaded
/usr/lib/ocaml/type-conv: added to search path
/usr/lib/ocaml/type-conv/pa_type_conv.cmo: loaded
/usr/lib/ocaml/sexplib/pa_sexp_conv.cmo: loaded
# type t = { x : int; y : float; } with sexp;;
type t = { x : int; y : float; }
val t_of_sexp__ : Sexplib.Sexp.t -> t = <fun>
val t_of_sexp : Sexplib.Sexp.t -> t = <fun>
val sexp_of_t : t -> Sexplib.Sexp.t = <fun>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With