Describe WGSL's context-aware tokenization - #2735
Conversation
791ac4c to
7afb019
Compare
mehmetoguzderin
left a comment
There was a problem hiding this comment.
WGSL is about to be conflict-free! I really like this way of representing callables which comes with the benefit of no more conflicts. Thanks for building this change!
| "title":"Context-Aware Scanning for Parsing Extensible Languages", | ||
| "authors": [ | ||
| "Eric R. Van Wyk", | ||
| "August C. and Schwerdfeger" |
There was a problem hiding this comment.
I think the "and" is a typo? When I check the link the author info doesn't include it.
| "August C. and Schwerdfeger" | |
| "August C. Schwerdfeger" |
There was a problem hiding this comment.
I badly translated the Bibtex info from the ACM site. Thanks!
556dcdb to
9ea228f
Compare
|
Landed the grammar update separately as #2737, then rebased |
WGSL is LALR(1). Tokenization is context-aware. The tokenizer either yields the longest token in the lookahead of the current parser state, or it fails. Fixes: gpuweb#2717
9ea228f to
b4dc640
Compare
|
WIP PR #2754 adds a grammar analyzer:
LALR(1) parser table construction succeeds with the current version of the grammar. That is, WGSL is a LALR(1) language. Formally, parsing treats tokenization as an oracle. The fact that most parsers treat tokenization as completely independent of parsing is only a strong tradition. This PR spells out the interdependence needed to parse WGSL: the tokenizer must yield the longest 'token candidate' that also appears in the lookahead of the current parse state. If there is none, then parsing fails. |
mehmetoguzderin
left a comment
There was a problem hiding this comment.
I think this PR improves the explanation a lot, the text captures all the details with good references. Thank you!
WGSL meeting minutes 2022-05-24
|
|
FYI. I have an updated grammar dump at #2754 (comment) |
WGSL meeting minutes 2022-05-31
|
WGSL is LALR(1). Tokenization is context-aware. The tokenizer either yields the longest token in the lookahead of the current parser state, or it fails. Fixes: gpuweb#2717
Also remove parsing conflict between type constructor and function call,
by refactoring the grammar.
Fixes: #2717
Edit: Fix the issue number.