From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.5 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 9B541BB84 for ; Thu, 13 Nov 2008 02:28:29 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AikDADIRG0nAXQIngWdsb2JhbACTYAEBFiK8JINX X-IronPort-AV: E=Sophos;i="4.33,593,1220220000"; d="scan'208";a="31399680" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 13 Nov 2008 02:28:29 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAD1SSJp023003 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 13 Nov 2008 02:28:28 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoAAAERG0lCbwQdk2dsb2JhbACTYAEBAQEJCQoJEQS8J4NX X-IronPort-AV: E=Sophos;i="4.33,593,1220220000"; d="scan'208";a="19894729" Received: from out5.smtp.messagingengine.com ([66.111.4.29]) by mail1-smtp-roc.national.inria.fr with ESMTP; 13 Nov 2008 02:28:27 +0100 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 6BC661AA175 for ; Wed, 12 Nov 2008 20:28:24 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 12 Nov 2008 20:28:24 -0500 X-Sasl-enc: MnZad16k5tGUcHIdxJOKs/mLQl0ezGthN/PibGCMg8pK 1226539704 Received: from [192.168.1.61] (dsl092-191-028.sfo1.dsl.speakeasy.net [66.92.191.28]) by mail.messagingengine.com (Postfix) with ESMTPSA id E1360240F4 for ; Wed, 12 Nov 2008 20:28:23 -0500 (EST) Message-ID: <491B82B6.3040009@ens-lyon.org> Date: Thu, 13 Nov 2008 02:28:22 +0100 From: Martin Jambon User-Agent: Thunderbird 2.0.0.17 (X11/20081008) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Ocaml 3.01 and camlp4 syntax? References: <20081113102217.87faf573.mle+ocaml@mega-nerd.com> In-Reply-To: <20081113102217.87faf573.mle+ocaml@mega-nerd.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 491B82BC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 ocaml:01 camlp:01 syntax:01 efuns:01 emacs:01 ocaml:01 efuns:01 compiler:01 genlex:01 lexer:01 lexer:01 parser:01 compiler:01 complained:01 Erik de Castro Lopo wrote: > 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? Exactly. The 3.10 manual says: 7.2 Streams and stream parsers The syntax for streams and stream parsers is no longer part of the Objective Caml language, but available through a Camlp4 syntax extension. See the Camlp4 reference manual for more information. Support for basic operations on streams is still available through the Stream[Stream] module of the standard library. Objective Caml programs that use the stream parser syntax should be compiled with the -pp camlp4o option to ocamlc and ocamlopt. For interactive use, run ocaml and issue the #load "camlp4o.cma";; command. > 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. I don't know. Have you tried ocamllex followed by camlp4? Martin -- http://mjambon.com/