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

Limit mutual recursion in core Fortran AST types #222

Open
raehik opened this issue May 11, 2022 · 0 comments
Open

Limit mutual recursion in core Fortran AST types #222

raehik opened this issue May 11, 2022 · 0 comments
Labels
area:ast Related to Fortran AST representation. Status: Discussion

Comments

@raehik
Copy link
Collaborator

raehik commented May 11, 2022

The Fortran syntax representation we use is highly mutually recursive. To summarise the core types:

  • a ProgramFile contains many
  • ProgramUnits, which contain
  • Blocks, which contain
  • Statements, which contain
  • Expressions.

However, as of 2022-05-11, Expressions are mutually recursive with ProgramUnits. This can introduce surprises, and makes instance derivation awkward. In particular, generic derivation likely won't work unless every type up to ProgramUnit also has an instance derived.

It would be more sensible to limit the two-way recursion where possible. Note there might be some unexpected behaviour by doing so. For example, Expressions are only connected to Statements through one constructor -- altering a data type stored in there removes the mutual recursion, but caused issues with block/flow analysis #221 .

@raehik raehik added area:ast Related to Fortran AST representation. Status: Discussion labels May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ast Related to Fortran AST representation. Status: Discussion
Projects
None yet
Development

No branches or pull requests

1 participant