What is proposed here is by no way a standard, but just an attempt to fill this gap, and to demonstrate the object-oriented capacities of O'Caml.
The library is composed of 9 modules, each containing a single class, and eventually some creation functions. Each of theses classes corresponds almost exactly to a module in the standard library, and only makes it object-oriented. Only Ogenlex adds a new feature, indexing on the input stream.
Copying objects created from these classes is meaningless, since the internal state will be shared.
Oset and Omap are similar, but you have to chose between a functional and an imperative version, while the underlying abstract datatype is functional. In the imperative version the state is mutable and adding/removing of elements/bindings changes this state. While a functional implementation is also available, this way seems more natural if we think of objects as individuals. This also allows one to use Omap and Ohashtbl indifferently: they have the same methods. To switch from one to the other you just have to change object creations. Omapping is a super-class for both functional and imperative versions.
Last, Ogenlex presents a different vision, with a very stateful lexer object. You create a lexer parameterized with keywords, as in Genlex, and afterwards you can dynamically change the input stream, rather than creating an individual lexer for each stream. This corresponds to the remark that, in most programs, you only need one instance of a lexer, and then can share it.
% make % make opt
To install, verify that the first line of the Makefile points to your O'Caml library directory, depending on the distribution you are using. Then
% make install
Object creation is something like
# let s = new Ostack.c ();; - : '_a Ostack.c = <object>
# s#push 1;; - : unit = ()