caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Erik de Castro Lopo <mle+ocaml@mega-nerd.com>
To: caml-list@inria.fr
Subject: Ocaml 3.01 and camlp4 syntax?
Date: Thu, 13 Nov 2008 10:22:17 +1100	[thread overview]
Message-ID: <20081113102217.87faf573.mle+ocaml@mega-nerd.com> (raw)

Hi all,

Mostly out of curiosity, I'm having a look at the efuns Emacs
clone written in Ocaml:

    http://pauillac.inria.fr/cdrom/prog/unix/efuns/eng.htm

and trying to compile it with a recent Ocaml compiler like 3.10.2.

>From the files, it seems that the last version of Ocaml this code
compiled with was 3.01 (around the year 2000?). I've managed to find
fixes for a bunch of problems.

One of those problems was that one of the files (common/options.ml)
had code like this:

    open Genlex
  
    let lexer = make_lexer [ "=" ; "{" ; "}"; "["; "]"; ";" ; "("; ")"; ","; "."]
  
    let rec parse_gwmlrc = parser
        [< id = parse_id; 'Kwd "="; v = parse_option ; 
          eof = parse_gwmlrc >] -> (id, v) :: eof
    | [< >] -> []

which the current compiler complained about "[<". A bit of googling
suggested that this was in fact camlp4 source code. Sure enough,
renaming that file to pa_options.ml and running it throught camlp4
resulted in a file that the standard compiler digested quite happily.

I've now come to another file gwml/afterstep.mll that seems to be
ocamllex source code but again has these camlp4 like extensions.
Unfortunately camlp4 doesn't like this file, probably because it
has ocamllex syntax instead of ocaml syntax.

So, I have two questions :

 1) Did early versions of ocaml (say up to and including 3.01) handle
    constructs like those above that were later removed and and added
    to camlp4 instead?

 2) Any suggestions on how to handle the camlp4 syntax stuff in an
    ocamllex source file? Obviously, this code could be extracted
    and placed in its own file but I'm open to other suggestions.

Cheers,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Seen on comp.lang.python:
Q : If someone has the code in python for a buffer overflow,
    please post it.
A : Python does not support buffer overflows, sorry.


             reply	other threads:[~2008-11-12 23:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 23:22 Erik de Castro Lopo [this message]
2008-11-13  1:28 ` [Caml-list] " Martin Jambon
2008-11-13  4:47   ` Erik de Castro Lopo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081113102217.87faf573.mle+ocaml@mega-nerd.com \
    --to=mle+ocaml@mega-nerd.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).