caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
@ 2014-08-01 11:03 Kim Nguyễn
  2014-08-01 14:12 ` Richard W.M. Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Kim Nguyễn @ 2014-08-01 11:03 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: caml-list

Hi Richard, hi everyone,


On Thu, Jul 31, 2014 at 4:21 PM, Richard W.M. Jones <rich@annexia.org> wrote:
>
> I wonder if anyone has managed to compile cduce with OCaml 4.02?
>
> Currently it fails at:
>
>   File "parser/parser.ml", line 2, characters 0-6:
>   Error: Unbound constructor Ulexer

note: for me it "fails" (I kill ocamlopt) before because of a long
forgotten -inline 10000 that makes ocaml generate a large ( >90 MB .s
file on which "as" takes a lot of time, for typing/typer.ml), putting
a saner -inline 100 in Makefile.distribg makes the file compile and I
can stumble on the same camlp4 issue:

> The post-preprocessor code looks very wrong to me:
>
>   let _ = Ulexer      ## generated from input "open Ulexer"
>
>   let tloc (i, j) = (i, (* let raise = Pervasives.raise *) j)
>
>   let nopos = ((-1), (-1))
>
> It could be a bug in camlp4?

The following test cases exhibit the problematic behavior of camlp4 (I
don't know if it's just an intended change in behaviour or a bug, I
don't mind filling a bug report in the latter case):

bug1.ml -----------------------
#load "pa_extend.cmo";;

open A
open B
open C
open D
open E

bug2.ml -----------------------

#load "pa_extend.cmo";;

open A
open B
open C
open D
open E
open F

$ camlp4 -version
4.02.0+dev12-2014-07-30

$ camlp4o bug1.ml
E

$ camlp4o bug2.ml
let _ = E

open F



Note that if I don't go until "open E" the output file is empty

with camlp4 from ocaml 4.01.0, everything works as expected (that is
the #load is absent from the output, and all the open A...F are
present in the output).


Cheers,
-- 
Kim

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

* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
  2014-08-01 11:03 [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ] Kim Nguyễn
@ 2014-08-01 14:12 ` Richard W.M. Jones
  2014-08-01 15:11   ` Jeremie Dimino
  0 siblings, 1 reply; 6+ messages in thread
From: Richard W.M. Jones @ 2014-08-01 14:12 UTC (permalink / raw)
  To: Kim Nguyễn; +Cc: caml-list

On Fri, Aug 01, 2014 at 01:03:19PM +0200, Kim Nguyễn wrote:
> Hi Richard, hi everyone,
> 
> 
> On Thu, Jul 31, 2014 at 4:21 PM, Richard W.M. Jones <rich@annexia.org> wrote:
> >
> > I wonder if anyone has managed to compile cduce with OCaml 4.02?
> >
> > Currently it fails at:
> >
> >   File "parser/parser.ml", line 2, characters 0-6:
> >   Error: Unbound constructor Ulexer
> 
> note: for me it "fails" (I kill ocamlopt) before because of a long
> forgotten -inline 10000 that makes ocaml generate a large ( >90 MB .s
> file on which "as" takes a lot of time, for typing/typer.ml), putting
> a saner -inline 100 in Makefile.distribg makes the file compile and I
> can stumble on the same camlp4 issue:
> 
> > The post-preprocessor code looks very wrong to me:
> >
> >   let _ = Ulexer      ## generated from input "open Ulexer"
> >
> >   let tloc (i, j) = (i, (* let raise = Pervasives.raise *) j)
> >
> >   let nopos = ((-1), (-1))
> >
> > It could be a bug in camlp4?
> 
> The following test cases exhibit the problematic behavior of camlp4 (I
> don't know if it's just an intended change in behaviour or a bug, I
> don't mind filling a bug report in the latter case):
> 
> bug1.ml -----------------------
> #load "pa_extend.cmo";;
> 
> open A
> open B
> open C
> open D
> open E
> 
> bug2.ml -----------------------
> 
> #load "pa_extend.cmo";;
> 
> open A
> open B
> open C
> open D
> open E
> open F
> 
> $ camlp4 -version
> 4.02.0+dev12-2014-07-30
> 
> $ camlp4o bug1.ml
> E
> 
> $ camlp4o bug2.ml
> let _ = E
> 
> open F
> 
> 
> 
> Note that if I don't go until "open E" the output file is empty

FWIW I observe the same thing.

Rich.

-- 
Richard Jones
Red Hat

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

* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
  2014-08-01 14:12 ` Richard W.M. Jones
@ 2014-08-01 15:11   ` Jeremie Dimino
  2014-08-01 16:31     ` Kim Nguyễn
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremie Dimino @ 2014-08-01 15:11 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: Kim Nguyễn, caml-list

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

Could you fill an issue there: https://github.com/ocaml/camlp4 ?

About the bug I wouldn't rely too much on #-directives to extend the
syntax. There have been bugs with this in the past and it is quite annoying
to fix. Passing the extensions on the command line is more reliable.


On Fri, Aug 1, 2014 at 3:12 PM, Richard W.M. Jones <rich@annexia.org> wrote:

> On Fri, Aug 01, 2014 at 01:03:19PM +0200, Kim Nguyễn wrote:
> > Hi Richard, hi everyone,
> >
> >
> > On Thu, Jul 31, 2014 at 4:21 PM, Richard W.M. Jones <rich@annexia.org>
> wrote:
> > >
> > > I wonder if anyone has managed to compile cduce with OCaml 4.02?
> > >
> > > Currently it fails at:
> > >
> > >   File "parser/parser.ml", line 2, characters 0-6:
> > >   Error: Unbound constructor Ulexer
> >
> > note: for me it "fails" (I kill ocamlopt) before because of a long
> > forgotten -inline 10000 that makes ocaml generate a large ( >90 MB .s
> > file on which "as" takes a lot of time, for typing/typer.ml), putting
> > a saner -inline 100 in Makefile.distribg makes the file compile and I
> > can stumble on the same camlp4 issue:
> >
> > > The post-preprocessor code looks very wrong to me:
> > >
> > >   let _ = Ulexer      ## generated from input "open Ulexer"
> > >
> > >   let tloc (i, j) = (i, (* let raise = Pervasives.raise *) j)
> > >
> > >   let nopos = ((-1), (-1))
> > >
> > > It could be a bug in camlp4?
> >
> > The following test cases exhibit the problematic behavior of camlp4 (I
> > don't know if it's just an intended change in behaviour or a bug, I
> > don't mind filling a bug report in the latter case):
> >
> > bug1.ml -----------------------
> > #load "pa_extend.cmo";;
> >
> > open A
> > open B
> > open C
> > open D
> > open E
> >
> > bug2.ml -----------------------
> >
> > #load "pa_extend.cmo";;
> >
> > open A
> > open B
> > open C
> > open D
> > open E
> > open F
> >
> > $ camlp4 -version
> > 4.02.0+dev12-2014-07-30
> >
> > $ camlp4o bug1.ml
> > E
> >
> > $ camlp4o bug2.ml
> > let _ = E
> >
> > open F
> >
> >
> >
> > Note that if I don't go until "open E" the output file is empty
>
> FWIW I observe the same thing.
>
> Rich.
>
> --
> Richard Jones
> Red Hat
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



-- 
Jeremie

[-- Attachment #2: Type: text/html, Size: 4093 bytes --]

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

* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
  2014-08-01 15:11   ` Jeremie Dimino
@ 2014-08-01 16:31     ` Kim Nguyễn
  2014-08-02 12:35       ` Richard W.M. Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Kim Nguyễn @ 2014-08-01 16:31 UTC (permalink / raw)
  To: Jeremie Dimino; +Cc: Richard W.M. Jones, caml-list

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

Hi

On Fri, Aug 1, 2014 at 5:11 PM, Jeremie Dimino <jdimino@janestreet.com> wrote:
> Could you fill an issue there: https://github.com/ocaml/camlp4 ?

Done, this is issue #42. As explained in the bug report, using the
ocamlfind package "camlp4.extend" fixes the issue for us.

For those interested I'm attaching a patch that allows one to compile
cduce with the current ocaml trunk (I only tested using the
4.02.0+trunk switch of opam).

Cheers,
-- 
Kim

[-- Attachment #2: cduce_ocaml_4.02.0.patch --]
[-- Type: text/x-patch, Size: 1209 bytes --]

diff -uprNZ cduce-0.6.0/Makefile.distrib cduce-0.6.1/Makefile.distrib
--- cduce-0.6.0/Makefile.distrib	2014-03-05 14:49:17.000000000 +0100
+++ cduce-0.6.1/Makefile.distrib	2014-08-01 18:15:14.606679963 +0200
@@ -17,7 +17,7 @@ ifeq ($(NATIVE),true)
 all: cduce_lib.cmxa
 endif
 
-PACKAGES = dynlink camlp4 ulex pcre num netstring 
+PACKAGES = dynlink camlp4 camlp4.extend ulex pcre num netstring 
 
 # Call make with VERBOSE=true to get a trace of commands
 
@@ -41,14 +41,14 @@ SYNTAX_PARSER = -syntax camlp4o $(SYNTAX
 CAMLC_P = ocamlc -g
 DEPEND_OCAMLDEP = misc/q_symbol.cmo
 ifeq ($(PROFILE), true)
-  CAMLOPT_P = ocamlopt -p -inline 10000
+  CAMLOPT_P = ocamlopt -p -inline 100
   ifeq ($(NATIVE), false) 
     CAMLC_P = ocamlcp -p a
     SYNTAX_PARSER = 
     DEPEND_OCAMLDEP =
   endif
 else
-  CAMLOPT_P = ocamlopt -inline 10000
+  CAMLOPT_P = ocamlopt -inline 100
 endif
 
 OPT = -warn-error FPSXY
diff -uprNZ cduce-0.6.0/parser/parser.ml cduce-0.6.1/parser/parser.ml
--- cduce-0.6.0/parser/parser.ml	2014-03-05 14:49:17.000000000 +0100
+++ cduce-0.6.1/parser/parser.ml	2014-08-01 18:14:52.822680449 +0200
@@ -1,4 +1,3 @@
-#load "pa_extend.cmo";;
 
 open Cduce_loc
 (* let raise = Pervasives.raise *)

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

* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
  2014-08-01 16:31     ` Kim Nguyễn
@ 2014-08-02 12:35       ` Richard W.M. Jones
  2014-08-02 13:11         ` Kim Nguyễn
  0 siblings, 1 reply; 6+ messages in thread
From: Richard W.M. Jones @ 2014-08-02 12:35 UTC (permalink / raw)
  To: Kim Nguyễn; +Cc: Jeremie Dimino, caml-list

On Fri, Aug 01, 2014 at 06:31:22PM +0200, Kim Nguyễn wrote:
> Hi
> 
> On Fri, Aug 1, 2014 at 5:11 PM, Jeremie Dimino <jdimino@janestreet.com> wrote:
> > Could you fill an issue there: https://github.com/ocaml/camlp4 ?
> 
> Done, this is issue #42. As explained in the bug report, using the
> ocamlfind package "camlp4.extend" fixes the issue for us.
> 
> For those interested I'm attaching a patch that allows one to compile
> cduce with the current ocaml trunk (I only tested using the
> 4.02.0+trunk switch of opam).

That's better, but it still fails with 4.02 from git:

File "runtime/run_dispatch.ml", line 222, characters 41-43:
Failure: "antiquotation not allowed here"
File "runtime/run_dispatch.ml", line 1:
Error: Error while running external preprocessor

(If you comment out that use of $$ then it fails on an earlier one)

Rich.

-- 
Richard Jones
Red Hat

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

* Re: [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ]
  2014-08-02 12:35       ` Richard W.M. Jones
@ 2014-08-02 13:11         ` Kim Nguyễn
  0 siblings, 0 replies; 6+ messages in thread
From: Kim Nguyễn @ 2014-08-02 13:11 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: caml-list

On Sat, Aug 2, 2014 at 2:35 PM, Richard W.M. Jones <rich@annexia.org> wrote:

> That's better, but it still fails with 4.02 from git:
>
> File "runtime/run_dispatch.ml", line 222, characters 41-43:
> Failure: "antiquotation not allowed here"
> File "runtime/run_dispatch.ml", line 1:
> Error: Error while running external preprocessor
>
> (If you comment out that use of $$ then it fails on an earlier one)

Thanks for reporting this.  I have created a branch
stable-for-ocaml-4.02 in our git
(git clone https://git.cduce.org/cduce ) where I'll work on fixing these issues.

Issues concerning cduce can be reported on our (recently installed) bug tracker:

https://www.cduce.org/redmine/projects/cduce/

Or by private e-mail to me, if you don't want to register an account
(we will have our mailing list up and running shortly)


Cheers,
-- 
Kim

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

end of thread, other threads:[~2014-08-02 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-01 11:03 [Caml-list] Bug in camlp4 4.02 ? [ was: cduce on ocaml 4.02 ] Kim Nguyễn
2014-08-01 14:12 ` Richard W.M. Jones
2014-08-01 15:11   ` Jeremie Dimino
2014-08-01 16:31     ` Kim Nguyễn
2014-08-02 12:35       ` Richard W.M. Jones
2014-08-02 13:11         ` Kim Nguyễn

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