Merged
Conversation
added 6 commits
November 20, 2019 13:46
this has highlighted some issues with the grammar, unfortunately
alexcrichton
approved these changes
Nov 22, 2019
Contributor
alexcrichton
left a comment
There was a problem hiding this comment.
Looks and sounds great to me!
sunfishcode
approved these changes
Nov 22, 2019
Member
sunfishcode
left a comment
There was a problem hiding this comment.
Looks good! This should enable some nice simplifications.
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
The witx::ast types had some confusing choices that I blame on building the first draft of the tool in a hurry. This redesigns the AST a bit:
I used Datatype/datatype in a number of places where witx syntax and wasm just call things types. The data-prefix has been dropped in many places. StructDatatype, UnionDatatype and friends still retain the "data" part of the name, but that seems less problematic.
instead of two enumerations (DatatypeIdent and DatatypeVariant) holding different variations (arrays and pointers and builtins falling under Ident, everything else in variant) there is now just one enum Type that has each possible variation in a datatype
Types can either be anonymous (e.g. an (array u8) in a function argument) or named (by (typename ...). An enum TypeRef gives a type either by Value(Type) or Name(NamedType).
Only NamedTypes have docs.
Instead of considering Aliases as a variation of a datatype, they are now encoded using TypeRef: (typename $a u32) is a NamedType { name: "a", dt: TypeRef::Value(Type::Builtin(BuiltinType::U32)) }.
* witx: reorganize the AST
this has highlighted some issues with the grammar, unfortunately
* wip
* continued work on tests
* witx: all tests pass!!
* rename Datatype to Type, so ast is closer to syntax
* fix docs output
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
The witx::ast types had some confusing choices that I blame on building the first draft of the tool in a hurry. This redesigns the AST a bit:
I used Datatype/datatype in a number of places where witx syntax and wasm just call things types. The data-prefix has been dropped in many places. StructDatatype, UnionDatatype and friends still retain the "data" part of the name, but that seems less problematic.
instead of two enumerations (DatatypeIdent and DatatypeVariant) holding different variations (arrays and pointers and builtins falling under Ident, everything else in variant) there is now just one enum Type that has each possible variation in a datatype
Types can either be anonymous (e.g. an (array u8) in a function argument) or named (by (typename ...). An enum TypeRef gives a type either by Value(Type) or Name(NamedType).
Only NamedTypes have docs.
Instead of considering Aliases as a variation of a datatype, they are now encoded using TypeRef: (typename $a u32) is a NamedType { name: "a", dt: TypeRef::Value(Type::Builtin(BuiltinType::U32)) }.
* witx: reorganize the AST
this has highlighted some issues with the grammar, unfortunately
* wip
* continued work on tests
* witx: all tests pass!!
* rename Datatype to Type, so ast is closer to syntax
* fix docs output
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
This commit changes wasi:http/types#body.finish to forward the optionally present trailers, rather than retrieve them with the possibility of generating an error along the way. With this change, callers of `body.finish` will have to retreive trailers on their own, which *may* produce an efficiency gain in the case where trailers are present but not needed, and avoiding work of checking for trailers in the first place. Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
The witx::ast types had some confusing choices that I blame on building the first draft of the tool in a hurry. This redesigns the AST a bit:
I used Datatype/datatype in a number of places where witx syntax and wasm just call things types. The data-prefix has been dropped in many places. StructDatatype, UnionDatatype and friends still retain the "data" part of the name, but that seems less problematic.
instead of two enumerations (DatatypeIdent and DatatypeVariant) holding different variations (arrays and pointers and builtins falling under Ident, everything else in variant) there is now just one enum Type that has each possible variation in a datatype
Types can either be anonymous (e.g. an (array u8) in a function argument) or named (by (typename ...). An enum TypeRef gives a type either by Value(Type) or Name(NamedType).
Only NamedTypes have docs.
Instead of considering Aliases as a variation of a datatype, they are now encoded using TypeRef: (typename $a u32) is a NamedType { name: "a", dt: TypeRef::Value(Type::Builtin(BuiltinType::U32)) }.
* witx: reorganize the AST
this has highlighted some issues with the grammar, unfortunately
* wip
* continued work on tests
* witx: all tests pass!!
* rename Datatype to Type, so ast is closer to syntax
* fix docs output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
witx::asttypes had some confusing choices that I blame on building the first draft of the tool in a hurry. This redesigns the AST a bit:Datatype/datatypein a number of places where witx syntax and wasm just call thingstypes. The data-prefix has been dropped in many places.StructDatatype,UnionDatatypeand friends still retain the "data" part of the name, but that seems less problematic.DatatypeIdentandDatatypeVariant) holding different variations (arrays and pointers and builtins falling under Ident, everything else in variant) there is now just one enumTypethat has each possible variation in a datatypeTypes can either be anonymous (e.g. an(array u8)in a function argument) or named (by(typename ...). Anenum TypeRefgives a type either byValue(Type)orName(NamedType).NamedTypes have docs.(typename $a u32)is aNamedType { name: "a", dt: TypeRef::Value(Type::Builtin(BuiltinType::U32)) }.I was able to change the
wasi-headerstool over inwasi-libcto consume the new witx ast pretty quickly, and it even managed to fix a minor bug involving aliasing. I'll send a PR there and also to the otherwitx-using crate inhttps://github.com/bytecodealliance/wasishortly.