Version française
Home     About     Download     Resources     Contact us    
Browse thread
try .. finally using new camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Bruno De Fraine <Bruno.De.Fraine@v...>
Subject: Re: [Caml-list] try .. finally using new camlp4
On 09 Jul 2007, at 15:06, Nicolas Pouillard wrote:
> Let's go

Of course, if you wrote the thing, it's easy... :-)

>>   EXTEND Gram
>>     expr: LEVEL "top"
>>     [[ "try"; f=expr; "finally"; g=expr ->
> Here one extend a rule. So in order to have something working properly
> one *must* look at the original rule.
>
> There is the up-to-date rule:
>
> $ cvs ann -r release310
> camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml | grep '"try"'
> Annotations for camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
> ***************
> 1.2.2.11     (pouillar 04-Apr-07):         | "try"; e = sequence;
> "with"; a = match_case ->
>
> So the correct rule is:
>     [[ "try"; f=sequence; "finally"; g=expr ->

Just a remark, you don't need the source code to check the existing  
definition.

$ ocaml camlp4orf.cma
# open Camlp4.PreCast ;;
# Gram.Entry.print Format.std_formatter Syntax.expr ;;

Will show:

expr: [
...
| "top" RIGHTA [
...
   | "try"; sequence; "with"; match_case

Regards,
Bruno

--
Bruno De Fraine
Vrije Universiteit Brussel
Faculty of Applied Sciences, DINF - SSEL
Room 4K208, Pleinlaan 2, B-1050 Brussels
tel: +32 (0)2 629 29 75
fax: +32 (0)2 629 28 70
e-mail: Bruno.De.Fraine@vub.ac.be