-
Notifications
You must be signed in to change notification settings - Fork 1
Spec new externtype encoding #10
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
Conversation
|
What in the world do you have to do to pass CI these days? I ran |
|
The dependencies for the test target are rather complicated and unfortunately incomplete somewhere. Before pushing to the repo, I recommend starting the test run from a |
rossberg
left a comment
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.
Spec is technically fine as is modulo cross-reference nits. However, there are two things I find problematic about the new text format extension:
- The relative order of externtype and item names is inconsistent with other forms.
- The bound identifiers are not preceded by a corresponding keyword that declares their namespace. That is completely at odds with the rest of the text format.
For the former, I would suggest changing the order, at least in the text format. For the latter, I would simply remove the ability to bind identifiers in the new short hand. That would be consistent with existing forms like param and local, where you can't use the multi-form if you want to bind names (e.g., (local i32 i32) vs (local $x i32) (local $y i32)).
document/core/text/modules.rst
Outdated
| Abbreviations | ||
| ............. | ||
|
|
||
| Multiple imports with the same ${:nm_1} may be declared together: |
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.
| Multiple imports with the same ${:nm_1} may be declared together: | |
| Multiple imports with the same :ref:`name <syntax-name>` ${:nm_1} may be declared together: |
document/core/text/modules.rst
Outdated
| $${grammar: Timports_/abbrev} | ||
| $${grammar: Timports_/abbrev-compact1} | ||
|
|
||
| Multiple imports with the same ${:nm_1} and ${:xt} may also be declared together, in which case identifiers may be placed on individual items instead of the ${:externtype}: |
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.
| Multiple imports with the same ${:nm_1} and ${:xt} may also be declared together, in which case identifiers may be placed on individual items instead of the ${:externtype}: | |
| Multiple imports with the same name ${:nm_1} and :ref:`external type <syntax-externtype>` ${:xt} may also be declared together, in which case identifiers may be placed on individual items instead of the external type: |
|
I'm not sure how to reasonably change the order of item name and externtype for the new text format extension. Like, I guess I could do Ideas for your consideration: If dropping the ability to add identifiers, then I think I am partial to option 2. I'm open to suggestions for other text encodings that would possibly swap the order of items and types as you say, but I just can't come up with one that makes sense. |
|
The variations look perfectly consistent to me. I don't think there is a parsing issue between the second and third, it should be LALR(1) just fine, and can easily be transformed to LL(1). The only minor thing is that, in an LL-parser, the list of names has to be buffered before building the list of imports, but that is totally fine for a text parser (less so for the binary format), and there are much worse things of that sort going on elsewhere in the text format. |
Per #7, we are adding another compact encoding that deduplicates externtypes as well as module names. This PR updates the formal spec.
The way I'm handling identifiers in the text format seems obviously wrong somehow, but the entire way that the compact encoding is handled in the import section is also wrong, so maybe it's ok for now and we can fix up the fiddly details before phase 4.