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

Handle list random access patterns in frontend #4634

Merged
merged 9 commits into from
Sep 17, 2024
Merged

Handle list random access patterns in frontend #4634

merged 9 commits into from
Sep 17, 2024

Conversation

dwightguth
Copy link
Collaborator

This PR adds support for the L [ I <- X ] syntax on the LHS of rules, which allows you to pattern match on an arbitrary element of a list.

The code is not fully polished; it is not integrated with configuration abstraction or cell collections. It is not likely to be further improved upon presently because the code it was intended to support ended up not proving worth merging. However, it is broadly useful functionality (along with the accompanying LLVM backend PR) and thus ought to be merged.

@rv-jenkins rv-jenkins changed the base branch from master to develop September 9, 2024 20:00
@dwightguth dwightguth marked this pull request as ready for review September 13, 2024 17:45
@ehildenb
Copy link
Member

Please add tests to regression-new of the new functionality.

Comment on lines +1 to +11
module TEST
imports LIST
imports INT

configuration <k> $PGM:K </k> <list> ListItem(0) ListItem(1) ListItem(2) </list>

syntax KItem ::= l(Int, Int)

rule <k> l(I, J) => .K ...</k>
<list> _ [ I <- J ] </list>
endmodule
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test l(5, 2) or the like? Something out of range?

@ehildenb
Copy link
Member

@Scott-Guest will have to comment on the frontend code, but the tests look good, and the feature makes sense.

Copy link
Contributor

@Scott-Guest Scott-Guest left a comment

Choose a reason for hiding this comment

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

Code LGTM, but please

  • Document this in "Collection patterns" part of the user manual
  • Submit an issue describing the remaining work needed for configuration abstraction and cell collections

@dwightguth
Copy link
Collaborator Author

#4640

@rv-jenkins rv-jenkins merged commit 861cda4 into develop Sep 17, 2024
17 checks passed
@rv-jenkins rv-jenkins deleted the list-set branch September 17, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants