{"id":24289288,"url":"https://github.com/rla/while","last_synced_at":"2025-06-16T20:32:41.436Z","repository":{"id":7458771,"uuid":"8803864","full_name":"rla/while","owner":"rla","description":"Some dataflow analysis in Java","archived":false,"fork":false,"pushed_at":"2013-03-15T16:38:23.000Z","size":424,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T09:38:39.833Z","etag":null,"topics":["java","programming-language","static-analysis"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/rla.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":"2013-03-15T16:34:03.000Z","updated_at":"2024-01-13T23:51:19.000Z","dependencies_parsed_at":"2022-08-29T07:33:04.950Z","dependency_job_id":null,"html_url":"https://github.com/rla/while","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rla/while","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fwhile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fwhile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fwhile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fwhile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rla","download_url":"https://codeload.github.com/rla/while/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fwhile/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260232783,"owners_count":22978617,"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":["java","programming-language","static-analysis"],"created_at":"2025-01-16T10:51:49.070Z","updated_at":"2025-06-16T20:32:41.385Z","avatar_url":"https://github.com/rla.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Some code I wrote in 2011 to study the problem of dataflow analyses. All ideas were\ntaken from the article [Lecture Notes in Static Analysis](http://www.itu.dk/people/brabrand/UFPE/Data-Flow-Analysis/static.pdf)\nby M.I.Schwartzbach.\n\nThe parser for the toy language \"while\" is implemented using the [JavaCC](http://en.wikipedia.org/wiki/JavaCC)\nparser generator. The dataflow analyzer is type-safe and implements a worklist solver algorithm. I implemented constraints for\nthe simpler examples (initialized vars, liveness, sign).\n\nBuilding\n--------\n\nThe AST nodes have to be compiled first:\n\n    cd language\n    ant jar\n    cd ..\n\nThen the parser can be compiled:\n\n    cd parser\n    ant jar\n    cd ..\n    \nThen the analyzer code can be compiled:\n\n    ant jar\n    \nAnd finally, examples can be run:\n\n    ant liveness iv sign\n    \nExample\n-------\n\nHere is the sign example input source:\n\n    var [x, y, z];\n    x=1;\n    y=0-2;\n    z=0;\n    x=10;\n    while (x\u003e0) {\n        x=x-1;\n    }\n    \nThe parser turns this into AST which is transformed to CFG. Constraints\nfor the CFG are then derived and the constraint system is produced:\n\n    [[exit]] = ALLJOIN([[x\u003e0]])\n    [[entry]] = []\n    [[x\u003e0]] = ALLJOIN([[x=10]],[[x=x-1]])\n    [[z=0]] = ALLJOIN([[y=0-2]]){z-\u003eeval(0)}\n    [[var [x, y, z]]] = ALLJOIN([[entry]]){z=null, y=null, x=null}\n    [[x=10]] = ALLJOIN([[z=0]]){x-\u003eeval(10)}\n    [[x=1]] = ALLJOIN([[var [x, y, z]]]){x-\u003eeval(1)}\n    [[x=x-1]] = ALLJOIN([[x\u003e0]]){x-\u003eeval(x-1)}\n    [[y=0-2]] = ALLJOIN([[x=1]]){y-\u003eeval(0-2)}\n    \nAll constraint variables are here in the form [[node name]]. After solving\nthe system, node values are dumped:\n\n    entry = {}\n    var [x, y, z] = {z=null, y=null, x=null}\n    x=1 = {z=null, y=null, x=POS}\n    y=0-2 = {z=null, y=NEG, x=POS}\n    z=0 = {z=ZERO, y=NEG, x=POS}\n    x=10 = {z=ZERO, y=NEG, x=POS}\n    x=x-1 = {z=ZERO, y=NEG, x=TOP}\n    x\u003e0 = {z=ZERO, y=NEG, x=TOP}\n    exit = {z=ZERO, y=NEG, x=TOP}\n    \nLicense\n-------\n\n    The MIT License (MIT)\n    Copyright (c) 2013 Raivo Laanemets\n    \n    Permission is hereby granted, free of charge, to any person obtaining a copy of this software\n    and associated documentation files (the \"Software\"), to deal in the Software without restriction,\n    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\n    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\n    subject to the following conditions:\n    \n    The above copyright notice and this permission notice shall be included in all copies or substantial\n    portions of the Software.\n    \n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fwhile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frla%2Fwhile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fwhile/lists"}