Created
June 12, 2022 18:03
-
-
Save dkorolev/99808d780b29dcbe398d8841b8f338ce to your computer and use it in GitHub Desktop.
Example Rego IR JSON for `dkorolev/jsopa` README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "static": { | |
| "strings": [ | |
| { | |
| "value": "result" | |
| }, | |
| { | |
| "value": "a" | |
| }, | |
| { | |
| "value": "b" | |
| } | |
| ], | |
| "builtin_funcs": [ | |
| { | |
| "name": "plus", | |
| "decl": { | |
| "args": [ | |
| { | |
| "name": "x", | |
| "type": "number" | |
| }, | |
| { | |
| "name": "y", | |
| "type": "number" | |
| } | |
| ], | |
| "result": { | |
| "description": "the sum of `x` and `y`", | |
| "name": "z", | |
| "type": "number" | |
| }, | |
| "type": "function" | |
| } | |
| } | |
| ], | |
| "files": [ | |
| { | |
| "value": "/dev/stdin" | |
| } | |
| ] | |
| }, | |
| "plans": { | |
| "plans": [ | |
| { | |
| "name": "smoke/sum", | |
| "blocks": [ | |
| { | |
| "stmts": [ | |
| { | |
| "type": "CallStmt", | |
| "stmt": { | |
| "func": "g0.data.smoke.sum", | |
| "args": [ | |
| { | |
| "type": "local", | |
| "value": 0 | |
| }, | |
| { | |
| "type": "local", | |
| "value": 1 | |
| } | |
| ], | |
| "result": 2, | |
| "file": 0, | |
| "col": 0, | |
| "row": 0 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 2 | |
| }, | |
| "target": 3, | |
| "file": 0, | |
| "col": 0, | |
| "row": 0 | |
| } | |
| }, | |
| { | |
| "type": "MakeObjectStmt", | |
| "stmt": { | |
| "target": 4, | |
| "file": 0, | |
| "col": 0, | |
| "row": 0 | |
| } | |
| }, | |
| { | |
| "type": "ObjectInsertStmt", | |
| "stmt": { | |
| "key": { | |
| "type": "string_index", | |
| "value": 0 | |
| }, | |
| "value": { | |
| "type": "local", | |
| "value": 3 | |
| }, | |
| "object": 4, | |
| "file": 0, | |
| "col": 0, | |
| "row": 0 | |
| } | |
| }, | |
| { | |
| "type": "ResultSetAddStmt", | |
| "stmt": { | |
| "value": 4, | |
| "file": 0, | |
| "col": 0, | |
| "row": 0 | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| "funcs": { | |
| "funcs": [ | |
| { | |
| "name": "g0.data.smoke.sum", | |
| "params": [ | |
| 0, | |
| 1 | |
| ], | |
| "return": 2, | |
| "blocks": [ | |
| { | |
| "stmts": [ | |
| { | |
| "type": "ResetLocalStmt", | |
| "stmt": { | |
| "target": 3, | |
| "file": 0, | |
| "col": 1, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "NotEqualStmt", | |
| "stmt": { | |
| "a": { | |
| "type": "bool", | |
| "value": true | |
| }, | |
| "b": { | |
| "type": "bool", | |
| "value": false | |
| }, | |
| "file": 0, | |
| "col": 8, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "DotStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 0 | |
| }, | |
| "key": { | |
| "type": "string_index", | |
| "value": 1 | |
| }, | |
| "target": 4, | |
| "file": 0, | |
| "col": 8, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 4 | |
| }, | |
| "target": 5, | |
| "file": 0, | |
| "col": 8, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "DotStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 0 | |
| }, | |
| "key": { | |
| "type": "string_index", | |
| "value": 2 | |
| }, | |
| "target": 6, | |
| "file": 0, | |
| "col": 18, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 6 | |
| }, | |
| "target": 7, | |
| "file": 0, | |
| "col": 18, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "CallStmt", | |
| "stmt": { | |
| "func": "plus", | |
| "args": [ | |
| { | |
| "type": "local", | |
| "value": 5 | |
| }, | |
| { | |
| "type": "local", | |
| "value": 7 | |
| } | |
| ], | |
| "result": 8, | |
| "file": 0, | |
| "col": 8, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 8 | |
| }, | |
| "target": 9, | |
| "file": 0, | |
| "col": 8, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarOnceStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 9 | |
| }, | |
| "target": 3, | |
| "file": 0, | |
| "col": 1, | |
| "row": 4 | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "stmts": [ | |
| { | |
| "type": "IsDefinedStmt", | |
| "stmt": { | |
| "source": 3, | |
| "file": 0, | |
| "col": 1, | |
| "row": 4 | |
| } | |
| }, | |
| { | |
| "type": "AssignVarOnceStmt", | |
| "stmt": { | |
| "source": { | |
| "type": "local", | |
| "value": 3 | |
| }, | |
| "target": 2, | |
| "file": 0, | |
| "col": 1, | |
| "row": 4 | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "stmts": [ | |
| { | |
| "type": "ReturnLocalStmt", | |
| "stmt": { | |
| "source": 2, | |
| "file": 0, | |
| "col": 1, | |
| "row": 4 | |
| } | |
| } | |
| ] | |
| } | |
| ], | |
| "path": [ | |
| "g0", | |
| "smoke", | |
| "sum" | |
| ] | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment