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

parse REAL literals to convenient form #193

Merged
merged 1 commit into from
Nov 29, 2021
Merged

parse REAL literals to convenient form #193

merged 1 commit into from
Nov 29, 2021

Conversation

raehik
Copy link
Collaborator

@raehik raehik commented Nov 17, 2021

We decompose REALs to their respective parts (significand & exponent),
but keep the numeric parts as strings to allow the user to select how to
represent the value. Along with a printer and parser, we also export a
"reader" to convert parsed REAL literals to any compatible Fortran type,
so for most uses users will only need that function to turn a Fortran
REAL literal into a Haskell value. (Previously, everyone had to
implement their own parsing.)

@raehik raehik force-pushed the real-lit-parsing branch 2 times, most recently from 1de87b0 to 0b1fa7e Compare November 17, 2021 14:29
@raehik raehik marked this pull request as ready for review November 17, 2021 14:52
@raehik
Copy link
Collaborator Author

raehik commented Nov 17, 2021

This e.g. lets Camfort support the various Fortran-style real literals (instead of trying to read as a Haskell real), and fortran-vars not do any extra parsing work.

@raehik
Copy link
Collaborator Author

raehik commented Nov 17, 2021

@dominic would you be able to give this a quick look over? I'll bring it on Mon otherwise. It's largely adapted from some other code I wrote before but now gets called during parsing (actually, during lexing for free form, parsing for fixed form -- I stuck with the existing patterns)

@raehik
Copy link
Collaborator Author

raehik commented Nov 19, 2021

Oops, I'd already said I wasn't around Monday. I'm preparing other changes around this so it can all merge quick and smooth when we've discussed it.

We decompose REALs to their respective parts (significand & exponent),
but keep the numeric parts as strings to allow the user to select how to
represent the value. Along with a printer and parser, we also export a
"reader" to convert parsed REAL literals to any compatible Fortran type,
so for most uses users will only need that function to turn a Fortran
REAL literal into a Haskell value. (Previously, everyone had to
implement their own parsing.)
@raehik
Copy link
Collaborator Author

raehik commented Nov 29, 2021

Discussed, giving it a merge.

@raehik raehik merged commit 9941a5c into master Nov 29, 2021
@raehik raehik deleted the real-lit-parsing branch November 29, 2021 12:30
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

Successfully merging this pull request may close these issues.

2 participants