-
Notifications
You must be signed in to change notification settings - Fork 149
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
Conversation
Please add tests to |
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 |
There was a problem hiding this comment.
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?
@Scott-Guest will have to comment on the frontend code, but the tests look good, and the feature makes sense. |
There was a problem hiding this 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
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.