Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocaml <-> camlp4o <-> camlp4o.opt incompatibility #3469

Closed
vicuna opened this issue Feb 16, 2005 · 5 comments
Closed

ocaml <-> camlp4o <-> camlp4o.opt incompatibility #3469

vicuna opened this issue Feb 16, 2005 · 5 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 16, 2005

Original bug ID: 3469
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hi,

the following two lines are accepted from ocamlc:

type glade_xml = [ `data | `glade_xml ]
let ($) f g x = g (f x)

However, camlp4o complains:

File "t.ml", line 2, characters 5-24:
Lexing error: antiquotation not terminated
Uncaught exception: Token.Error("antiquotation not terminated")

This is new 3.08.2, the .1 version did accept this file.

camlp4o.opt is different from camlp4o, it complains:

File "t.ml", line 1, characters 25-26:
Parse error: ']' expected after [expr1_semi_list] (in [expr])
Uncaught exception: Stream.Error("']' expected after [expr1_semi_list] (in [expr])")

This is also new in 3.08.2, the .1 version produced the camlp4o
error above.

I found both problems when parsing (with otags) the lablgtk
sources with camlp4. I believe this is the second time that I
report a camlp4 problem with the lablgtk sources. May I therefore
suggest to add the complete lablgtk sources to the camlp4 test
suit?

Bye,

Hendrik

@vicuna
Copy link
Author

vicuna commented Feb 17, 2005

Comment author: administrator

Hi,

This is bug #3310 (see
http://caml.inria.fr/bin/caml-bugs/fixed?user=guest;selectid=3310),
already fixed.

Let me resend here a comment about usage of `$' in OCaml programs:

| Subject: Re: Camlp4 treatment of '$' (#3310)
| Date: Mon Nov 29 19:23:43 2004
|
| Hello,
|
| Just one more word about using '$' as an operator: FYI, this is explicitely
| discouraged in the OCaml refman:
| http://caml.inria.fr/ocaml/htmlman/manual009.html
|
| Note that the following identifiers are keywords of the Camlp4 extensions and
| should be avoided for compatibility reasons.
|
| parser << <: >> $ $$ $:

Thanks for the report. Sincerely,

-- Michel Mauny

tews@tcs.inf.tu-dresden.de wrote/écrivait (Thu, Feb 17, 2005 at 12:50:38AM +0100):

Hi,

the following two lines are accepted from ocamlc:

type glade_xml = [ `data | `glade_xml ]
let ($) f g x = g (f x)

However, camlp4o complains:

File "t.ml", line 2, characters 5-24:
Lexing error: antiquotation not terminated
Uncaught exception: Token.Error("antiquotation not terminated")

This is new 3.08.2, the .1 version did accept this file.

camlp4o.opt is different from camlp4o, it complains:

File "t.ml", line 1, characters 25-26:
Parse error: ']' expected after [expr1_semi_list] (in [expr])
Uncaught exception: Stream.Error("']' expected after [expr1_semi_list] (in [expr])")

This is also new in 3.08.2, the .1 version produced the camlp4o
error above.

I found both problems when parsing (with otags) the lablgtk
sources with camlp4. I believe this is the second time that I
report a camlp4 problem with the lablgtk sources. May I therefore
suggest to add the complete lablgtk sources to the camlp4 test
suit?

Bye,

Hendrik


Caml-devel mailing list
Caml-devel@yquem.inria.fr
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-devel

--
Michel Mauny
INRIA Rocquencourt

@vicuna
Copy link
Author

vicuna commented Feb 17, 2005

Comment author: administrator

See bug #3310 (fixed).

@vicuna vicuna closed this as completed Feb 17, 2005
@vicuna
Copy link
Author

vicuna commented Feb 17, 2005

Comment author: administrator

Michel Mauny writes:
From: Michel Mauny Michel.Mauny@inria.fr
Date: Thu, 17 Feb 2005 10:56:30 +0100
Subject: Re: [Caml-devel] ocaml <-> camlp4o <-> camlp4o.opt incompatibility (#3469)

Hi,

This is bug #3310 (see
http://caml.inria.fr/bin/caml-bugs/fixed?user=guest;selectid=3310),
already fixed.

No, when I apply the patch in 3310 I still get

File "t.ml", line 1, characters 25-26:
Parse error: ']' expected after [expr1_semi_list] (in [expr])
Uncaught exception: Stream.Error("']' expected after [expr1_semi_list] (in [expr])")

Let me resend here a comment about usage of `$' in OCaml programs:

Ok, but it should be possible to disable all camlp4 extensions to
make "ocamlc" and "ocamlc -pp camlp4o" fully compatible. For this
reason Daniel once introduced the -no_quot option. However, this
option has no influence on the problems I reported.

Bye,

Hendrik

@vicuna
Copy link
Author

vicuna commented Feb 18, 2005

Comment author: administrator

Hi,

Hendrik Tews wrote/écrivait (Thu, Feb 17, 2005 at 03:32:17PM +0100):

No, when I apply the patch in 3310 I still get

File "t.ml", line 1, characters 25-26:
Parse error: ']' expected after [expr1_semi_list] (in [expr])
Uncaught exception: Stream.Error("']' expected after [expr1_semi_list] (in [expr])")

Ok, I fixed that too in the CVS (changes in plexer.ml broke the
`opt.opt' implementation of camlp4o.opt).

Let me resend here a comment about usage of `$' in OCaml programs:

Ok, but it should be possible to disable all camlp4 extensions to
make "ocamlc" and "ocamlc -pp camlp4o" fully compatible.

Well, "full compatibility" is extremely difficult to guarantee
(the syntax is complex, and parsing (and lexing) technologies are very
different).

For this reason Daniel once introduced the -no_quot option. However,
this option has no influence on the problems I reported.

So far, the -no_quot option had no effect on dollar signs, but only on
symbols '<' opening quotations. I changed this (in the CVS) for
-no_quot to ignore both '<' and '$'. The -no_quot option should
therefore solve your problem, now.

-- Michel

@vicuna
Copy link
Author

vicuna commented Feb 18, 2005

Comment author: administrator

Hi,

Michel Mauny writes:
From: Michel Mauny Michel.Mauny@inria.fr
Date: Fri, 18 Feb 2005 10:40:10 +0100
Subject: Re: [Caml-devel] ocaml <-> camlp4o <-> camlp4o.opt incompatibility (#3469)

Hi,

Ok, I fixed that too in the CVS (changes in plexer.ml broke the
`opt.opt' implementation of camlp4o.opt).

Thanks. I'll tried to extract the patch for plexer.ml 1.20.2.5 -
1.20.2.4 and to apply it to the 3.08.2 sources together with the
patch in #3310. However, this does not work: camlp4o.opt still
produces an parse error.

So I guess I stay with the bytecode version until the next
release.

Ok, but it should be possible to disable all camlp4 extensions to
make "ocamlc" and "ocamlc -pp camlp4o" fully compatible.

Well, "full compatibility" is extremely difficult to guarantee

OK, but you try to achive it? Otherwise otags and similar
applications would loose their base.

Just for compatibility curiousity I diff'ed lablgtk/src/glade.ml
with the result of "camlp4o pr_o.cmo -no_quot". Apart from white
space there are the following differences:

let get_widget_msg ~name ?info xml = ...
==>
let get_widget_msg ~name = fun ?info xml ->

This is not nice, but probably not a problem.

| Object of string * (unit obj -> unit) ==> | Object of (string * (unit obj -> unit))

This is certainly a bug (IMO), because it changes the memory
layout of the datatype.

begin ... end
==>
( ... )

Object.cast $ Object.destroy
==>
( $ ) Object.cast Object.destroy

The last two points are not nice, but not a problem (IMO).

Bye,

Hendrik

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant