Skip to content
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

Make the composite opcodes easier to parse using a generic S-expression parser #335

Closed
AndrewScheidecker opened this issue Sep 5, 2015 · 2 comments

Comments

@AndrewScheidecker
Copy link

The composite opcodes pack a lot of information into a single S-expression "atom", e.g. i32.load_s/i8/4. My WAST parsing is structured as a generic S-expression parser followed by a transformation defined on S-expressions. The problem is that an opcode like i32.load_s/i8/4 comes in as a single atom, so the WAST-specific transform needs to be able to recognize all the variations. With something like i32.add it's practical to just enumerate the possibilities, but something like i32.load_s/i8/4 really needs WAST-specific lexing at some point in the pipeline.

If these opcodes were split into multiple atoms, e.g. i32.load_s i8 alignment 4, it would be much easier to use a generic S-expression parser.

@kg
Copy link
Contributor

kg commented Sep 5, 2015

Yeah, I think type information should be operands to the opcode. I don't like cramming a bunch of data into the opcode with delimiters.

@sunfishcode
Copy link
Member

This is now fixed in the spec repo, with the offset= and align= syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants