Skip to content

Rough draft of Section 3.5 conditionals: #if, #elif, etc. #61

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

Merged
merged 10 commits into from
Jun 4, 2025

Conversation

gklimowicz
Copy link
Member

Initial draft of Section 3.5. Added illustrative syntax, static semantics and evaluation semantics, up to but not including controlling expression evaluation. (That will be an another section.)

I tried to use the terminology from the C 2023 standard, but reviewers will surely find lapses and potential improvements.

@gklimowicz
Copy link
Member Author

Apparently, Gary does not know how to do a squash commit.

@gklimowicz
Copy link
Member Author

From email sent to the team, which may be useful for reviewers:

This PR covers only the directives in the #if family.

As these directives are highly interdependent, I didn’t write a separate section on each directive. Instead, there is a single omnibus illustrative syntax that includes all the directives, and the order and quantity in which they can appear.

As with the other directives, there is a subsection on the “static semantics”, the rules that must be followed in the form the directives take. It covers loosely the proper nesting of conditional directives.

There is also the customary subsection on “evaluation semantics”: what happens when we act on the directives.

Nesting syntax and semantics get a bit complicated. There is some text about that, but it is not as formal as I would like. (I may have to wait until the syntax paper to spell it out in detail.)

Copy link
Collaborator

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

My initial rough review of the rough draft ;-)

Copy link
Collaborator

@kc9jud kc9jud left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

Apologies for the delayed review. Here's a few more nitpicks and then I think this PR is probably ready to merge.

gklimowicz and others added 9 commits May 28, 2025 15:58
Co-authored-by: Dan Bonachea <[email protected]>
Add di00 to clarify directive name recognition as
"token immediately following '#' introducing
a directive line."

Use grammar symbols <if-head>, etc., when describing
conditional directive processing.

Change grammar symbol <lines> to <group> to (slightly) better
mirror C 2023 usage.

Add specification for skipping <group>s, and used
this in subsequent descriptions of <if-head>, <if-elif>
and <if-else> constructs.

Remove if10. as di00 covers this more generally.
@bonachea bonachea force-pushed the section-3-conditionals branch from 636a2bb to e838fe7 Compare May 28, 2025 19:58
@bonachea
Copy link
Collaborator

bonachea commented May 28, 2025

@gklimowicz @kc9jud I just rebased this PR to the tip of main to simplify git history. Please update any local clones with git pull --rebase

@gklimowicz gklimowicz requested a review from bonachea June 4, 2025 04:57
Copy link
Collaborator

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for all the work on this

@bonachea bonachea merged commit 19679e3 into j3-fortran:main Jun 4, 2025
@gklimowicz gklimowicz deleted the section-3-conditionals branch June 4, 2025 22:12
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.

4 participants