-
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
Separate desugaring from parser & add label sugar #117
Conversation
Using functions that generate the AST seems like a nice compromise to having a whole duplicate AST; I like it. So we'd also talked about having 1 constructor per op name (in AstSemantics.md). Do you have any plans to (and if not, would you be opposed to me) adding 1 Sugar function for every single op? What's nice is the naming convention should allow us to use identical identifiers. That actually sounds really nice: we could have each op name in AstSemantics.md be a link to the Sugar.ml definition from which people could work their way through the semantics. |
Anyhow, lgtm as is; |
Actually, I already had implemented exactly that, but then undid it because I was on the fence deciding whether this was overkill or not. But since you prefer it, I redid it. Please take another look. |
I had actually been thinking of going even further and, e.g., not just having 1 |
Oh. Are you serious? That would really blow up everything big time (like 20x) and create a major nuisance for adding future opcodes. It would also over-emphasize concrete lexical syntax, which I don't think belongs here. I'd rather not go there. |
I think this depends on how you interpret the names in AstSemantics.md. What you're saying makes sense if you think of, e.g., |
You would also need to expand out all the lexer. That sounds super ugly. You'd basically be throwing out and forgetting all structure early on, just to reconstruct it later. With all the code duplication that implies in the middle. From an implementation stand point I don't think that makes a lot of sense. I have been viewing the xyzop parameters of various constructors in You say the opcode names should appear in |
PS: Independent of such considerations, do you think the current PR is good to go for now? :) |
Ok, I see what you're saying and I don't really have a strong opinion here. I also realized that, when we define the binary encoding in ml-proto, that will include the module opcode table and that will establish the literal correspondence in
Doubly yes, then. |
Separate desugaring from parser & add label sugar
…ebAssembly#117) Attempting to use atomic access operators on non-shared linear memory is a validation error.
…aster' (WebAssembly#91)" (WebAssembly#117) This reverts commit 0d8fab6. This reverts WebAssembly#91, which squashed all upstream commits into one, which was not the recommended way in https://github.com/WebAssembly/proposals/blob/master/howto.md#syncing-with-upstream-changes.
This patch supersedes #99.
Defines sugared forms in a new module
spec/sugar
.Introduces sugar for defining labels directly as part of a block, loop, or switch. A loop allows up to two labels, one to exit, the other to continue the loop.
Redefines
return
as sugar forbreak
, slightly simplifying the spec, and making the core language compositional (substitution is now possible for function bodies, up to variable renaming).