tSol

raw JSON →
1.0.6 verified Fri May 01 auth: no javascript

A transpiler for Solidity that adds GCC-like macro and helper functions to make Solidity assembly programming more manageable. Version 1.0.6, with initial release 1.0.3. Key differentiators: provides custom assembly functions (pointer, pointer_attr, byte_offset, build, attr) to simplify storage pointer calculations and data packing in inline assembly. Requires gcc and node/npm. Focused on Ethereum smart contract optimization, particularly for struct packing.

error tsol: command not found
cause tSol is not installed globally or not in PATH.
fix
Run 'npm i -g tsol' and ensure npm global bin directory is in your PATH.
error gcc: command not found
cause gcc is not installed on the system.
fix
Install gcc (e.g., apt-get install gcc for Debian/Ubuntu, or download from https://gcc.gnu.org/).
error Error: Could not find #define TRANSPILE
cause The Solidity source file does not contain the required directive.
fix
Add '#define TRANSPILE' at the top of your Solidity file.
gotcha tSol requires gcc to be installed on the system. Missing gcc will cause transpilation to fail.
fix Install gcc (e.g., apt-get install gcc on Linux, xcode-select --install on macOS).
gotcha The source file must contain #define TRANSPILE for tSol to process it. Without this directive, tSol will output the file unchanged.
fix Add #define TRANSPILE at the top of your Solidity file before using tSol macros.
gotcha tSol macros (pointer, pointer_attr, etc.) are only valid inside assembly blocks. Using them outside assembly will cause compilation errors.
fix Ensure all tSol assembly functions are used inside assembly { ... } blocks.
npm install tsol
yarn add tsol
pnpm add tsol

Installs tSol globally and transpiles a Solidity file containing #define TRANSPILE and tSol macros into plain Solidity.

npm i -g tsol
tsol file.sol > output.sol