From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Ashish Agarwal <agarwal1975@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] menhir types cannot be open polymorphic variant
Date: Thu, 13 Feb 2014 23:06:53 +0100 [thread overview]
Message-ID: <CAPFanBHDYRZBDDopEtMofcGk4+J7Wr0DUKnKb8ArR-u5SZ2Xrw@mail.gmail.com> (raw)
In-Reply-To: <CAMu2m2LNpu=NmrALDcgpXJDZg+haS7f5UxDsdtBP7Gh4rhFUWw@mail.gmail.com>
Workaround 1: in another file (this won't work in the menhir header)
type 'a start = [> `Got_int ] as 'a
then use ('a start) instead of [> `Got_int ].
Workaround 2: apply the patch below to the most recent menhir sources
diff -ru menhir-20130911.old/src/lexer.mll menhir-20130911.new/src/lexer.mll
--- menhir-20130911.old/src/lexer.mll 2013-09-11 08:58:39.000000000 +0200
+++ menhir-20130911.new/src/lexer.mll 2014-02-13 23:05:19.240180035 +0100
@@ -344,7 +344,7 @@
of O'Caml variant types, but we ignore that possibility for the moment. *)
and ocamltype openingpos = parse
-| "->"
+| "->" | "[>"
{ ocamltype openingpos lexbuf }
| '>'
{ OCAMLTYPE (Stretch.Declared (mk_stretch true openingpos
(lexeme_start_p lexbuf) [])) }
On Thu, Feb 13, 2014 at 9:55 PM, Ashish Agarwal <agarwal1975@gmail.com> wrote:
> $ cat parser.mly
> %token INT
> %start <[> `Got_int]> main
> %%
> main: INT {`Got_int}
>
> $ menhir parser.mly
> File "parser.mly", line 2, characters 11-11:
> Error: unexpected character(s).
>
> If I make the type exact [`Got_int], it works fine. Is there any way to get
> around this? I need an open type.
>
next prev parent reply other threads:[~2014-02-13 22:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 20:55 Ashish Agarwal
2014-02-13 22:06 ` Gabriel Scherer [this message]
2014-02-14 12:20 ` Francois Pottier
2014-02-14 13:30 ` Ashish Agarwal
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=CAPFanBHDYRZBDDopEtMofcGk4+J7Wr0DUKnKb8ArR-u5SZ2Xrw@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=agarwal1975@gmail.com \
--cc=caml-list@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