Previous week Up Next week

Hello

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

Archive: http://caml.inria.fr/archives/200408/msg00290.html

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
(http://www.st.cs.uni-sb.de/~lindig/src/) 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
>http://caml.inria.fr/caml-list/0870.html
>The library doesn't seem to be available from Lindig's pages anymore

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

http://www.cminusminus.org/rsync/qc--linux-x86/cllib/
    

Objective Caml version 3.08.1

Archive: http://caml.inria.fr/archives/200408/msg00292.html

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 http://caml.inria.fr/ocaml/distrib.html

-- Damien Doligez for the Caml Team


Objective Caml 3.08.1:
----------------------

Licence:
- 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
(PR#2994)
- ocamldoc: fixed display of link to class page in html (PR#2994)
- Windows toplevel GUI: assorted fixes (including PR#2932)

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

Programming with modules

Archive: http://caml.inria.fr/archives/200408/msg00318.html

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

However, main.ml 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:

-------------------------------------------------- main.ml
#include "main-part1.ml"
#include "main-part2.ml"

-------------------------------------------------- main-part1.ml
let v1 = 1

-------------------------------------------------- main-part2.ml
let v2 = v1 + 1;;
print_endline ("v2 = " ^ string_of_int v2);;



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

-------------------------------------------------- main.ml
type maintype = Mytypes.maintype ;;
let foo = Helper.foo ;;

-------------------------------------------------- mytypes.ml
type maintype = int list ;;

-------------------------------------------------- helper.ml
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

Archive: http://caml.inria.fr/archives/200408/msg00330.html

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):
http://champi.champiland.homelinux.org/~olivier/ocaml-logos.html
I provide the SVG source file so that anybody can further enhance this
early proposal.

[1] http://caml.inria.fr/archives/200405/msg00412.html
    
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"
>>think.
>
>
>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:
>
>http://perl.oreilly.com/usage
>
>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)

[1] http://web.linuxfr.org/2001/03/05/2585.html
    
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 http://www.unm.edu/~wdnx/camlpearl.html .
    

Continuations

Archive: http://caml.inria.fr/archives/200408/msg00246.html

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:
   http://mojave.caltech.edu/papers/cont-tut.ps

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

ocamllex tutorial (ver 0.1)

Archive: http://caml.inria.fr/archives/200408/msg00360.html

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
language.

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
later.

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
http://pllab.kaist.ac.kr/~shoh/ocaml/ocamllex_ocamlyacc/ocamllex-tutorial/index.html .

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
zM

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