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:
>
> On Apr 30, 2007, at 3:01 PM, Nicolas Pouillard wrote:
>
> > So you have to take the case <:ctyp< $id:i$ >> and then play with `i'
> > that is an ident and can be matched with <:ident< ... >>
>
> It looks like this is being taken care of by the first pattern.
>
> It also looks like the second pattern is matching a list type (in the
> old camlp4).
>
> Does this sound correct?
>
>    let rec tp_path = function
>      | <:ctyp< $lid:id$ >> | <:ctyp< $uid:id$ >> -> [id]
>      | <:ctyp< $tp1$ . $tp2$ >> ->
>         (match tp_path tp2 with [n] -> n | _ -> assert false) ::
> tp_path tp1
>      | _ -> invalid_arg "tp_path"
>

lid is for lower case identifier it's a string
uid is for upper case identifier it's a string
id is for any identifier it's type is ident

id ::= lid | uid | id1 . id2 | id1 id2

A function like tp_path is can be rewrite by a function that works
only on idents.

-- 
Nicolas Pouillard