This repository contains a tree-sitter grammar for the WebGPU Shading Language (WGSL) with support for WESL extensions, as well as best-effort support for Bevy (naga_oil) extensions and C-style preprocessors.
- Auto-generated tree-sitter implementation (gpuweb): https://github.com/gpuweb/tree-sitter-wgsl
- Widly used tree-sitter implementation (szebniok): https://github.com/szebniok/tree-sitter-wgsl
- Fork with support for Bevy's preprocessor: https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy
Contributions are welcome. Please join the discord server and introduce yourself first, or contact via email.
Except where noted (below and/or in individual files), all code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Exceptions:
- The files
grammar.js
andsrc/scanner.c
contain portions of code from tree-sitter-wgsl, licensed under the W3C Software and Document License (LICENSE-W3C or https://www.w3.org/copyright/software-license-2023/), Copyright (c) 2025 World Wide Web Consortium.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.