This would be useful, expecially if someone wants to build a smart contract programming language that targets yul in the compilation
@damianoazzolini are you working on something like that by any chance? :wink:
@axic eh eh eh i've an idea for a language i would like to implement, however is difficult to find something that deeply explains yul
Can you help us by telling which parts are unclear or what examples would be useful?
I'm adding a complete example of an ERC20 token to the documentation.
The thing that is more difficult to understand is the addresses computation and the representation of struct. For instance, is not clear how to use mload sstore and how the addresses passed in the function call are computed. A step by step analysis of, for example, the ERC20 contract but without optimization would be very useful.
@damianoazzolini I'm not sure I understand. Structs are not part of Yul. Are you talking about structs in the ABI or in Solidity? Did you take a look at https://github.com/ethereum/solidity/pull/8683 ? Which address computation are you referring to?
Maybe this one also helps: https://medium.com/@chriseth/writing-smart-contracts-in-iulia-2a5ba737c7f1
@chriseth thanks for the pointer! For instance, where does the addresses 0x70a08231, 0x18160ddd etc came from in the ERC20 example? They are in the switch case statement.
Yeah, this is higher-level than Yul. It is defined in the Ethereum ABI specification: https://solidity.readthedocs.io/en/develop/abi-spec.html