Previous week Up Next week


Here is the latest Caml Weekly News, for the week of 17 to 24 August, 2004.

  1. CFG Parsers
  2. Objective Caml version 3.08.1
  3. Programming with modules
  4. Some logo for your OCaml related websites
  5. Continuations
  6. ocamllex tutorial (ver 0.1)

CFG Parsers


Continuing the thread from last week, Alex Cowie added:
Christian Lindig's  lexer (lc) and parser (pc,pc2) combinators are also
included in the Tony XML parser package
( available via the Caml Humps,
although it is not obvious from the package description!
Christian Lindig also said:
Diego Olivier Fernandez Pons wrote:
>- Christian Lindig _lexer_ combinators
>The library doesn't seem to be available from Lindig's pages anymore

That's true but you can still find them here:

Objective Caml version 3.08.1


Damien Doligez announced:
This is to announce the availability of Objective Caml 3.08.1.

This is mainly a bug-fix release; see below for the list of changes.
In addition to bug fixes, we have slightly relaxed the licencing
conditions, and clarified the licence for the emacs (*.el) files.
These changes, prompted by discussions with the Debian legal team,
consist in the removal of two problematic clauses in the QPL. This
new licence is thus slightly less constraining than the old version.

Only the source is available at the moment.  We will provide some
binaries in the near future.

It is available at

-- Damien Doligez for the Caml Team

Objective Caml 3.08.1:

- The emacs files are now under GPL
- Slightly relaxed some conditions of the QPL

Bug fixes:
- ld.conf now generated at compile-time instead of install-time
- fixed -pack on Windows XP (PR#2935)
- fixed Obj.tag (PR#2946)
- added support for multiple dlopen in Darwin
- run ranlib when installing camlp4 libraries (PR#2944)
- link camlp4opt with -linkall (PR#2949)
- camlp4 parsing of patterns now conforms to normal parsing (PR#3015)
- install camlp4 *.cmx files (PR#2955)
- fixed handling of linefeed in string constants in camlp4 (PR#3074)
- ocamldoc: fixed display of class parameters in HTML and LaTeX
- ocamldoc: fixed display of link to class page in html (PR#2994)
- Windows toplevel GUI: assorted fixes (including PR#2932)

- added -v option to ocamllex
- ocamldoc: new -intf and -impl options supported (PR#3036)

Programming with modules


Erik de Castro Lopo asked:
Say I have a module ( and an interface (main.mli) which
defines a type maintype.

However, is getting a little large and I'd like to split
some of the functionality out into another file, but still have
access to maintype in the new file. Unfortunately, Ocaml doesn't
allow mutual dependancies across acoss files.

Does anybody have any suggestions on how to get around this?
Richard Jones answered:
Preprocessing with /lib/cpp is possible:

#include ""
#include ""

let v1 = 1

let v2 = v1 + 1;;
print_endline ("v2 = " ^ string_of_int v2);;

$ ocamlc -pp /lib/cpp
$ ./a.out
v2 = 2
Benjamin Geer added:
Or you can use modules:

type maintype = Mytypes.maintype ;;
let foo = ;;

type maintype = int list ;;

let foo x y = x + y ;;
Brian Hurt suggested:
Push maintype down the module heirarchy- up to an including creating a
special module which only contains maintype (and some supporting
functions), which everything depends upon.

More generally, refactor your code.  Find hunks of code which are already
mostly independent and consider how to make them more independent, so you
can cut them out into their own modules.  Limit interactions between
different parts of the code, and develop interfaces for those interactions
which are necessary.  This actually leads to more maintainable code.

Some logo for your OCaml related websites


Olivier Grisel announced:
Some time ago, there was a thread [1] on this list about setting up a
community website for OCaml users/developers. Richard was planning to
setup a wiki and a gforge server. In the mean time, here is my little
contribution to the branding of such a website: a set of logo proposals
based on the classical gif file (the camel face with sun glasses):
I provide the SVG source file so that anybody can further enhance this
early proposal.

Benjamin Geer said and Olivier Grisel answered:
Benjamin Geer wrote:
>Olivier Grisel wrote:
>>I feel very sorry butI wasn't aware of the origin of this "Joe Camel"
>It was a huge, very controversial advertising campaign... a lot of
>people were (and still are) very angry about it, all over the world.
>>I can remove the grass bit to try to break the association with the
>>Joe Camel.
>>What do you think ?
>I don't think it would help.  The shape of the camel face (even without
>the sunglasses) is what makes it Joe Camel.  This was the intention of
>the OCaml team when they chose this logo, apparently as a joke (in very
>bad taste, I think).
>I think OCaml needs a completely new logo.
>The problem of how to make it different from the Perl logo is
>interesting.  Actually O'Reilly has a trademark on the use of a camel to
>represent a programming language:
>I asked them about this last year, and they said they currently had no
>position on the use of a camel to represent the OCaml language.  I don't
>know whether they might eventually cause trouble.  You might want to ask
>them about it.
>Another alternative would be to make a logo that doesn't represent a
>camel at all.

I agree. Anybody has a better idea ? What could symobolize the ocaml
programming language ? OReilly seems to think a horse[1] might do, but
I'm  not quite so sure :o)

Damien Doligez suggested:
>Another alternative would be to make a logo that doesn't represent a
>camel at all.

A pearl in its oyster?
William D. Neumann delivered:
> A pearl in its oyster?

Heh.  I thought this suggestion was funny enough that I decided to whip something together to see
how it looks.  Being somewhat pleased with the results, I decided to let you guys have a peek if you
want.  The images are located at .



Sébastien Hinderer asked and Nathaniel Gray answered:
> Is there a good tutorial or bibliographic reference about programming
> with continuations around ?
> I would be interested even by documentations dealing with continuations in
> general (that is, not with Ocaml in particular).

I wrote a "simple" tutorial on continuations that you might try
reading.  You can find it here:

Let me know if there is anything that you think could be improved in
terms of clarity.

ocamllex tutorial (ver 0.1)


SooHyoung Oh announced:
If one doesn't have knowledge for lexcial analyzer or parsing theory, it's
not sufficient for an user to use "ocamllex" and "ocamlyacc" after reading
manuals of these utilities only.

One has to read "lex"/"flex" manual and "yacc"/"bison" manual before using
"ocamllex" and "ocamlyacc".

So, I thought it would be helpful if ocaml community has "ocamllex" and
"ocamlyacc" tutorials.

This is my first contribute to "ocamllex tutorial" and I'm preparing the
companion "ocamlyacc tutorial", too.

Any comment will be appreciated.

--- Abstract ---

This is a tutorial on how to use ocamllex which is distributed with Ocaml

This tutorial borrowed lots of part from flex manual, and some part from
Chap. 12 Lexer and parser generators (ocamllex, ocamlyacc).

The companion tutorial for ocamlyacc will be available in one or two weeks

Please mail all comments and suggestions to <shoh at compiler dot kaist dot
ac dot kr>

This tutorial is work-in-progress. The latest version can be found at .

Last updated: 2004-08-24

Using folding to read the cwn in vim 6+

Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'&lt;1':1

If you know of a better way, please let me know.

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.

Alan Schmitt