Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework WGSL grammar to make it nicer for recursive descent (#3299)
* Rework WGSL grammar to make it nicer for recursive descent Contributes to #3286 1. Make certain productions amenable for recursive descent Avoid this kind of pattern: (x y) * x When you see a substring that would match 'x', you don't know if it should match the first or second 'x' in that phrase. Rewrite it something like this, to put the certain match against 'x' first. x (y x) * In particular, rewrite these rules: - struct_body_decl - argument_expression_list - param_list 2. Introduce additive_operator, multiplicative_operator This helps eliminate epsilons in the left-recursive form of the grammar 3. Create optionally_typed_ident, and use it to replace (ident | variable_ident_decl) pattern which became common because of type inferencing rules. Also expand last remaining use of variable_ident_decl, for formal parameter declaration. * WGSL structs always have at least one member
- Loading branch information
Showing
1 changed file
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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