caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: Jake Donham <jake@donham.org>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] camlp4 parser accepts more than its grammar?
Date: Fri, 27 Jun 2008 10:29:58 +0200	[thread overview]
Message-ID: <1214554558-sup-9348@ausone.inria.fr> (raw)
In-Reply-To: <c7e4e9f0806261410n645217c1qb89ac81a531030e0@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

Excerpts from Jake Donham's message of Thu Jun 26 23:10:20 +0200 2008:
> Hi list,
> 
> I expected the following program to fail with a parse error, but it
> happily ignores the extra '+'. I would be grateful if someone could
> point out what I'm doing wrong. Thanks,

Nothing wrong from you, that's a camlp4 known bug (PR#4551, PR#4513...).

> open Camlp4.PreCast;;
> 
> let expr = Gram.Entry.mk "expr";;
> let stmt = Gram.Entry.mk "stmt";;
> 
> EXTEND Gram
>   expr: [[
>     x = expr; "+"; y = expr -> x + y
>   | x = INT -> int_of_string x
>   ]];
>   stmt:
>   [[ e = expr; ";"; `EOI -> e ]];
> END;;
> 
> prerr_endline (string_of_int (Gram.parse_string stmt Loc.ghost "2 + 1 + ;"))
> 

-- 
Nicolas Pouillard aka Ertai

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 286 bytes --]

  reply	other threads:[~2008-06-27  8:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 21:10 Jake Donham
2008-06-27  8:29 ` Nicolas Pouillard [this message]
2008-06-27  8:42   ` [Caml-list] " Till Varoquaux
2008-07-01  0:01     ` Arthur Chan
2008-07-01  7:02       ` blue storm

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=1214554558-sup-9348@ausone.inria.fr \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jake@donham.org \
    /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;
as well as URLs for NNTP newsgroup(s).