From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: jon@ffconsultancy.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocamlyacc: e - the start symbol expr has a polymorphic type
Date: Wed, 09 Nov 2005 21:26:03 +0900 (JST) [thread overview]
Message-ID: <20051109.212603.63126983.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <200511081324.32311.jon@ffconsultancy.com>
From: Jon Harrop <jon@ffconsultancy.com>
> I'm just trying to write an example parser using ocamlyacc and have come
> across a minor irritation.
>
> The example is a calculator and, in the interests of brevity, I'd like to
> return the AST as a polymorphic variant. However, if I define the return type
> from the grammar rule as:
>
> %type <[`Num of float | `Op2 of [`Plus|`Times] * 'a * 'a] as 'a> expr
>
> I get the error:
>
> ocamlyacc: e - the start symbol expr has a polymorphic type
>
> This type certainly contains the type variable 'a but I'm not sure
> I'd call it polymorphic.
Indeed, it is not.
But if you look at ocamlyacc's source, you will realize this is a C
program, which was derived from old BSD yacc (I believe.)
Difficult to expect it to understand the whole grammar of types, and
it is better to be on the safe side.
Note that a pure ocaml yacc replacement is in preparation, which might
be able to solve such problems.
Jacques Garrigue
next prev parent reply other threads:[~2005-11-09 12:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-08 13:24 Jon Harrop
2005-11-09 12:26 ` Jacques Garrigue [this message]
2005-11-09 12:39 ` [Caml-list] " skaller
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=20051109.212603.63126983.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=jon@ffconsultancy.com \
/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