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

Char ranges. OCaml 0-255, NHol with F# 0-65535 #1

Open
EricGT opened this issue Aug 23, 2013 · 3 comments
Open

Char ranges. OCaml 0-255, NHol with F# 0-65535 #1

EricGT opened this issue Aug 23, 2013 · 3 comments
Assignees

Comments

@EricGT
Copy link
Collaborator

EricGT commented Aug 23, 2013

HOL Light with OCaml uses a char range of 0-255.
With F# based on .NET the char range is 0-65535.

This will cause problems with functions based on printer.ctable such as printer.isspace, printer.issymb, etc. because they will throw System.IndexOutOfRangeException for a char with a value of 256 or greater as ctable is an array with only 255 values.

For now we will limit the input values from 0-255 to be in agreement with the OCaml range, but latter may modify the functions to handle the fuller range of characters.

@ghost ghost assigned EricGT Aug 23, 2013
@jack-pappas
Copy link
Owner

ctable has 256 values by default, but it could be larger if any of the strings used to initialize it (e.g., alphas) contain characters with a larger value. We could just as easily initialize ctable to have 65536 entries (System.Char.MaxValue), as that's not much memory in the grand scheme of things.

We should probably leave the code as-is for now though, because the way the lexer/parser works it's going to be very slow if we use Checked.byte or manually check that value <= 255 and also because (eventually) it'd be nice to lift this ASCII restriction since it's a carry-over from OCaml and not a problem on .NET.

@EricGT
Copy link
Collaborator Author

EricGT commented Aug 26, 2013

Need to be aware of differences in escape characters when converting.

OCaml
F#

OCaml has backslash space while F# does not.

F# has Unicocde using \uXXXX or \UXXXXXXXX while OCaml does not.

@EricGT EricGT closed this as completed Aug 26, 2013
@EricGT EricGT reopened this Aug 26, 2013
@EricGT
Copy link
Collaborator Author

EricGT commented Aug 26, 2013

Didn't mean to close this. Still learning Github issues management.

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

No branches or pull requests

2 participants