Profile
Back to NewsBack
GitHub Trending 3 min
Reader Mode
NomicFoundation/solx: LLVM-based Solidity compiler.

NomicFoundation/solx: LLVM-based Solidity compiler.

21 hours ago

solx logo

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:

Planned:

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

- Apache License, Version 2.0 (LICENSE-APACHE or ) - MIT license (LICENSE-MIT or )
  • solx-llvm is licensed under the terms of Apache License, Version 2.0 with LLVM Exceptions, (LICENSE or https://llvm.org/LICENSE.txt)
Additionally, this repository vendors tests and test projects that preserve their original licenses: These projects are modified for the purposes of testing our compiler toolchain and are not used outside of this repository.

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.

Chat with me