{"id":18695073,"url":"https://github.com/rybla/imp-interpreter","last_synced_at":"2025-07-17T03:08:26.558Z","repository":{"id":81618191,"uuid":"320702178","full_name":"rybla/IMP-Interpreter","owner":"rybla","description":"This is a small Haskell implementation of the IMP language, as specified in the K Framework tutorial here.","archived":false,"fork":false,"pushed_at":"2020-12-11T23:05:51.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-29T01:37:57.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/rybla.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-12-11T22:56:45.000Z","updated_at":"2021-01-02T18:38:40.000Z","dependencies_parsed_at":"2023-03-06T01:15:24.280Z","dependency_job_id":null,"html_url":"https://github.com/rybla/IMP-Interpreter","commit_stats":null,"previous_names":["rybla/imp-interpreter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rybla/IMP-Interpreter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2FIMP-Interpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2FIMP-Interpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2FIMP-Interpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2FIMP-Interpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rybla","download_url":"https://codeload.github.com/rybla/IMP-Interpreter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2FIMP-Interpreter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265562308,"owners_count":23788503,"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":"2024-11-07T11:13:50.703Z","updated_at":"2025-07-17T03:08:26.544Z","avatar_url":"https://github.com/rybla.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IMP-Interpreter\n\nThis is a small Haskell implementation of the IMP language, as specified in the [K Framework](https://kframework.org) tutorial here: [imp.md](https://github.com/kframework/k/blob/master/k-distribution/tutorial/1_k/2_imp/lesson_5/imp.md).\nThis was written as a programming exercise for applying to an internship at [Runtime Verification](https://www.runtimeverification.com),\n\n\n\n## Building\n\nThis is a [Haskell stack](https://docs.haskellstack.org/en/stable/README/) project, which should easily build via\n\n```sh\nstack build\n```\n\nThere may be some minor annoyances with managing the lens library dependency, which I had to add in the `extra-deps` of the `stack.yaml`.\nTroubleshooting:\n- make sure to have the [lens](http://hackage.haskell.org/package/lens) library installed with stack (e.g. `stack install lens`)\n- try building again\n- if this doesn't work, try commenting out `extra-deps` in `stack.yaml` and then building\n\n\n\n## Running\n\nIn `src/app/Main.hs`, there is a `program` variable which you may modify to encode any IMP program you like. There is currently no parser yet written for this implementation, but there are many convenient abbreviations (viz `src/IMP/Grammar.hs`).\nRun `src/app/Main.hs` via\n\n```sh\nstack run\n```\n\nThe output will look something like\n\n```\n[IMP-Interpreter]\n[program]\nint n, sum ; n = 100 ; sum = 0 ; while (! n \u003c= 0) { sum = sum + n ; n = n + -1 ; }\n[output]\nSuccess (fromList [(n,0),(sum,5050)])\n```\n\nwhere the `[program]` section prints the `program` variable in `src/app/Main.hs`, and the `[output]` section prints the resulting state after interpreting the program.\n\n\n\n## Testing\n\nIn `src/test/Spec.hs`, there is a test suite of a few programs and their expected outputs (inspired by the examples given [here](https://github.com/kframework/k/tree/master/k-distribution/tutorial/1_k/2_imp/lesson_5/tests)).\nRun the test suite via\n\n```sh\nstack test\n```\n\nIf all the tests are successful, you'll get an output that looks something like:\n\n```\n✓ sum\n✓ collatz\n✓ primes\n```\n\nIf there are errors (i.e. differences between the expected output and the actual output) then you'll get an error message like:\n\n```\n✓ sum\n✗ collatz\n  [!] m: expected 2 but found 3\n✓ primes\n```\n\nwhere `m` is name of the variable in `collatze` that after interpreting `collatze` was expected to have value `2` but actually had value `3`.\n\n\n\n## Organization\n\nThis package contains one module, `IMP`, with two submodules:\n- `IMP.Grammar`: datatypes for the grammar of the IMP language, along with convenient abbreviations and smart constructors\n- `IMP.Semantics`: implementation of interpretation for the IMP language, based around the transformed monad `Interpretation` that keeps track of the interpretation state and allows for failure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frybla%2Fimp-interpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frybla%2Fimp-interpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frybla%2Fimp-interpreter/lists"}