-
Notifications
You must be signed in to change notification settings - Fork 456
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
Implement br_table; drop tableswitch #249
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 |
---|---|---|
|
@@ -2,9 +2,6 @@ | |
|
||
type var = int Source.phrase | ||
|
||
type target = target' Source.phrase | ||
and target' = Case of var | Case_br of var | ||
|
||
type expr = expr' Source.phrase | ||
and expr' = | ||
(* Constants *) | ||
|
@@ -20,10 +17,10 @@ and expr' = | |
| Loop of expr list | ||
| Br of var * expr option | ||
| Br_if of var * expr option * expr | ||
| Br_table of var list * var * expr option * expr | ||
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. For the binary encoding, I expect the default's 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. Hm, interesting. It's a bit surprising, I suppose, since it's the label to apply to all larger indices. (Also, I still have some sympathies for the clamping interpretation of the indexing, which would suggest the default, i.e., max to go last as well. :) ) But ultimately I don't mind. @titzer, not what V8 does, WDYT? 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. Yeah, putting the default after the 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. He he, I like the word "monotonic sense". If only the world made monotonic sense. |
||
| Return of expr option | ||
| If of expr * expr list * expr list | ||
| Select of expr * expr * expr | ||
| Tableswitch of expr * target list * target * expr list list | ||
| Call of var * expr list | ||
| Call_import of var * expr list | ||
| Call_indirect of var * expr * expr list | ||
|
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.
I'm confused why the grammar uses
var var_list
, when the code prepends the first label to to the list and then splits a label off the end of the list. Wouldvar_list var
work, and avoid the prepending and splitting?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.
LR(1) generators like Yacc cannot deal with
var_list var
easily, will cause shift/reduce conflicts. So annoyingly, you have to turn it around.