Version française
Home     About     Download     Resources     Contact us    
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
Hello,


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 "lotos.ml", 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
Specification
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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners