From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id DC6A15D5 for ; Fri, 31 Dec 2021 08:22:55 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.88,250,1635199200"; d="scan'208";a="13058585" Received: from prod-listesu18.inria.fr (HELO sympa.inria.fr) ([128.93.162.160]) by mail2-relais-roc.national.inria.fr with ESMTP; 31 Dec 2021 09:22:55 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 959D3E038A; Fri, 31 Dec 2021 09:22:54 +0100 (CET) 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 BCFDEE0120; Fri, 31 Dec 2021 09:22:49 +0100 (CET) IronPort-Data: =?us-ascii?q?A9a23=3AzsZ1jKDdkl+RZhVW/8bhw5YqxClBgxIJ4g17XOL?= =?us-ascii?q?fUFK61Twk12QAyGQfWD+Da//fMTOkLdtxYdywoRhQ7JeAx9UxeLYW3SE0HigS8?= =?us-ascii?q?aIpJvzAcxyuZ3vKRiH7ofMOA/w2MrEsF+hpCC+MzvuRGuK59yAlj/rRHuOU5NP?= =?us-ascii?q?sYUideyc1EU/Ntjozw4bVsqYw6TSIK1vlVeHa+6UzC3f5s9JACV/43orYwP9ZU?= =?us-ascii?q?FsejxtD1rA2TagjUFYzDBD5BrpHTU26ByOQroW5goeHq+j/ILGRpgs1/j8IA9i?= =?us-ascii?q?PlbH4N3UQRfuPewyJgXNSM0Sgqkkb4HVtj+BibqVaMx4K49mKt4kZJNFlu4a5T?= =?us-ascii?q?wwuP7aKgOMBTxhVCQl/O7dH8fnJOxBTtOTKlBWbIyaxkp2CC2lzZ+X04N1fDGR?= =?us-ascii?q?P8fFeNCoKchGMgeWw6L2+Q+howM8kKaHDOY4ZunB65SrICO4vB5HFWaTDo9FCt?= =?us-ascii?q?B87j8VKWPLffNYxcitqdB2GYhtVO15RBohWoQsCrhETaBUJ8RfM+vdyujKMiVY?= =?us-ascii?q?ojf72LdDOPMSQQtVckgCeq36uwogwOTlCXPT39NZP2ivEajfzoB7G?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AiGQLpaxz3zJaKEfujVs0KrPwK71zdoMgy1kn?= =?us-ascii?q?xilNoNJuHvBw9vre/sjzuiWetN98YhsdcJW7VpVoIkmslqKdg7N/AV7KZmCPhI?= =?us-ascii?q?LrFuBfBODZowEIbheOkNK1op0QFJSWZuecMbEDt7ef3ODuKadE/OW6?= X-IronPort-AV: E=Sophos;i="5.88,250,1635199200"; d="scan'208";a="13058559" Received: from 91-175-127-215.subs.proxad.net (HELO MacBook-Pro-5.local) ([91.175.127.215]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Dec 2021 09:22:50 +0100 To: OCaML Mailing List , menhir-list From: =?UTF-8?Q?Fran=c3=a7ois_Pottier?= Message-ID: <82582cbe-09da-1410-0cce-f1ebf4f71294@inria.fr> Date: Fri, 31 Dec 2021 09:22:49 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Subject: [Caml-list] [ANN] New release of Menhir (20211230) Reply-To: =?UTF-8?Q?Fran=c3=a7ois_Pottier?= X-Loop: caml-list@inria.fr X-Sequence: 18635 Errors-To: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Dear OCaml & Menhir users, I am pleased to announce a new release of Menhir, with a major improvement. The code back-end has been rewritten from the ground up by Émile Trotignon and by myself, and now produces efficient and well-typed OCaml code. The infamous Obj.magic is not used any more. Furthermore, the new code back-end produces code that is more aggressively optimized, leading to a significant reduction in memory allocation and a typical performance improvement of up to 20% compared to the previous code back-end. opam update opam install menhir.20211230 Happy well-typed parsing in 2022! -- François Pottier francois.pottier@inria.fr http://cambium.inria.fr/~fpottier/ ## 2021/12/30 * The code back-end has been rewritten from the ground up by Émile Trotignon and François Pottier, and now produces efficient and **well-typed** OCaml code. The infamous `Obj.magic` is not used any more. The table back-end and the Coq back-end are unaffected by this change. The main side effects of this change are as follows: - The code back-end now needs type information. This means that *either* Menhir's type inference mechanism must be enabled (the easiest way of enabling it is to use Menhir via `dune` and to check that the `dune-project` file says `(using menhir 2.0)` or later) *or* the type of every nonterminal symbol must be explicitly given via a `%type` declaration. - The code back-end no longer allows the type of any symbol to be an open polymorphic variant type, such as ```[> `A ]```. As a workaround, we suggest using a closed polymorphic variant instead. - The code back-end now adheres to the *simplified* error-handling strategy, as opposed to the *legacy* strategy. For grammars that do *not* use the `error` token, this makes no difference. For grammars that use the `error` token in the limited way permitted by the simplified strategy, this makes no difference either. The simplified strategy makes the following requirement: the `error` token should always appear at the end of a production, whose semantic action should abort the parser by raising an exception. Grammars that make more complex use of the `error` token, and therefore need the `legacy` strategy, cannot be compiled by the new code back-end. As a workaround, it is possible to switch to the table back-end (using `--table --strategy legacy`) or to the ancient code back-end (using `--code-ancient`). **In the long run, we recommend abandoning the use of the `error` token**. Support for the `error` token may be removed entirely at some point in the future. The original code back-end, which has been around since the early days of Menhir (2005), temporarily remains available (using `--code-ancient`). It will be removed at some point in the future. The new code back-end offers several levels of optimization, which remain undocumented and are subject to change in the future. At present, the main levels are roughly as follows: - `-O 0 --represent-everything` uses a uniform representation of the stack and produces straightforward code. - `-O 0` uses a non-uniform representation of the stack; some stack cells have fewer fields; some stack cells disappear altogether. - `-O 1` reduces memory traffic by moving `PUSH` operations so that they meet `POP` operations and cancel out. - `-O 2` optimizes the reduction of unit productions (that is, productions whose right-hand side has length 1) by performing a limited amount of code specialization. The default level of optimization is the maximum level, `-O 2`. * The new command line switch `--exn-carries-state` causes the exception `Error` to carry an integer parameter: `exception Error of int`. When the parser detects a syntax error, the number of the current state is reported in this way. This allows the caller to select a suitable syntax error message, along the lines described in [Section 11](http://cambium.inria.fr/~fpottier/menhir/manual.html#sec68) of the manual. This command line switch is currently supported by the code back-end only. * The `$syntaxerror` keyword is no longer supported. * Document the trick of wrapping module aliases in `open struct ... end`, like this: `%{ open struct module alias M = MyLongModuleName end %}`. This allows you to use the short name `M` in your grammar, but forces OCaml to infer types that refer to the long name `MyLongModuleName`. (Suggested by Frédéric Bour.)