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

Rework WGSL grammar to make it nicer for recursive descent #3299

Merged
merged 2 commits into from Aug 10, 2022

Commits on Aug 9, 2022

  1. Rework WGSL grammar to make it nicer for recursive descent

    Contributes to gpuweb#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.
    dneto0 committed Aug 9, 2022
    Configuration menu
    Copy the full SHA
    50aa755 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2022

  1. Configuration menu
    Copy the full SHA
    0644866 View commit details
    Browse the repository at this point in the history