Version française
Home     About     Download     Resources     Contact us    
Browse thread
Upgrading sexplib-2.7.0 to camlp4 3.10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: Upgrading sexplib-2.7.0 to camlp4 3.10
On 4/30/07, Joel Reymont <joelr1@gmail.com> wrote:
> One last chunk in that huge file...
>
> ---
> Parse error: Deprecated syntax, the grammar module is expected
> Preprocessor error
> ---
>
> This points at "str" in Pcaml.str_item in DELETE_RULE. How do I fix?
>
> Also, would you have any comments on the code in EXTEND?
>

Hum that part is really parsing specific, and my answer is only partial.

The hard point is that there no more a list of type_declaration but a
type_declaration with some `and' nodes to separate them.

open Camlp4.PreCast;;
open Syntax;;

(* now removes all Pcaml. *)

> DELETE_RULE

DELETE_RULE Gram

>    Pcaml.str_item: "type"; LIST1 Pcaml.type_declaration SEP "and"

str_item: "type"; type_declaration

> END

You should look at camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml

> EXTEND

EXTEND Gram

[...]

>      | _ -> <:str_item< declare $tydef$; $valdef$; end >> ]];
| _ -> <:str_item< $tydef$; $valdef$ >> ]];

>
>    Pcaml.str_item:
>    [[ "SEXP_CONV_PATH"; conv_path = STRING ->
>      set_conv_path conv_path;

>      StDcl (_loc, [])
<:str_item<>>

>    ]];
> END
>

-- 
Nicolas Pouillard