From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 90B167FD2F for ; Wed, 1 Mar 2017 04:58:00 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-qk0-f176.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.220.176 as permitted sender) identity=mailfrom; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qk0-f176.google.com) identity=helo; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-qk0-f176.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Ah27egRxRsaEsuRfXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0e4WIJqq85mqBkHD//Il1AaPBtSGragVwLSJ++C4ACpbvsbH6ChDOLV3FDY7yu?= =?us-ascii?q?wu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9?= =?us-ascii?q?Dq3PF4XTl8W60fyps92WOl0QxWmLWq5pNBi9sSnWs8AXh8MidvdwmVP1pS5odu?= =?us-ascii?q?BT2H8gD0iamRr4rpOw8Zpm7jgWsego8cJEear/b+I+QKAOXxo8NGVgy8ThrxjO?= =?us-ascii?q?SUO07XsRSGgM2k5HCgLf7Rz+GIz6sibgu/BV1yyTPMmwRrcxD2fxp5x3QQPl3X?= =?us-ascii?q?9UfwUy93va34kt1a8=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CHDgC4RbZYhrDcVdFeGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFAEBAQEBAQEBAQEBBwEBAQEBg0c/gQkHg1SRCophgjoqhhaOSCyFLEo?= =?us-ascii?q?CgicHQxQBAQEBAQEBAQEBARIBAQEICwsKHS+CMwQBHQWCFwEEASMEGQEbEgsBA?= =?us-ascii?q?wELBgMCCxodAgIiAREBBQEKEgYKCRKJSwEDDQgOk3yRFj+MA4FsGAUBHIMJBYN?= =?us-ascii?q?jChknAwpVgwkBAQEBAQEEAQEBAQEBAQEBFwIGEoY6hG+CUYIwglmCXwWHPQyJC?= =?us-ascii?q?4tTggKEcos8gXtTjkyIPIIZhxYUHoEVDyeBGgghFB9TF4N/Kg8RDIF/IjWIIYF?= =?us-ascii?q?PAQEB?= X-IPAS-Result: =?us-ascii?q?A0CHDgC4RbZYhrDcVdFeGgEBAQECAQEBAQgBAQEBFAEBAQE?= =?us-ascii?q?BAQEBAQEBBwEBAQEBg0c/gQkHg1SRCophgjoqhhaOSCyFLEoCgicHQxQBAQEBA?= =?us-ascii?q?QEBAQEBARIBAQEICwsKHS+CMwQBHQWCFwEEASMEGQEbEgsBAwELBgMCCxodAgI?= =?us-ascii?q?iAREBBQEKEgYKCRKJSwEDDQgOk3yRFj+MA4FsGAUBHIMJBYNjChknAwpVgwkBA?= =?us-ascii?q?QEBAQEEAQEBAQEBAQEBFwIGEoY6hG+CUYIwglmCXwWHPQyJC4tTggKEcos8gXt?= =?us-ascii?q?TjkyIPIIZhxYUHoEVDyeBGgghFB9TF4N/Kg8RDIF/IjWIIYFPAQEB?= X-IronPort-AV: E=Sophos;i="5.35,223,1484002800"; d="scan'208,217";a="262538743" Received: from mail-qk0-f176.google.com ([209.85.220.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 01 Mar 2017 04:57:59 +0100 Received: by mail-qk0-f176.google.com with SMTP id s186so51563912qkb.1; Tue, 28 Feb 2017 19:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kOH0ee+MsbpbTklpQSb2JGGu7wp7BiXBbbdLJLVv4kk=; b=Zb6Tl2L/NcQrlJaQ/3FynJp91MzYc0WA/Cl1v6sttJf4eeme1McpQjVS5gZakpojl3 w1y6Xo6lkFcUiyAWrAQEUZkuQrwZR93n3PcsQ7VbbYp7ZmytdBoOCdLdoC6esqanFg/1 U7da7bP0vPYW2SYpE0+ZRs/PzuG90RhTQTgmbmSusWHAa0i0ZB7mdIfjF/mcVUvDriLe C20gsNE/TpaDbgDQKGR/p0MzhwjHGc0WZQicUZE2rzNJqwo+TtBzbAf4PwKPDFxq5x6F d9OgXPdnmvioBg+2OV3tSL1aXaMtKAPTFRuwYNFRBIN284y3BAGRC2xT51lElp7m2AgL piPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kOH0ee+MsbpbTklpQSb2JGGu7wp7BiXBbbdLJLVv4kk=; b=Q4I2CKuBO99vqxcswFwjrvp45PT5l9yOaNHug7Sd0SomQBu5MQPTFc/E+KvPucyPcc TpAtcn2Pgk4tq0jGwGxMDk3H7NmtG2LtRw9MeRCp6FxQORP/YZir4Z+mUmud2LSFJQRP 9TG03O1/xs+UJqBtImiPvZ6kZnnba+uGWt9oYzTPDQJXVu1l7z+eiQHw2pxkO/CG9VtM 4vxAmbOvrUvEhhl0CY5uRrnNvMcLMOAPh6QsApgsVhTcXOaR/XPQJCRVkFVYgGogJOtQ elSCrc4N5uOoKClPDyZpsqk4oZ0FVpIX+UshcXsHOz2ajx7yqmWEzSWjusG4ItjHL4Cx sJUA== X-Gm-Message-State: AMke39n88Le+g09W527qSMk13fcIMOHwB4/x1sBMGRciwBVCYscWyMN8EgvHgc0TqwFTZC/RCEYeQALVb+4lSg== X-Received: by 10.200.49.129 with SMTP id h1mr7421759qte.277.1488340678033; Tue, 28 Feb 2017 19:57:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.156.8 with HTTP; Tue, 28 Feb 2017 19:57:17 -0800 (PST) In-Reply-To: <7C984183-3E3A-4698-8597-342888F7E53B@gmx.net> References: <7C984183-3E3A-4698-8597-342888F7E53B@gmx.net> From: Gabriel Scherer Date: Tue, 28 Feb 2017 22:57:17 -0500 Message-ID: To: Helmut Brandl Cc: caml users , Francois Pottier Content-Type: multipart/alternative; boundary=001a11c003866b554d0549a35185 Subject: Re: [Caml-list] Menhir incremental api with ocamlbuild --001a11c003866b554d0549a35185 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Indeed, ocamlbuild misses some built-in flag for menhir features. That said, it is easy to add these flags through your myocamlbuild.ml. Here is what I have in an incremental-menhir-using project (inside a dispatch call): flag ["menhir"; "parser"; "trace"] (A"--trace"); flag ["menhir"; "parser"; "table"] (A "--table"); flag ["menhir"; "parser"; "canonical"] (A"--canonical"); but it would be easy to add those to the built-in -use-menhir mode. (If you are not comfortable with using myocamlbuild.ml, see the ocamlbuild manual: https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#Sec_Plug= ins ) In this project I also have rules for handling of .messages files corresponding Menhir's new error message support. I include the complete code at the end of my email. I would like to get a bit more experience using those, before considering including them in ocamlbuild proper. ---- module Menhir =3D struct let menhir () =3D if !Options.ocamlyacc =3D N then V"MENHIR" else !Options.ocamlyacc let menhir_tags mly =3D tags_of_pathname mly ++"ocaml"++"parser"++"menhir" let menhir_produce_messages env build =3D let messages, mly =3D env "%.messages", env "%.mly" in let open Ocamlbuild_pack in Ocaml_compiler.prepare_compile build mly; Cmd(S[menhir (); T (menhir_tags mly); A "--list-errors"; P mly; Sh ">"; Px messages]) let menhir_compile_messages env build =3D let mly =3D env "%.mly" in let messages =3D env "%.messages" in let target =3D env "%_messages.ml" in Cmd(S[menhir (); T (menhir_tags mly); P mly; A "--compile-errors"; P messages; Sh ">"; Px target]) let menhir_update_messages env build =3D let mly =3D env "%.mly" in let messages =3D env "%.messages" in let tmp =3D Filename.temp_file "menhir" ".messages" in Seq [ Cmd(S[menhir (); T (menhir_tags mly); P mly; A "--update-errors"; P messages; Sh ">"; P tmp]); Cmd(S[A "mv"; P tmp; P messages]); ] let dispatcher =3D function | After_rules -> flag ["menhir"; "parser"; "menhir_trace"] (A"--trace"); flag ["menhir"; "parser"; "menhir_table"] (A "--table"); flag ["menhir"; "parser"; "menhir_canonical"] (A"--canonical"); rule "menhir: .mly -> .messages" ~prod:"%.messages" ~deps:["%.mly"] menhir_produce_messages; rule "menhir: .mly & .messages -> _messages.ml" ~prod:"%_messages.ml" ~deps:["%.mly"; "%.messages"] menhir_compile_messages; rule "menhir: .mly & .messages -> .messages & .messages.update" ~stamp:"%.messages.update" ~deps:["%.mly"; "%.messages"] menhir_update_messages; | _ -> () end On Tue, Feb 28, 2017 at 10:30 PM, Helmut Brandl wrote: > Hello list, > > does anybody know how to build a project with ocamlbuild and use the > incremental api of menhir. By using menhir directly I would use the > =E2=80=98-table=E2=80=99 flag. But I don=E2=80=99t know how to transfer t= his flag to menhir by > using ocamlbuild. > > Kind regards > Helmut > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --001a11c003866b554d0549a35185 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Indeed, ocamlbuild misses some built-in flag for= menhir features. That said, it is easy to add these flags through your myocamlbuild.ml. Here is what I have in= an incremental-menhir-using project (inside a dispatch call):

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 flag ["menhir"; "par= ser"; "trace"] (A"--trace");
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 flag ["menhir"; "parser"; &quo= t;table"] (A "--table");
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 flag ["menhir"; "parser"; "canonical&= quot;] (A"--canonical");

but it would be easy to add= those to the built-in -use-menhir mode.

In this project I also have rules for handling of .messages files c= orresponding Menhir's new error message support. I include the complete= code at the end of my email. I would like to get a bit more experience usi= ng those, before considering including them in ocamlbuild proper.

--= --

module Menhir =3D struct
=C2=A0 let menhir () =3D
=C2=A0=C2= =A0=C2=A0 if !Options.ocamlyacc =3D N then V"MENHIR" else !Option= s.ocamlyacc
=C2=A0 let menhir_tags mly =3D
=C2=A0=C2=A0=C2=A0 tags_of= _pathname mly ++"ocaml"++"parser"++"menhir"
=C2=A0 let menhir_produce_messages env build =3D
=C2=A0=C2=A0=C2= =A0 let messages, mly =3D env "%.messages", env "%.mly"= in
=C2=A0=C2=A0=C2=A0 let open Ocamlbuild_pack in
=C2=A0=C2=A0=C2=A0= Ocaml_compiler.prepare_compile build mly;
=C2=A0=C2=A0=C2=A0 Cmd(S[menh= ir (); T (menhir_tags mly);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 A "--list-errors"; P mly; Sh ">"; Px me= ssages])

=C2=A0 let menhir_compile_messages env build =3D
=C2=A0= =C2=A0=C2=A0 let mly =3D env "%.mly" in
=C2=A0=C2=A0=C2=A0 let= messages =3D env "%.messages" in
=C2=A0=C2=A0=C2=A0 let targe= t =3D env "%_messages.ml" in=C2=A0=C2=A0=C2=A0 Cmd(S[menhir (); T (menhir_tags mly); P mly;
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A "--compile-errors&q= uot;; P messages;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= Sh ">"; Px target])

=C2=A0 let menhir_update_messages = env build =3D
=C2=A0=C2=A0=C2=A0 let mly =3D env "%.mly" in=C2=A0=C2=A0=C2=A0 let messages =3D env "%.messages" in
=C2= =A0=C2=A0=C2=A0 let tmp =3D Filename.temp_file "menhir" ".me= ssages" in
=C2=A0=C2=A0=C2=A0 Seq [
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 Cmd(S[menhir (); T (menhir_tags mly); P mly;
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A "--update-errors"= ; P messages;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 Sh ">"; P tmp]);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 C= md(S[A "mv"; P tmp; P messages]);
=C2=A0=C2=A0=C2=A0 ]

= =C2=A0 let dispatcher =3D function
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | Afte= r_rules ->
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 flag ["men= hir"; "parser"; "menhir_trace"] (A"--trace&qu= ot;);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 flag ["menhir"= ;; "parser"; "menhir_table"] (A "--table");=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 flag ["menhir"; &quo= t;parser"; "menhir_canonical"] (A"--canonical");=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rule "menhir: .mly -> = .messages"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ~= prod:"%.messages"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ~deps:["%.mly"]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 menhir_produce_messages;
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 rule "menhir: .mly & .messages -> _messages.ml"
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ~prod:"%_messages.ml"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 ~deps:["%.mly"; "%.messages"]
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 menhir_compile_messages;
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rule "menhir: .mly & .message= s -> .messages & .messages.update"
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ~stamp:"%.messages.update"
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ~deps:["%.mly"= ;; "%.messages"]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 menhir_update_messages;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | _ -&g= t; ()
end


On Tue, Feb 28, 2017 at 10:30 PM, Helmut Brandl = <helmut.brand= l@gmx.net> wrote:
Hello li= st,

does anybody know how to build a project with ocamlbuild and use the increm= ental api of menhir. By using menhir directly I would use the =E2=80=98-tab= le=E2=80=99 flag. But I don=E2=80=99t know how to transfer this flag to men= hir by using ocamlbuild.

Kind regards
Helmut

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a11c003866b554d0549a35185--