Expand description
A syntax tree for WGSL and WESL files. The root of the tree is TranslationUnit.
The syntax tree closely mirrors WGSL spec syntax while allowing language extensions.
§Strictness
This syntax tree is rather strict, meaning it cannot represent most syntactically incorrect programs. But it is only syntactic, meaning it doesn’t perform many contextual checks: for example, certain attributes can only appear in certain places, or declarations have different constraints depending on where they appear.
§WESL Extensions
WESL extensions are enabled with the imports, generics, attributes and condcomp. Read more about WESL at https://wesl-lang.dev.
§Design considerations
The parsing is not designed to be primarily efficient, but flexible and correct. It is made with the ultimate goal to implement spec-compliant language extensions.
Structs§
- Assignment
Statement - Binary
Expression - Break
IfStatement - Break
Statement - Compound
Global Declaration - WESL extension
- Compound
Statement - Const
Assert - Continue
Statement - Continuing
Statement - Custom
Attribute - Declaration
- Decrement
Statement - Diagnostic
Attribute - Diagnostic
Directive - Discard
Statement - Else
Clause - Else
IfClause - Enable
Directive - ForStatement
- Formal
Parameter - Function
- Function
Call - Function
Call Statement - Ident
- Identifiers correspond to WGSL
identsyntax node, except that they have several convenience features: - IfClause
- IfStatement
- Import
- WESL imports extension
- Import
Item - WESL imports extension
- Import
Statement - WESL imports extension
- Increment
Statement - Indexing
Expression - Interpolate
Attribute - Loop
Statement - Module
Path - WESL imports extension
- Named
Component Expression - Parenthesized
Expression - Requires
Directive - Return
Statement - Span
- Spanned
- Struct
- Struct
Member - Switch
Clause - Switch
Statement - Template
Arg - Translation
Unit - Type
Alias - Type
Constraint - Type
Expression - Unary
Expression - While
Statement - Workgroup
Size Attribute
Enums§
- Acceleration
Structure Tag - Acceleration structure flags (naga extension)
- Access
Mode - Memory access mode enumeration.
- Address
Space - Address space enumeration.
- Assignment
Operator - Attribute
- Binary
Operator - Builtin
Value - Built-in value names.
- Case
Selector - Conservative
Depth - Naga extension: Conservative Depth.
- Declaration
Kind - Diagnostic
Severity - Diagnostic Severity Control Names.
- Enumerant
- One of the predeclared enumerants.
- Expression
- Global
Declaration - Global
Directive - Import
Content - WESL imports extension
- Interpolation
Sampling - Interpolation Sampling Names.
- Interpolation
Type - Interpolation Type Names.
- Literal
Expression - Path
Origin - WESL imports extension
- Sampled
Type - Statement
- Texel
Format - Texel format enumeration.
- Unary
Operator - Visibility
- WESL visibility extension