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

camlp4 incompatible with open! #6175

Closed
vicuna opened this issue Sep 12, 2013 · 5 comments
Closed

camlp4 incompatible with open! #6175

vicuna opened this issue Sep 12, 2013 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Sep 12, 2013

Original bug ID: 6175
Reporter: yminsky
Assigned to: @bobzhang
Status: closed (set by @xavierleroy on 2015-12-11T18:24:12Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.01.0
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @bobzhang @gasche @hcarty "Hendrik Tews"

Bug description

The new open! syntax does not appear to work with camlp4.

Steps to reproduce

here's an example (using rc2, which I assume is the same as 4.01.0):

$ ocaml
OCaml version 4.01.0+rc2

#require "topfind";;

Unknown directive `require'.

#use "topfind";;

  • : unit = ()
    Findlib has been successfully loaded. Additional directives:
    #require "package";; to load a package
    #list;; to list the available packages
    #camlp4o;; to load camlp4 (standard syntax)
    #camlp4r;; to load camlp4 (revised syntax)
    #predicates "p,q,...";; to set these predicates
    Topfind.reset();; to force that packages will be reloaded
    #thread;; to enable threads

  • : unit = ()

#camlp4o;;

/Users/yminsky/.opam/4.01.0/lib/ocaml/dynlink.cma: loaded
/Users/yminsky/.opam/4.01.0/lib/ocaml/camlp4: added to search path
/Users/yminsky/.opam/4.01.0/lib/ocaml/camlp4/camlp4o.cma: loaded
Camlp4 Parsing version 4.01.0+rc2

open! Map;;

Characters 0-4:
open! Map;;
^^^^
Error: Parse error: [module_longident] expected after "open" (in [str_item])

@vicuna
Copy link
Author

vicuna commented Sep 12, 2013

Comment author: @bobzhang

This was implemented in the trunk. Damien may comment on this

@vicuna
Copy link
Author

vicuna commented Sep 13, 2013

Comment author: yminsky

As a more general note, I wonder if there should be more testing against camlp4 for this kind of thing. It seems reasonably predictable that new syntactic constructs like this will break camlp4. One could imagine a test-suite that has a file containing examples of a wide variety of OCaml syntactic constructs, to which new ones would get added as the language is extended. One could then make sure that this file compiles cleanly under camlp4.

@vicuna
Copy link
Author

vicuna commented Sep 13, 2013

Comment author: furuse

QuickCheck style test may be useful here.

@vicuna
Copy link
Author

vicuna commented Sep 25, 2013

Comment author: @alainfrisch

Indeed, it would be useful to have a module exercising all the grammar rules. Ideally, we should either do some coverage check to ensure that all (non-error) productions in parser.mly are used, or generate the code automatically from the parser specification.

@vicuna
Copy link
Author

vicuna commented Sep 25, 2013

Comment author: @bobzhang

I did not find branch 4.01.1, I applied the patch on top of 4.01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant