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.
- WGSL/WESL Language support in Zed using this parser: https://github.com/lucascompython/wgsl-wesl-zed
wgsl-analyzerhas a textMate grammar for WESL https://github.com/wgsl-analyzer/wgsl-analyzer- 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
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.jsandsrc/scanner.ccontain 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.