caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] possible camlp4 problem/bug with literal booleans in expr quotations.
  2003-01-09 11:18 [Caml-list] possible camlp4 problem/bug with literal booleans in expr quotations Maas-Maarten Zeeman
@ 2003-01-09 11:00 ` Daniel de Rauglaudre
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel de Rauglaudre @ 2003-01-09 11:00 UTC (permalink / raw)
  To: caml-list

Hi,

On Thu, Jan 09, 2003 at 12:18:19PM +0100, Maas-Maarten Zeeman wrote:

>    EXTEND
>      expr: LEVEL "expr1"
>        [ [ "forever"; body=expr ->
>               <:expr< while true do { $body$ } >> ] ];
>    END;;

Not "true", but "True": in Revised syntax, which is used in quotations
of syntax trees, the constructors "True" and "False" must start with
an uppercase letter.

If you write it with a lowercase letter, the generated syntax tree
will represent the *variable* (not the *constructor*) named "true",
which does not exist in OCaml.

-- 
Daniel de RAUGLAUDRE
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] 2+ messages in thread

* [Caml-list] possible camlp4 problem/bug with literal booleans in expr quotations.
@ 2003-01-09 11:18 Maas-Maarten Zeeman
  2003-01-09 11:00 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 2+ messages in thread
From: Maas-Maarten Zeeman @ 2003-01-09 11:18 UTC (permalink / raw)
  To: caml-list

Hi,

I'm experimenting with camlp4 and found this problem.

file: forever.ml

   #load "q_MLast.cmo";;
   #load "pa_extend.cmo";;

   open Pcaml;;

   EXTEND
     expr: LEVEL "expr1"
       [ [ "forever"; body=expr ->
              <:expr< while true do { $body$ } >> ] ];
   END;;

file: bar.ml

   let _ = forever print_string "0";

compilation:

   $ ocamlc -pp camlp4o -I +camlp4 -c forever.ml
   $ ocamlc -pp "camlp4o ./forever.cmo" bar.ml
   File "bar.ml", line 1, characters 8-33:
   Unbound value true

But when you substitute 1=1 for true this works as expected. Can true 
not be used as literal in expr quotations?

Thanks,

Maas


-------------------
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] 2+ messages in thread

end of thread, other threads:[~2003-01-09 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 11:18 [Caml-list] possible camlp4 problem/bug with literal booleans in expr quotations Maas-Maarten Zeeman
2003-01-09 11:00 ` 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).