Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 and dirac notation
[ 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: [Caml-list] camlp4 and dirac notation
On 3/19/07, michel levy <michel.levy@imag.fr> wrote:
> I try to modify the ocaml syntax with camlp4 to add the Dirac notation
> |v >.
> Have you any solution ?
>
> I have tried with
> EXTEND
>    expr : LEVEL "simple"
>    [["|"; e=expr ;">" -> <:expr< ket $e$>>]

e = expr LEVEL "simple"

You don't want to allow any expression here since it will be ambiguous
with the '>' operator.

You even perhaps don't want an expression here |(f x y z)> seems not
really readable, you can allow only identifiers.

 [["|"; id = LIDENT ;">" -> <:expr< ket $lid:id$>> ]]

Hope this helps,

-- 
Nicolas Pouillard