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: signature.asc
Description: PGP signature

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to