camfort / fortran-src

Fortran parsing and static analysis infrastructure
https://hackage.haskell.org/package/fortran-src
Other
44 stars 20 forks source link

Add strong Fortran value & type representation #235

Closed raehik closed 1 year ago

raehik commented 1 year ago

This representation models Fortran values as Haskell ones, and aims to share edge case behaviours to enable efficient operation without needing the end user to do extra work. Terms are modeled in such a way that a given term's precise type can be inferred by simple pattern matching. Lots of definitions for combining types on the type level, and terms on the term level are provided.

Previously, Fortran types and values were modeled via AST definitions, which complicate usage due to handling lots of syntax, and elsewhere via a sum type which gathered valid Fortran terms & types respectively into a single Haskell type (Analysis.SemanticTypes). This representation takes inspiration from that.

This is one part of a larger update to improve the constants and type analyses in fortran-src.

Notable changes -- perhaps to discuss: