Skip to content

Instantly share code, notes, and snippets.

@Pet3ris
Created August 11, 2020 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pet3ris/bbcd01f6b8bd28eb96c6a98e71c301e9 to your computer and use it in GitHub Desktop.
Save Pet3ris/bbcd01f6b8bd28eb96c6a98e71c301e9 to your computer and use it in GitHub Desktop.
YUL ast output from Solidity
{
"AST": {
"nodeType": "YulBlock",
"src": "355:175:0",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "369:22:0",
"value": {
"arguments": [
{
"name": "data",
"nodeType": "YulIdentifier",
"src": "386:4:0"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "380:5:0"
},
"nodeType": "YulFunctionCall",
"src": "380:11:0"
},
"variables": [
{
"name": "len",
"nodeType": "YulTypedName",
"src": "373:3:0",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "479:41:0",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "invalid",
"nodeType": "YulIdentifier",
"src": "497:7:0"
},
"nodeType": "YulFunctionCall",
"src": "497:9:0"
},
"nodeType": "YulExpressionStatement",
"src": "497:9:0"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [],
"functionName": {
"name": "gas",
"nodeType": "YulIdentifier",
"src": "419:3:0"
},
"nodeType": "YulFunctionCall",
"src": "419:5:0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "426:4:0",
"type": "",
"value": "0x04"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "432:1:0",
"type": "",
"value": "0"
},
{
"arguments": [
{
"name": "data",
"nodeType": "YulIdentifier",
"src": "439:4:0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "445:4:0",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "435:3:0"
},
"nodeType": "YulFunctionCall",
"src": "435:15:0"
},
{
"name": "len",
"nodeType": "YulIdentifier",
"src": "452:3:0"
},
{
"arguments": [
{
"name": "ret",
"nodeType": "YulIdentifier",
"src": "461:3:0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "466:4:0",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "457:3:0"
},
"nodeType": "YulFunctionCall",
"src": "457:14:0"
},
{
"name": "len",
"nodeType": "YulIdentifier",
"src": "473:3:0"
}
],
"functionName": {
"name": "call",
"nodeType": "YulIdentifier",
"src": "414:4:0"
},
"nodeType": "YulFunctionCall",
"src": "414:63:0"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "407:6:0"
},
"nodeType": "YulFunctionCall",
"src": "407:71:0"
},
"nodeType": "YulIf",
"src": "404:2:0"
}
]
},
"evmVersion": "istanbul",
"externalReferences": [
{
"declaration": 33,
"isOffset": false,
"isSlot": false,
"src": "386:4:0",
"valueSize": 1
},
{
"declaration": 33,
"isOffset": false,
"isSlot": false,
"src": "439:4:0",
"valueSize": 1
},
{
"declaration": 39,
"isOffset": false,
"isSlot": false,
"src": "461:3:0",
"valueSize": 1
}
],
"id": 46,
"nodeType": "InlineAssembly",
"src": "346:184:0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment