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

Issues with identifiers in DM4F affecting extraction #1001

Closed
victor-dumitrescu opened this issue Apr 19, 2017 · 4 comments
Closed

Issues with identifiers in DM4F affecting extraction #1001

victor-dumitrescu opened this issue Apr 19, 2017 · 4 comments

Comments

@victor-dumitrescu
Copy link
Member

Some names used internally in DM4F are not valid OCaml identifiers, causing syntax errors in the extracted code. The examples I've hit so far are:

  • variables beginning with uppercase letter, when the name of the user defined effect also begins with an uppercase letter (e.g. in examples/dm4free/FStar.DM4F.Exceptions.fst, for effect EXN, extracting let EXN___proj__EXN__item__raise_elab e uu____234 = ...
  • names containing ^ or - (e.g. g^w)

Some quick fixes would be to either generate these names slightly differently in DM4F or to modify them afterwards if extracting.

victor-dumitrescu added a commit that referenced this issue Apr 19, 2017
modulo some bugs with names generated in DM4F which are not valid in OCaml (#1001)
@mtzguido
Copy link
Member

I think this might be fixed in my branch guido_bug1001 (f6baab15), but I'm having a hard time trying to compile the extracted code, so I'm not completely sure.

Just making a note so we don't forget.

@msprotz
Copy link
Collaborator

msprotz commented Apr 20, 2017

FYI the code to find a good name for a given let-bound variable is there: https://github.com/FStarLang/FStar/blob/master/src/extraction/FStar.Extraction.ML.UEnv.fs#L193 so you could conceivably change this code to make sure it doesn't shadow anything, but also to make sure it picks a valid OCaml identifier.

@mtzguido
Copy link
Member

mtzguido commented Apr 20, 2017

That sounds like a good change too! But should we really have these kind of names generated by DM4F?

They're also invalid F* names, it just doesn't matter only since it's all internal to the compiler (as far as I understand)

mtzguido added a commit that referenced this issue May 4, 2017
in case some internal F* identifiers are not valid in OCaml,this
should do the trick of fixing it up

c.f. #1001
@mtzguido
Copy link
Member

mtzguido commented May 4, 2017

Pushed a change as per Jonathan's suggestion to the guido_bug1001 branch. Tests run OK, but if any of you could review to see if it's sane that'd be great.

mtzguido added a commit that referenced this issue Jun 14, 2017
mtzguido added a commit that referenced this issue Jun 14, 2017
Not caught by the #1001 fix, apparently...
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

3 participants