-
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
[spec+interpreter] Accepts "i32.const0" (missing space) #478
Comments
Hm, interesting. That is a normal result of the usual longest match rule for lexing. But it seems that for an S-expression format that is not actually a desirable logic to use. |
I don't remember doing it, but it looks like I added a rule a while back that prevented this in the wabt lexer: https://github.com/WebAssembly/wabt/blob/master/src/wast-lexer.cc#L464 Removing that rule makes wabt work the same, allowing you to parse modules like: |
@binji, yes, I just implemented the same rule. It's a bit more interesting how to specify it, though. Probably gonna do a similar trick in the spec itself, defining a general syntax for atoms, wth all other ones being "reserved". |
Okay, I refined PR #471 to rule out such cases and adjust the interpreter accordingly. |
@rossberg-chromium I don't think your change rejects a keyword following a number: |
@AndrewScheidecker, works for me. Note that the sequence |
Ah, but you are right nevertheless! |
I'm thinking about fixing this in WAVM by only matching a keyword or number if it's followed by a token separating character (without consuming that character). |
Actually, it seems easy to fix by just removing the bit that a bogus "keyword" starts with a letter. See latest patch, which also adjusts the spec text. |
This has been resolved as part of PR #471. |
Fix ref.null semantics
The interpreter currently accepts the following:
Note that there's no space between the
i32.const
and the0
. This doesn't create any actual ambiguity, but it doesn't seem to add meaningful flexibility either, and it's surprising.For reference, wabt and binaryen both issue errors on this code.
The text was updated successfully, but these errors were encountered: