From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 741437ED7A for ; Thu, 20 Sep 2012 15:45:43 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of philippe.veber@gmail.com) identity=pra; client-ip=209.85.220.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of philippe.veber@gmail.com designates 209.85.220.182 as permitted sender) identity=mailfrom; client-ip=209.85.220.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vc0-f182.google.com) identity=helo; client-ip=209.85.220.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="postmaster@mail-vc0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjoBAI8dW1DRVdy2mGdsb2JhbABFtDwBiFAIIwEBAQEBCAkNBxQngjkCLAEbHgMSEF0BEQEFASI1h04BAw8LmEqCYQkDjCWCdIUCChknDVmIdAEFDJFRA5VkgRSKBYMpFimECA X-IronPort-AV: E=Sophos;i="4.80,453,1344204000"; d="scan'208";a="173989927" Received: from mail-vc0-f182.google.com ([209.85.220.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Sep 2012 15:45:42 +0200 Received: by vcbfw7 with SMTP id fw7so4408129vcb.27 for ; Thu, 20 Sep 2012 06:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=qr8gcW12/4ijCO0mvUZzgwdzOrJTMsaeTiKIu48KLTk=; b=jHbfasEglOJQAx17aKYAzHW39RusT9WEWg5u54pvEtTYDkMigD6TA3XZkdBt5hXvXm lp1/dBiLCozxdCGiKbfjL8grdvOV9D8i1lYwVI3IsMSVEbrixp+rkZ3J3ji/g3f3g3fN iopconVM0S9g8KCj1nW44ONKpgeCIkhUPXs7ce4U/RASDUtKwIJ2xsa6IDsDCjxa6ryk 6XClcJX/M+VCrncftIqTVOh6gva/WmApmtOi33xYHHZCRLBWEaOE2Hr9pn4Nx0ggwx86 H994DKxMlO5v63UTqmolTu2Qs0L8bCsDwB8onSKRO4waulaJq/YqJxmxB6xjhf2iu3Ar hSHg== Received: by 10.58.95.65 with SMTP id di1mr1062383veb.55.1348148741871; Thu, 20 Sep 2012 06:45:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.221.0.135 with HTTP; Thu, 20 Sep 2012 06:45:21 -0700 (PDT) From: Philippe Veber Date: Thu, 20 Sep 2012 15:45:21 +0200 Message-ID: To: caml users Content-Type: multipart/alternative; boundary=e89a8f503b72dd178304ca225646 X-Validation-by: philippe.veber@gmail.com Subject: [Caml-list] Using menhir for a camlp4 quotation: a compilation issue --e89a8f503b72dd178304ca225646 Content-Type: text/plain; charset=ISO-8859-1 Dear camlers, I'm currently trying to implement a camlp4 quotation whose contents will be parsed using ocamllex and menhir. Everything went unexpectedly well until I tried to add antiquotations. Following Tiphaine Turpin's format syntax extension (https://forge.ocamlcore.org/projects/format/), an antiquotation is parsed as a token in ocamllex, and this token is defined in my parser as: %token EXPR The thing is when I try to compile my project with ocamlbuild I get the following error: [gesundheit:~/w/ocaml-r 14:46]$make ocaml setup.ml -build Finished, 0 targets (0 cached) in 00:00:00. + menhir --ocamlc 'ocamlfind ocamlc -I src/syntax' --infer src/syntax/r_lang_parser_y.mly File "src/syntax/r_lang_parser_y.mly", line 7, characters 40-44: Warning: the token EXPR is unused. File "src/syntax/r_lang_parser_y.mly", line 7, characters 8-38: Error: Unbound module Camlp4 ... Now I can easily (but manually) fix this by adding the missing -I option for camlp4 libs: [gesundheit:~/w/ocaml-r/_build 15:22]$menhir --ocamlc 'ocamlfind ocamlc -I src/syntax -I +camlp4' --infer src/syntax/r_lang_parser_y.mly File "src/syntax/r_lang_parser_y.mly", line 7, characters 40-44: Warning: the token EXPR is unused. [gesundheit:~/w/ocaml-r/_build 15:22]$ My question is how do I tell ocamlbuild to add this option directly? I fear the response is "you cannot", if I refer to the piece of code in ocamlbuild that generates the call to menhir: let menhir mly env build = let mly = env mly in let menhir = if !Options.ocamlyacc = N then V"MENHIR" else !Options.ocamlyacc in Ocaml_compiler.prepare_compile build mly; Cmd(S[menhir; A"--ocamlc"; Quote(S[!Options.ocamlc; ocaml_include_flags mly]); T(tags_of_pathname mly++"ocaml"++"parser"++"menhir"); A"--infer"; Px mly]) I fail to see in this function a hook which I could use to inject the missing argument. Would any one know a workaround to use tokens that have hold a value whose type is not defined in the standard library? Cheers, Philippe. --e89a8f503b72dd178304ca225646 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear camlers,

I'm currently trying to implement a camlp4 quotati= on whose contents will be parsed using ocamllex and menhir. Everything went= unexpectedly well until I tried to add antiquotations. Following Tiphaine = Turpin's format syntax extension (https://forge.ocamlcore.org/projects/format/), an a= ntiquotation is parsed as a token in ocamllex, and this token is defined in= my parser as:

%token <Camlp4.PreCast.Syntax.Ast.expr> EXPR

The thing is = when I try to compile my project with ocamlbuild I get the following error:=

[gesundheit:~/w/o= caml-r 14:46]$make
ocaml setup.ml -build
Finished, 0 targets (0 cached) in = 00:00:00.
+ menhir --ocamlc 'oc= amlfind ocamlc -I src/syntax' --infer src/syntax/r_lang_parser_y.mly
File "src/syntax/r_lang_parser_y.mly",= line 7, characters 40-44:
Warning: the token EXPR i= s unused.
File "src/syntax/r_lang_parser_= y.mly", line 7, characters 8-38:
Error: Unbound module Cam= lp4
...

Now I can easily (but ma= nually) fix this by adding the missing -I option for camlp4 libs:

[gesundheit:~/w/ocaml= -r/_build 15:22]$menhir --ocamlc 'ocamlfind ocamlc -I src/syntax -I +ca= mlp4' --infer src/syntax/r_lang_parser_y.mly
File "src/syntax/r_l= ang_parser_y.mly", line 7, characters 40-44:
Warning: the token EXPR is unused.
[gesundheit:~/w/ocaml-r/_= build 15:22]$

My question is how do I tell ocamlbuild to add = this option directly? I fear the response is "you cannot", if I r= efer to the piece of code in ocamlbuild that generates the call to menhir:<= br>
let menhir mly env bu= ild =3D
=A0 let mly =3D env mly in =A0 let menhir =3D if !Op= tions.ocamlyacc =3D N then V"MENHIR" else !Options.ocamlyacc in
=A0 Ocaml_compiler.prepare_compile build mly;
=A0 Cmd(S[menhir;<= br style=3D"font-family:courier new,monospace">=A0=A0=A0=A0=A0=A0=A0 A"--ocamlc"; Quote(S[= !Options.ocamlc; ocaml_include_flags mly]);
=A0=A0=A0=A0=A0=A0=A0 T(t= ags_of_pathname mly++"ocaml"++"parser"++"menhir&qu= ot;);
=A0=A0=A0=A0=A0=A0=A0 A"--infer&quo= t;; Px mly])

I fail to see in this function a hook which I could use to inject the m= issing argument. Would any one know a workaround to use tokens that have ho= ld a value whose type is not defined in the standard library?

Cheers= ,
=A0 Philippe.


--e89a8f503b72dd178304ca225646--