[herd] More implicit transitive relations in the Cat interpreter#1719
Open
[herd] More implicit transitive relations in the Cat interpreter#1719
Conversation
8702000 to
ddb3be5
Compare
| begin | ||
| try | ||
| let es,saw_seq = as_plus_args false x es in | ||
| if saw_seq then Some (x,es) else None |
Collaborator
There was a problem hiding this comment.
Could we have a warning that the rec flag is useless in that case?
Member
Author
There was a problem hiding this comment.
I'd rather leave this to another PR.
…reter We notice that `(...|r+|...)+` is `(...|r|...)+` and thus also that irrefexivity of `(...|r+|...)+` is equivalent to acyclicity of `(...|r|...)`. The process may be interesting because we also identify some of the recursive definitions that are equivalent to a transitive closure and represent them as (implicit) transitive closure, thereby saving some transitive closure operations. In practice, improvements are barely noticeable.
ddb3be5 to
70f0e5a
Compare
We take advantage of union commutativity for performing this petty optimisation.
More precisely, bindings of the form `x = e`, where the expression `e`potentially reduces to some transitive closure (such as `e+`) are handled specially, by accepting an implicit transitive closure as a result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We notice that
(...|r+|...)+is(...|r|...)+and thus also that irrefexivity of(...|r+|...)+is equivalent to acyclicity of(...|r|...)The process may be interesting because we also identify some of the recursive definitions that are equivalent to a transitive closure and represent them as (implicit) transitive closure, thereby saving some transitive closure operations.
However, to avoid the repetive evaluation of bound implicit transitive closures to explicit ones, we rely on an additionnal environment for implicitly transitive relations, introducing minor extra costs.
In the end, improvements are barely noticeable, but the interpreter should gain as regards performance robustness.