Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Question about camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frederic Tronel <Frederic.Tronel@i...>
Subject: [Caml-list] Question about camlp4

I'm using ocaml 3.04.
I'm trying to extend ocaml syntax, using camlp4.
But I'm facing a problem.

I have the following rule in my grammar:

spec_exp:  [[ "specification" ; name = LIDENT; "[" ; g = LIST0 gate_exp
SEP "," ; "]" -> <:expr<Specification $str:name$ $list:g$ >> ]] 

and the following definition of type spec:

type spec = Specification of string * gate list

However it does not compile. The compilation returns with the following
error code:
File "", line 46, characters 123-131:
While expanding quotation "expr":
Parse error: end of input expected after [expression] (in [expression])
Preprocessing error

It is related with the term $list:g$. If I replace it with [| $list:g$
|] (for example)
the compilation will fail later saying that the constructor
expects a gate list, not a gate array, which is somehow reasonable.

My question is the following one:
How can I explain that I what the MLast.expr of a list, when $g$ is a
MLast.expr list ????
I did not found the answer in the documentation.

Best regards,

Frederic Tronel.
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: