stdarch-gen-wasm32
: Tool that creates spec sheet from wasm32's C and Rust source files.
#1910
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.
What does
stdarch-gen-wasm32
do?wasm_simd128.h
file (for the definitions in C)tree-sitter
crate)How to run
Context
C Abstract Syntax Tree
Take an intrinsic definition for example:
For a C intrinsic, the immediate children would have their grammar names as:
static
__inline__
__DEFAULT_FN_ATTRS
. The parser doesn't recognize it as a valid part of the tree and annotates it as ERROR.wasm_u32x4_make(uint32_t __c0, uint32_t __c1, uint32_t __c2, uint32_t __c3)
The immediate children of the
function_declarator
node would have their grammar as follows:wasm_u32x4_make
(uint32_t __c0, uint32_t __c1, uint32_t __c2, uint32_t __c3)
The immediate children of a parameter_list node would have their grammar as follows:
uint32_t __c0
uint32_t __c1
uint32_t __c2
uint32_t __c3
Each node with the grammar name parameter_declaration could have its children structured in a few ways:
int x
:v128_t
, which is actually a type (but the parser is unaware of the same).x
.*
and identifier (which is__mem
).Rust Abstract Syntax Tree
Take a Rust intrinsic definition for example:
For this Rust intrinsic, the immediate children would have their grammar names as:
pub
unsafe
. May not always be presentfn
v128_load64_splat
const
generic arguments. (This is not always present)(m: *const u64)
v128
The children of the
const_parameters
node have theirgrammar_names
as the following (assuming 2 generic arguments):const
generic argumentconst
generic argumentThe children of the
parameters
node have theirgrammar_names
as the following (assuming 2 arguments):cc: @Amanieu @folkertdev