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=0.1 required=5.0 tests=AWL 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 49FCBBB84 for ; Wed, 2 Jul 2008 17:34:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEBAFA8a0jRVciqeGdsb2JhbACRb0MBDAMEBgcRA5ofhgE X-IronPort-AV: E=Sophos;i="4.27,738,1204498800"; d="scan'208";a="26951866" Received: from wf-out-1314.google.com ([209.85.200.170]) by mail4-smtp-sop.national.inria.fr with ESMTP; 02 Jul 2008 17:34:38 +0200 Received: by wf-out-1314.google.com with SMTP id 24so438946wfg.15 for ; Wed, 02 Jul 2008 08:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=7aTDg81BIEizD8slAp0Y2pG9L8gekEUHuTcXEtJTDog=; b=xRLFK3PG+P2XwNMOJfHOn3DrhVzWNjEwDoPCD6Bu/hFmXG/viqsPAPzM5lAmoZN6Mv kxsVGMojQDjGmOE12/vV2a+6igvWXEy2VSVBjp2uNkC42cxa2P0Il5QIE60T3srSBUEJ aA66MsU4VZAsWyahepVWc0ddp/GMB2NTXHY8s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=oGLo0hNl7JKm5g4LNATs7R4HhpWDIM6Jg+A69Xcjo9E7X/OpOtnuBqNZeuAyzMXQ9f 27rxITWiiHyEo+lpsStg85OJBo4uEBect5oC3npzBbIMEnwGOfbOhbXoucntiwPEEYTo lJOkHUphECdrYU8KaKSftdEwB5SJU3zJzR3YA= Received: by 10.142.177.7 with SMTP id z7mr3097574wfe.249.1215012877443; Wed, 02 Jul 2008 08:34:37 -0700 (PDT) Received: by 10.142.231.2 with HTTP; Wed, 2 Jul 2008 08:34:37 -0700 (PDT) Message-ID: <527cf6bc0807020834h4128de8egd29dc18427ecfcb2@mail.gmail.com> Date: Wed, 2 Jul 2008 17:34:37 +0200 From: "blue storm" To: "Christophe Raffalli" Subject: Re: [Caml-list] ocaml parser Cc: "Michel Mauny" , "Caml Mailing List" In-Reply-To: <486B31E1.40004@univ-savoie.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <486A5C84.3080005@univ-savoie.fr> <486B08AA.5010303@inria.fr> <486B31E1.40004@univ-savoie.fr> X-Spam: no; 0.00; ocaml:01 parser:01 bug:01 ocaml:01 parser:01 -pp:01 camlp:01 camlp:01 syntax:01 ocamlc:01 -pp:01 cmo:01 cmo':01 cmo:01 syntax:01 > Is it a bug to have any difference between both ocaml parser (with "-pp camlp4o" or without) ? camlp4o add some extensions to the ocaml syntax (streams and parser, thus your conflict). But you can use a bare "camlp4" preprocessor, adding it only the ocaml parser, and you wouldn't get those incompatibilities : $ ocamlc -pp 'camlp4 pa_o.cmo pr_dump.cmo' test.ml As explained in the man page : The command camlp4o is a shortcut for: camlp4 pa_o.cmo pa_op.cmo pr_dump.cmo (pa_op.cmo providing streams and parser syntax) > This is a problem when you generate ocaml code that > you must make sure to be compatible > with as many as possible OCaml parsers ... An other solution would be to use the camlp4 libraries to output a piece of OCaml AST directly, wich you can then read and interpret directly and without ambiguities, without going through an additional parsing stage. The pr_dump.cmo printer achieve this, although i'm not exactly sure how you should proceed from an independent generator : $ cat test.ml print_endline "Hello World" $ camlp4 pa_o.cmo pr_dump.cmo test.ml > test.out $ ocamlc -o test -impl test.out $ ./test Hello World