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

IR: Symbol management on scoped nodes #375

Merged
merged 4 commits into from
Oct 7, 2024
Merged

Conversation

mlange05
Copy link
Collaborator

@mlange05 mlange05 commented Sep 10, 2024

Note: This PR sits on top of #372, so I'm only filing a draft before anticipated rebase.

This PR brings a set of convenience methods and expression constructors to the ScopedNode and ProgramUnit classes. The idea is that eventually, Subroutine and Module classes should become scoped nodes and the expression management API should be equivalent between them.

The idea is to add the following three utilities to the scope objects themselves, to enable quick(er) expression generation:

  • .get_symbol(name) - utility to look up a symbol by it's name. This will first find it's true owning scope and attach the symbol.
  • .Variable(name, ....) - a shortcut to the general Variable constructor that will attempt to build array and scalar symbols, depending on available type information
  • .parse_expr - a shortcut to the general expression parser that can generate nested expression trees from pure strings.

Copy link

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/375/index.html

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.50%. Comparing base (cc179b3) to head (ee2751c).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
+ Coverage   95.48%   95.50%   +0.01%     
==========================================
  Files         185      186       +1     
  Lines       38646    38766     +120     
==========================================
+ Hits        36902    37022     +120     
  Misses       1744     1744              
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 95.48% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mlange05 mlange05 marked this pull request as ready for review October 5, 2024 04:47
Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

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

Many thanks, this is fantastic!

(And I'm already dreading the follow-on PR that applies the strict Scope-local construction of symbols throughout... ;-)

:shipit:

@reuterbal reuterbal added the ready for merge This PR has been approved and is ready to be merged label Oct 7, 2024
@reuterbal reuterbal merged commit a4b1df9 into main Oct 7, 2024
13 checks passed
@reuterbal reuterbal deleted the naml-scoped-node-symbols branch October 7, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge This PR has been approved and is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants