caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <abate@discus.anu.edu.au>
To: Ocaml <caml-list@inria.fr>
Subject: [Caml-list] Caml4p... help
Date: Wed, 9 Oct 2002 11:50:23 +1000	[thread overview]
Message-ID: <20021009015023.GA10937@zed> (raw)

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


             reply	other threads:[~2002-10-09  1:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-09  1:50 Pietro Abate [this message]
2002-10-09  3:35 ` jehenrik
2002-10-09  5:46   ` Pietro Abate
2002-10-09 11:53 ` Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021009015023.GA10937@zed \
    --to=abate@discus.anu.edu.au \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).