Reposting this question here, just in case.

---------- Forwarded message ----------
From: Philippe Veber <philippe.veber@gmail.com>
Date: 2014-06-28 21:32 GMT+02:00
Subject: Toplevel and syntax extension.
To: ocaml_beginners@yahoogroups.com


Dear camlers,

Consider the following script:

#use "topfind";;
#camlp4o;;
#require "sexplib.syntax";;

open Sexplib.Std;;

type t = int with sexp;;

Saved as script.ml, the simple call:

ocaml script.ml

fails while the call:

cat script.ml | ocaml

succeeds. Any idea how I could fix the first call?

Cheers,
  Philippe.