{"id":27953985,"url":"https://github.com/acheshkov/program-graphs","last_synced_at":"2025-05-07T17:15:43.551Z","repository":{"id":40464309,"uuid":"393648151","full_name":"acheshkov/program-graphs","owner":"acheshkov","description":"A python library to build graphs for programs written in different programming languages.","archived":false,"fork":false,"pushed_at":"2022-05-06T17:06:14.000Z","size":129,"stargazers_count":11,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T17:15:38.327Z","etag":null,"topics":["control-flow-graph","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acheshkov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-07T10:11:37.000Z","updated_at":"2024-04-30T07:19:25.000Z","dependencies_parsed_at":"2022-08-09T21:12:42.297Z","dependency_job_id":null,"html_url":"https://github.com/acheshkov/program-graphs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acheshkov%2Fprogram-graphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acheshkov%2Fprogram-graphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acheshkov%2Fprogram-graphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acheshkov%2Fprogram-graphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acheshkov","download_url":"https://codeload.github.com/acheshkov/program-graphs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252922316,"owners_count":21825640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["control-flow-graph","static-analysis"],"created_at":"2025-05-07T17:15:42.879Z","updated_at":"2025-05-07T17:15:43.540Z","avatar_url":"https://github.com/acheshkov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# program-graphs\n\nAn experimental python library to build graphs for programs written in different programming languages. The library is based on a great [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) library and able to provide the following relations in a program:\n\n - Control Flow\n - Data Dependency \n - Syntax Dependency\n\n\n# Simple Example\n\nFrom console:\n\n```bash \n$ echo \"if (x \u003e 0) { y = 0; }\" |  python3 -m program_graphs\n```\n\nFrom python:\n\n```python\n\nfrom program_graphs.adg import parse_java\n\njava_code = '''\n    if (x  \u003e 0) {\n        y = 0;\n    }\n'''\n\nadg = parse_java(java_code)\nprint(adg)\n```\nExpected output are nodes and relations between them:\n```\nFrom                        To                      Dependencies\n----------------------  --  ----------------------  -------------------------------\nprogram:1               -\u003e  if:2                    syntax,control-flow\nprogram:1               -\u003e  block-exit:10           syntax\nif:2                    -\u003e  if_condition:3          syntax,control-flow\nif:2                    -\u003e  block:4                 syntax\nif:2                    -\u003e  if_exit:9               syntax\nif_condition:3          -\u003e  block:4                 control-flow\nif_condition:3          -\u003e  if_exit:9               control-flow\nblock:4                 -\u003e  {:5                     syntax\nblock:4                 -\u003e  }:7                     syntax\nblock:4                 -\u003e  expression_statement:6  syntax,control-flow\nblock:4                 -\u003e  block-exit:8            syntax\nexpression_statement:6  -\u003e  block-exit:8            control-flow\nblock-exit:8            -\u003e  if_exit:9               control-flow\nif_exit:9               -\u003e  block-exit:10           control-flow\n\n```\n\n# How to install\n\n\n```bash\n$ git clone --recurse-submodules git@github.com:acheshkov/program-graphs.git\n$ pip install -r requirements/default.txt\n```\n\n\n# Limitations\n\n - For now, only a Java language is supported;\n - For now, `CFG`, `CDG`, `DDG`, and `AST` relations are accounted;\n - It's not possible to build graphs for a project or class. Only method level is supported\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facheshkov%2Fprogram-graphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facheshkov%2Fprogram-graphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facheshkov%2Fprogram-graphs/lists"}