{"id":16315630,"url":"https://github.com/andreasabel/loop","last_synced_at":"2025-05-05T20:05:36.334Z","repository":{"id":74481563,"uuid":"162114295","full_name":"andreasabel/loop","owner":"andreasabel","description":"Uwe Schönings LOOP language","archived":false,"fork":false,"pushed_at":"2018-12-17T10:57:58.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T20:04:03.860Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreasabel.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-17T10:34:33.000Z","updated_at":"2019-12-05T06:36:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"b55eb359-5203-4647-98be-7a4a89472b6f","html_url":"https://github.com/andreasabel/loop","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/andreasabel%2Floop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasabel%2Floop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasabel%2Floop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasabel%2Floop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreasabel","download_url":"https://codeload.github.com/andreasabel/loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252569646,"owners_count":21769517,"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-10-10T21:58:04.016Z","updated_at":"2025-05-05T20:05:36.292Z","avatar_url":"https://github.com/andreasabel.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uwe Schöning's LOOP language\n\nThis is an imperative toy language that represents exactly the primitive\nrecursive functions on the natural numbers.\n\nSee https://en.wikipedia.org/wiki/LOOP_(programming_language).\n\n## Syntax\n\nThe grammar (in LBNF notation) is in file [LoopLang.cf](LoopLang.cf).\n\nAn example (Eucledian division) is in file [div.loop](test/div.loop),\nreprinted here:\n```\n-- Computes q := n `div` m by iteration on n.\n\nn := zero + 641\nm := zero + 80\n\n-- The counter c counts down from m.\n-- At c==0, we found one copy of m in n.\n\nc := m + 0\n\nloop n do\n  c := c - 1\n\n  -- The usual trick to do boolean operations:\n  -- yes := (c == 0)\n\n  yes := zero + 1\n  loop c do\n    yes := zero + 0\n  end\n\n  -- If c == 0, one iteration is finished.\n  -- We increase q and reset the counter c and the remainder r.\n\n  loop yes do\n    q := q + 1\n    c := m + 0\n  end\nend\n\nreturn q\n```\n\n## Semantics\n\nAll variables are initially set to 0\nand can later only set to the value of another\nvariable plus/minus a constant via the assignment statement.\n(Referring to variable that we never modify, like `zero`,\nwill give us thus always the constant `0`.  Thus, if we want to set a variable\nto a constant like `123`, we can use expression `zero + 123`.)\n\nThe `loop` construct iterates the statements between `do` and `end`\nexactly as many times as the value of the guarding variable was upon\nentering the loop.\n\nThe result of the program is the value of the variable given by the\nsingle `return` statement at the end of the program.\n\n## Building\n\nBuilds via a ```Makefile```.\nNeeds Haskell (GHC) and the BNFC tool installed together with lexer generator alex and parser generator happy.\n\nFor installation including dependencies, type the following in the project root directory.\n```\ncabal install alex happy BNFC\nmake\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasabel%2Floop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreasabel%2Floop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasabel%2Floop/lists"}