From: Frederic Tronel <Frederic.Tronel@inrialpes.fr>
To: caml-list@inria.fr
Subject: [Caml-list] camlp4 and syntax modifications
Date: Wed, 03 Apr 2002 10:49:06 +0200 [thread overview]
Message-ID: <3CAAC202.40056D40@inrialpes.fr> (raw)
Hello,
I'm using camlp4 to embed a specification language (Lotos)
into caml. I've written quotations that allow to write and
use Lotos expressions directly in my caml code. But I'm facing
a problem with what appears to be slight syntax changes. Here's
an example:
open Lotos (* grammar extension for lotos *)
let _ =
let send f t e = <:sync<SEND ^(Send f) ^(Send t) ^(Send e) >>
in
let p = <:process<process Toto [SEND,RECV] () noexit :=
hide SEND in ((G ; STOP) |[SEND]| (STOP)) [> (Toto [SEND,RECV] ())
where
process Titi [] () noexit := STOP endproc
endproc
>>
in
let s = <:spec<specification toto [SEND,RECV] () : exit(NAT)
behavior
$(send "A" "B" "C") ; [LENGTH L eq 10] -> STOP [] [not(false and
true)] -> STOP
where
^(p)>>
in
Printf.fprintf stdout "%s\n" (dump_spec s 0)
Does compile smoothly (${OCAMLC} -pp "${CAMLP4O} ./lotos.cmo" -I +camlp4
-c test_embedded_lotos.ml)
However if I add a "for" control structure in my code, like:
open Lotos
let _ =
let send f t e = <:sync<SEND ^(Send f) ^(Send t) ^(Send e) >>
in
let p = <:process<process Toto [SEND,RECV] () noexit :=
hide SEND in ((G ; STOP) |[SEND]| (STOP)) [> (Toto [SEND,RECV] ())
where
process Titi [] () noexit := STOP endproc
endproc
>>
in
let s = <:spec<specification toto [SEND,RECV] () : exit(NAT)
behavior
$(send "A" "B" "C") ; [LENGTH L eq 10] -> STOP [] [not(false and
true)] -> STOP
where
^(p)>>
in
for i = 0 to 10 do () done;
Printf.fprintf stdout "%s\n" (dump_spec s 0)
which is perfectly legal according to the original caml syntax, it does
not compile.
/users/tronel/bin/ocamlc -pp "/users/tronel/bin/camlp4o ./lotos.cmo" -I
+camlp4 -c test_embedded_lotos.ml
File "test_embedded_lotos.ml", line 18, characters 5-7:
Parse error: [expr level top] expected after 'in' (in [expr])
Preprocessing error
*** Error code 2
I'm intentionally using the original syntax (camlp4o) since I've a bunch
of code already
written that I don't want to translate to the revised syntax.
What is the correct syntax to use ???
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
next reply other threads:[~2002-04-03 8:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-03 8:49 Frederic Tronel [this message]
2002-04-03 9:21 ` Daniel de Rauglaudre
2002-04-03 10:45 ` [Caml-list] binaire advi pour windows Christophe Raffalli
2002-04-05 14:41 ` Sven
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=3CAAC202.40056D40@inrialpes.fr \
--to=frederic.tronel@inrialpes.fr \
--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).