-
Notifications
You must be signed in to change notification settings - Fork 527
[spec] Fix instr sequence typing rules to actually be composable #2197
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,9 +134,13 @@ rule Expr_ok: | |
| rule Instrs_ok/empty: | ||
| C |- eps : eps -> eps | ||
|
|
||
| rule Instrs_ok/instr: | ||
| C |- instr : t_1* -> t_2* | ||
| -- Instr_ok: C |- instr : t_1* -> t_2* | ||
|
|
||
| rule Instrs_ok/seq: | ||
| C |- instr_1 instr_2* : t_1* -> t_3* | ||
| -- Instr_ok: C |- instr_1 : t_1* -> t_2* | ||
| C |- instr_1* instr_2* : t_1* -> t_3* | ||
| -- Instrs_ok: C |- instr_1* : t_1* -> t_2* | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this formulation will allow derivations of arbitrary lengths now, since either instruction list can be empty. I thought it would be better to preserve the original cons form of the rule and leave the general list append as a lemma (not too difficult to prove). Or did I overlook anything here? Same for the 2.0/3.0 changes below. |
||
| -- Instrs_ok: C |- instr_2* : t_2* -> t_3* | ||
|
|
||
| rule Instrs_ok/frame: | ||
|
|
||
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.
Oh, I am amazed that this can be correctly parsed by the backends, as at first glance it really looks like a self-referential rule; but actually it says
instr_ok C instr : t1* -> ts2*constructsinstrs_ok C [instr].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.
Well, the frontend does the resolution. There is nothing specific to do in the after elaboration.
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.
Then I'll praise the frontend to have handled this cleanly!