{"id":24479838,"url":"https://github.com/khbminus/l-static-analyzer","last_synced_at":"2025-09-02T23:46:28.652Z","repository":{"id":63904017,"uuid":"566354141","full_name":"khbminus/L-static-analyzer","owner":"khbminus","description":"Haskell project @ JUB (Fall 2022)","archived":false,"fork":false,"pushed_at":"2023-01-02T12:18:35.000Z","size":114,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T10:33:23.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khbminus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-11-15T13:54:47.000Z","updated_at":"2024-07-28T10:37:51.000Z","dependencies_parsed_at":"2023-01-14T13:01:11.405Z","dependency_job_id":null,"html_url":"https://github.com/khbminus/L-static-analyzer","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/khbminus%2FL-static-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khbminus%2FL-static-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khbminus%2FL-static-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khbminus%2FL-static-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khbminus","download_url":"https://codeload.github.com/khbminus/L-static-analyzer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243615827,"owners_count":20319781,"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":[],"created_at":"2025-01-21T10:27:18.816Z","updated_at":"2025-03-14T17:22:34.017Z","avatar_url":"https://github.com/khbminus.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# L programming language \u0026 static analyzer\n\n## L Syntax\n\nL is a simple imperative programming language which supports basic statements:\n\n* Variable assignment: `\u003cname\u003e := \u003cexpr\u003e`\n* `if`:\n\n```text\nif a \u003e b then { write a; b := a  } else { write b; a := b }\n```\n\nThat generally is\n\n```text\nif \u003cexpr\u003e then { \u003ctrueBody\u003e } else { \u003cfalseBody\u003e }\n```\n\n* `while`:\n\n```text\nwhile x \u003e 10 do { write x; x := x - 1 }\n```\n\nThat generally is\n\n```text\nwhile \u003cexpr\u003e do { \u003cbody\u003e }\n```\n\n* `Skip` -- no-op command\n* `Write \u003cexpr\u003e` and `Read \u003cvariable name\u003e` commands\n* Functions:\n    * where declaration `def \u003cname\u003e(\u003carg1\u003e, \u003carg2\u003e,...) { \u003cbody\u003e }`\n      or `def \u003cname\u003e(\u003carg1\u003e, \u003carg2\u003e,...) { \u003cbody\u003e} return \u003cexpr\u003e`\n    * and call is `\u003cname\u003e(arg1, arg2,...)` where `arg` is an expression. Call also supported in\n      expressions: `x := 2 + sum(2, 3)`.\n\nExpressions support variable access, function calls and several binary operations\nsuch: `+, -, *, /, %, \u003e, \u003e=, ==, !=, \u003c=, \u003c, \u0026\u0026, ||`.\n\n### Examples\n\nFactorial function:\n\n```text\ndef f(x) { ans := 1; while (x \u003e 0) do { ans := ans * x; x := x - 1 } } return ans\n```\n\nRecursive Fibonacci numbers:\n\n```text\ndef fib(x) { ans := 1; if (x \u003c 2) then { skip } else { ans := fib(x - 1) + fib(x - 2) } } return ans \n```\n\n## Usage of CLI app\n\n### REPL\n\nIf you run the application without arguments, you will get a REPL mode.\n\n### File interpretation\n\nIf flag `-i \u003cFILE\u003e` is passed, a file will be interpreted. Additionally, you can provide `--liveness-optimization` flag\nto enable liveness optimization and provide starting variables and its values.\n\n## Static Analysis\n\nWe wrote a static analyzer with liveness optimization that eliminate dead code. It could make code faster in situations\nwhen we compute unused in future code. E.g. in this code we have unnecessary infinity loop:\n\n```text\nwrite 1\ndef f() { x := 0; while 1 do { x := x + 1} } return 1\ndef g() { x := f() }\ng()\n```\n\nThis will be optimized into\n\n```text\nwrite 1\ndef f() { x := 0; while 1 do { x := x + 1} } return 1\ndef g() { }\ng()\n```\n\nThat is in common not used for optimization, but used for error analysis and highlighting.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhbminus%2Fl-static-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhbminus%2Fl-static-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhbminus%2Fl-static-analyzer/lists"}