Optimizing Solidity Compiler
Slang is an optimizing Solidity compiler for EVM by Nomic Foundation. The Slang front-end parses and binds the Solidity, this repository lowers it to MLIR, and an LLVM backend with an EVM target produces the bytecode.
[!WARNING]
The project is in development and is not ready for production use.
The tester runs Slang against:
- Semantic tests from the solc repository
- DeFi protocols: UniswapV2, UniswapV3, Mooniswap, StarkEx
- Additional tests written by the Slang team
Documentation
Slang documentation is powered by GitHub Pages and provided as an mdBook, while its Markdown sources can be found in this directory. To build the book, follow these instructions. The design rules of the Slang frontend and the conventions for working on this repository with an agent are in CLAUDE.md.
See also:
Installation
For the detailed installation and usage guide, visit the respective page of our documentation.
Quick Start
# Compile a Solidity file
slang Contract.sol --bin --abi
Compile with optimizations
slang Contract.sol --bin --abi -O3
Output to a directory
slang Contract.sol --bin --abi -o ./build
Architecture
For details on the compilation pipeline and components, see the architecture documentation.
Testing
For details on running unit tests, integration tests, and project tests, see the testing documentation.
Troubleshooting
If you are building Slang from source and you have multiple LLVM builds in your system, ensure that you choose the correct one to build the compiler.
The environment variable LLVM_SYS_211_PREFIX sets the path to the directory with LLVM build artifacts, which typically ends with target-llvm/target-final.
For example:
export LLVM_SYS_211_PREFIX="${HOME}/src/solx/target-llvm/target-final"
If you suspect that the compiler is not using the correct LLVM build, check by running set | grep LLVM, and reset all LLVM-related environment variables.
For reference, see llvm-sys and Local LLVM Configuration Guide.
License
- Crate slang is licensed under GNU General Public License v3.0
- All other crates are licensed under the terms of either
solx-llvmis licensed under the terms of Apache License, Version 2.0 with LLVM Exceptions, (LICENSE or https://llvm.org/LICENSE.txt)
Visit the project directories to discover the terms of each license in detail. These and other projects are licensed in either per-file or per-project manner.
Credits
Slang grew out of solx, which originated at Matter Labs, where its first pipeline and LLVM backend were built.
Contact Us
Email us at [email protected] or join our Telegram group.