Closed raehik closed 2 years ago
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.
@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)
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.
Discussed, giving it a merge.
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.)