caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] camlp4 and syntax modifications
@ 2002-04-03  8:49 Frederic Tronel
  2002-04-03  9:21 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 4+ messages in thread
From: Frederic Tronel @ 2002-04-03  8:49 UTC (permalink / raw)
  To: caml-list

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


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

* Re: [Caml-list] camlp4 and syntax modifications
  2002-04-03  8:49 [Caml-list] camlp4 and syntax modifications Frederic Tronel
@ 2002-04-03  9:21 ` Daniel de Rauglaudre
  2002-04-03 10:45   ` [Caml-list] binaire advi pour windows Christophe Raffalli
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel de Rauglaudre @ 2002-04-03  9:21 UTC (permalink / raw)
  To: caml-list

Hi,

On Wed, Apr 03, 2002 at 10:49:06AM +0200, Frederic Tronel wrote:

> 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:

I think that you did not understand how to use the quotations: the
"original" syntax (camlp4o), like you say, does not concern the
contents of the quotations, but only the rest of your program (what
is *not* in the quotations).

What is inside the quotations is treated by your quotation expander
which, depending on how you programmed it, can parse C, Java, Fortran,
Basic, Calculus of Constructions, English, Slang, String, ignored
garbage, Lambda Calculus, APL, HTML... anything.

Therefore, we first need to see the code of your quotation expander.

Second: you don't have to open your quotation expander file in your
program. The statement "open Lotos" is unuseful. The quotation
expander is for *parsing* time, not for *execution* time.
If you need specific library functions, it is better to put them in
another file, because the code in your file lotos.ml concerns
syntactic statements which you probably don't need at execution time.

When you use Camlp4, you need to understand the difference between
   - what is of the level of the "compiler" (camlp4) and 
   - what is of the level of your program

Feel free to ask more information if you need.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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

* [Caml-list] binaire advi pour windows
  2002-04-03  9:21 ` Daniel de Rauglaudre
@ 2002-04-03 10:45   ` Christophe Raffalli
  2002-04-05 14:41     ` Sven
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Raffalli @ 2002-04-03 10:45 UTC (permalink / raw)
  To: caml-list


Pour me faire gagner un temps précieux ... quelqu'un a-t-il déjà un
binaire windows de ActiveDVI ...

Il serait judicieux de mettre plusieurs binaires advi sur la page pour
permettre aux gens qui on fait leur dvi sous un système de faire la
présentation sur un autre ...

Merci d'avance ...

PS: pas de virus dans le binaire SVP :-(

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
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

* Re: [Caml-list] binaire advi pour windows
  2002-04-03 10:45   ` [Caml-list] binaire advi pour windows Christophe Raffalli
@ 2002-04-05 14:41     ` Sven
  0 siblings, 0 replies; 4+ messages in thread
From: Sven @ 2002-04-05 14:41 UTC (permalink / raw)
  To: Christophe Raffalli; +Cc: caml-list

On Wed, Apr 03, 2002 at 12:45:32PM +0200, Christophe Raffalli wrote:
> 
> Pour me faire gagner un temps précieux ... quelqu'un a-t-il déjà un
> binaire windows de ActiveDVI ...
> 
> Il serait judicieux de mettre plusieurs binaires advi sur la page pour
> permettre aux gens qui on fait leur dvi sous un système de faire la
> présentation sur un autre ...

J'imagine que une version de advi pour windows necessiterait une install TeX
sur la machine windows, ou au moins une partie de celle-ci (fonts, programmes
de gestions de fonts, ...)

Ce qui serait aussi sympa, ce serait une serie de benchmark pour differentes
puissance de machine.

Amicalement,

Sven Luther
-------------------
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-04-05 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03  8:49 [Caml-list] camlp4 and syntax modifications Frederic Tronel
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

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).