caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Caml4p... help
@ 2002-10-09  1:50 Pietro Abate
  2002-10-09  3:35 ` jehenrik
  2002-10-09 11:53 ` Daniel de Rauglaudre
  0 siblings, 2 replies; 4+ messages in thread
From: Pietro Abate @ 2002-10-09  1:50 UTC (permalink / raw)
  To: Ocaml

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-09 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09  1:50 [Caml-list] Caml4p... help Pietro Abate
2002-10-09  3:35 ` jehenrik
2002-10-09  5:46   ` Pietro Abate
2002-10-09 11:53 ` Daniel de Rauglaudre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).