Skip to content

WIP: More flexible rule creation with more error checking (discuss me 2nd) - #157

Draft
davidweichiang wants to merge 8 commits into
mainfrom
lhs+ext
Draft

davidweichiang wants to merge 8 commits into
mainfrom
lhs+ext

Conversation

@davidweichiang

Copy link
Copy Markdown
Collaborator

This improves checking the constraint that an HRGRule's lhs and rhs types have to match (closes #79).

It also adds more flexibility in creating an HRGRule. This partially helps with #140.

  • Analogous to Start symbols #156, an HRGRule can be created with no lhs at first, and the the lhs can be set later.
  • Every time the lhs is set, it is checked for compatibility with rhs.ext.
  • If HRGRule is called with no rhs, an empty rhs is constructed.
  • New method HRGRule.set_lhs_ext for setting the lhs and rhs.ext simultaneously.
  • If rhs.ext is changed, it is not checked for compatibility with lhs.

The alternative to the last point would be if we moved ext from Graph to HRGRule. In other words, Graph would be just a hypergraph (not a "hypergraph fragment") and an HRGRule would have an lhs, a rhs, and external nodes. Then HRGRule would be able to check the consistency of lhs and ext perfectly. However, there would be no way to stop someone from deleting an external node. I prefer this alternative (since I envision node deletion being much less common then setting the external nodes).

(This PR is part of a larger plan to fix #140 and generally try to simplify things.)

@davidweichiang
davidweichiang requested a review from darcey July 22, 2022 23:34
@davidweichiang davidweichiang changed the title WIP: More flexible rule creation with more error checking WIP: More flexible rule creation with more error checking (discuss me 2nd) Jul 26, 2022
@davidweichiang
davidweichiang marked this pull request as draft August 15, 2022 20:16
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.

Things that are still not convenient Enforce invariants for HRGRule

1 participant