Python bindings for slang, a library for compiling SystemVerilog
Actively maintained. Last release 10 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install pyslangslang - SystemVerilog Language Services
slang is a software library that provides various components for lexing, parsing, type checking, and elaborating SystemVerilog code. It comes with an executable tool that can compile and statically analyze any SystemVerilog project, but it is also intended to be usable as a front end for synthesis tools, simulators, linters, code editors, and refactoring tools.
slang is the fastest and most compliant SystemVerilog frontend (according to the open source chipsalliance test suite).
Full documentation is available on the website: https://sv-lang.com
Features
- Fully parse, elaborate, and analyze all SystemVerilog features.
- Be robust about compilation, no matter how broken the source text. This makes the compiler usable in editor highlighting and completion scenarios, where the code is likely to be broken because the user is still writing it.
- The parse tree should round trip back to the original source, making it easy to write refactoring and code generation tools.
- Provide great error messages, ala clang.
- Be fast and robust in the face of production-scale projects.
Use Cases
Some examples of things you can use slang for:
- Very fast syntax checking and linting tool
- Dumping the AST of your project to JSON
- Source code introspection via included Python bindings
- SystemVerilog code generation and refactoring
- As the engine for an editor language server
- As a fast and robust preprocessor that sits in front of downstream tools
- As a frontend for a synthesis or simulation tool, by including slang as a library
Getting Started
Pre-built binaries for Linux, macOS, and Windows are available on the releases page.