[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Pietro Abate <abate@d...> |
| Subject: | [Caml-list] Caml4p... help |
hi everybody,
I've just started playing with Caml4p today and I'm already at a dead
end. My goal is to transform this syntax
str pc : [a;b;c]
into a declaration like that.
let pc_str = `Forall [| `Rule a; `Rule b; `Rule c |]
extending (and in the future restricting) the caml syntax.
I wrote this but I've problems compiling it. It says:
ocamlc -c -pp "camlp4o pa_extend.cmo q_MLast.cmo" -I /usr/lib/ocaml/camlp4 str.ml
File "str.ml", line 18, characters 2-10:
This expression has type unit but is here used with type MLast.expr
make: *** [str.cmi] Error 2
of course the problem in about the "str" type. But I haven't still figured
out why...
Je vous remercie d'avance.
p
----------------------- str.ml ------------------------
(*pp camlp4o pa_extend.cmo q_MLast.cmo *)
open Pcaml;;
type kind = [
|`Rule of string
|`First of kind array
|`Forall of kind array
]
let str = Grammar.Entry.create gram "str";;
EXTEND
expr: AFTER "top"
[[ "str"; n = LINDENT; ":"; s = str ->
<:expr< let $lid:n$ = $s$ in $lid:n$ >> ]];
str: [[
| n = LINDENT -> <:expr<`Rule $str:n$>>
| "["; s = LIST1 str SEP ";"; "]" -> <:expr<`Forall [|$list:s$|] >>
| "{"; s = LIST1 str SEP ";"; "}" -> <:expr<`First [|$list:s$|] >> ]];
END;;
--
pgp key: 1024D/8A091922 2000-10-18 Pietro Abate <abate@arp.anu.edu.au>
Key fingerprint = 5111 D91B 5E0C 5CE6 FDA3 5EF4 6120 E18E 8A09 1922
public key avalaible via public key server at wwwkeys.eu.pgp.net
-------------------
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