[PSyIR] Explore auto-generation of validate_child method using its textual representation

Open
#765 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
compilers

Research direction

Start by locating the PSyIR node classes that define both validate_child() and _children_valid_format, then compare how their accepted-child rules are expressed. Investigate whether the textual representation can consistently drive validation; done means the duplicated rules are removed or reduced without changing validation behavior or error messages.

Written by the indexing model from the issue text.

Description

Currently the nodes that are accepted as children of a specific PSyIR nodes are represented programatically in the validate_child() method and textually (to improve the error messages) in _children_valid_format attribute.

Since _children_valid_format has an apparently formal construction, it may be possible to auto-generate the validation method by parsing the string representation, and therefore avoiding the current duplication of expressing the same logic in two different parts of the class.

Dominant language
Python
Stars
137
Forks
36
Avg merge
6d 16h
Merged PRs (30d)
18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stfc/PSyclone

All issues in stfc/PSyclone

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.