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

[fortran] Support for Computed GO TO #780

Merged
merged 5 commits into from
Feb 2, 2024
Merged

Conversation

vincentraymond-ua
Copy link
Contributor

@vincentraymond-ua vincentraymond-ua commented Feb 1, 2024

Summary of Changes

  • Adds CAST support for ingesting Computed GO TO
  • Adds support for generating GroMEt for CAST files containing Computed GO TOs.
  • Adds a test script test_goto_computed.py that contains a unit test for a small Fortran file that has a Computed GO TO.
  • Fixes a small issue in the Annotated CAST generation in cast_to_annotated_cast.py. This fix allows correct support of Computed GO TOs.
  • Updates CAST Visualizer to support visualizing GO TO and Label CAST nodes.

CAST Computed GO TO Conversion

Since the expression in Computed GO TOs evaluates to an index rather than a label, we make a small conversion to the expression in the CAST to support this. We utilize the _get Gromet function to handle this indexing.

So:

GO TO (100,200,300,400), x+y

gets converted to:

_get(["100", "200", "300", "400"], x+y)

Related issues

Resolves #698
Resolves #701
Resolves #773

@github-actions github-actions bot added the lang/Fortran Used for work related to Fortran (ex. frontend support) label Feb 1, 2024
@vincentraymond-ua vincentraymond-ua changed the title Vraymond/computed goto [fortran] Support for Computed GO TO Feb 2, 2024
@vincentraymond-ua vincentraymond-ua marked this pull request as ready for review February 2, 2024 20:04
Copy link
Contributor

@titomeister titomeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good on my end. Nice job!

@vincentraymond-ua vincentraymond-ua merged commit f899664 into main Feb 2, 2024
7 checks passed
@vincentraymond-ua vincentraymond-ua deleted the vraymond/computed_goto branch February 2, 2024 21:35
github-actions bot added a commit that referenced this pull request Feb 2, 2024
## Summary of Changes
- Adds CAST support for ingesting Computed GO TO
- Adds support for generating GroMEt for CAST files containing Computed
GO TOs.
- Adds a test script `test_goto_computed.py` that contains a unit test
for a small Fortran file that has a Computed GO TO.
- Fixes a small issue in the Annotated CAST generation in
`cast_to_annotated_cast.py`. This fix allows correct support of Computed
GO TOs.
- Updates CAST Visualizer to support visualizing GO TO and Label CAST
nodes.

### CAST Computed GO TO Conversion
Since the expression in Computed GO TOs evaluates to an index rather
than a label, we make a small conversion to the expression in the CAST
to support this. We utilize the _get Gromet function to handle this
indexing.

So:
```fortran
GO TO (100,200,300,400), x+y
```
gets converted to:
```python
_get(["100", "200", "300", "400"], x+y)
```

### Related issues

Resolves #698
Resolves #701
Resolves #773

---------

Co-authored-by: Tito Ferra <[email protected]> f899664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/Fortran Used for work related to Fortran (ex. frontend support)
Projects
None yet
2 participants