caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "blue storm" <bluestorm.dylc@gmail.com>
To: "Christophe Raffalli" <Christophe.Raffalli@univ-savoie.fr>
Cc: "Michel Mauny" <Michel.Mauny@inria.fr>,
	"Caml Mailing List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] ocaml parser
Date: Wed, 2 Jul 2008 17:34:37 +0200	[thread overview]
Message-ID: <527cf6bc0807020834h4128de8egd29dc18427ecfcb2@mail.gmail.com> (raw)
In-Reply-To: <486B31E1.40004@univ-savoie.fr>

> 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


      reply	other threads:[~2008-07-02 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 16:34 Christophe Raffalli
2008-07-02  4:48 ` [Caml-list] " Michel Mauny
2008-07-02  7:44   ` Christophe Raffalli
2008-07-02 15:34     ` blue storm [this message]

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=527cf6bc0807020834h4128de8egd29dc18427ecfcb2@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=Christophe.Raffalli@univ-savoie.fr \
    --cc=Michel.Mauny@inria.fr \
    --cc=caml-list@yquem.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).