{"id":22197945,"url":"https://github.com/aionescu/boros","last_synced_at":"2025-03-24T23:35:08.708Z","repository":{"id":122961297,"uuid":"398388552","full_name":"aionescu/boros","owner":"aionescu","description":"Functional language for self-modifying programs","archived":false,"fork":false,"pushed_at":"2022-01-29T10:51:43.000Z","size":454,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T02:27:47.067Z","etag":null,"topics":["first-class-comments","haskell","interpreter","langjam","language"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aionescu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-08-20T20:05:14.000Z","updated_at":"2022-01-29T10:52:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"4eb32470-99ce-4ffd-840f-3552e174c914","html_url":"https://github.com/aionescu/boros","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aionescu%2Fboros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aionescu%2Fboros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aionescu%2Fboros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aionescu%2Fboros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aionescu","download_url":"https://codeload.github.com/aionescu/boros/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372221,"owners_count":20604488,"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":["first-class-comments","haskell","interpreter","langjam","language"],"created_at":"2024-12-02T14:24:47.355Z","updated_at":"2025-03-24T23:35:08.693Z","avatar_url":"https://github.com/aionescu.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eboros\u003c/h1\u003e\n\n  \u003cimg src=\"Assets/Ouroboros.png\" width=\"150\" height=\"150\" /\u003e\n\u003c/div\u003e\n\n`boros` (Shortened from [Ouroboros](https://en.wikipedia.org/wiki/Ouroboros)) is a language that allows you to write self-modifying programs.\n\nIt was developed during the [2021 Lang Jam](https://github.com/langjam/jam0001). The theme of the hackathon was [`first-class comments`](#first-class-comments).\n\n## Language features\n\n`boros` is a strict, impure, dynamically-typed functional language with ML-inspired syntax.\n\n[*(Jump to examples)*](Examples)\n\n### Syntax\n\nThe entire `boros` script file is one big expression, which is evaluated and printed by the interpreter. (If it evaluates to `()`, called *unit*, then nothing is printed)\n\nVariables and functions are declared with `let`, and multiple mutually-recursive functions can be declared with `let ... and`.\n\nHere's a simple factorial program:\n\n```haskell\nlet fact x =\n  if not x then\n    1\n  else\n    x * fact (x - 1)\nin\n\nlet n = 10 in\nfact n\n```\n\nValues in `boros` are immutable, with the exception of *lists* and *records*.\n\nHere's how to define and use them:\n\n```haskell\nlet l = [1, 2, 3] in\n\nl.[0] \u003c- \"abc\";\nprint l.[0];\n\nlet r = { x = 2, y = 3 } in\n\nr.x \u003c- r.x + 1;\nr.z \u003c- 4; {- \"You can even add new fields to an existing record!\"; -}\n```\n\n### First-Class Comments\n\nIn `boros`, comments *are interpreted as part of the source code*. (Can't get more first-class than that, right?)\n\nFurthermore, all comments are accessible (in text form) from within `boros` scripts via a *mutable* global list called `comments`.\n\nWhen the script terminates, the comments *are replaced with the new strings from the `comments` list*, and *the script is re-run*. This continues until either the script stops modifying the comments, explicitly calls the `halt ()` function, or an exception is thrown.\n\nA good example of this can be found in the [Fibonacci](Examples/Fibonacci.brs) example.\n\nComments are delimited by `{-` and `-}`. Currently, there's no support for line comments or nested comments.\n\nScripts can also have a shebang (`#!`) on the first line, which is ignored by the interpreter, and is not accessible from within the script.\n\n### Other bits of syntax\n\n#### Custom operators\n\n```haskell\n{- \"Safe division\"; -}\nlet (/?) a b =\n  if b == 0 then\n    0\n  else\n    a / b\nin\n2 /? 0\n```\n\n#### Lambda expressions\n\n```haskell\nlet add = x y -\u003e x + y\nin add 2 3\n\n{- \"Same as the following:\"; -}\nlet add x y = x + y\nin add 2 3\n\nlet add = (+)\nin add 2 3\n```\n\n#### Sequencing with `;`\n\n`a; b` will evaluate `a` and ignore its result, then evaluate and return `b`. This can be used to sequence (usually side-effectul) expressions.\n\n```haskell\nprint 3;\na.[0].x \u003c- 2;\nfactorial 100\n```\n\n### Types and Exceptions\n\n`boros` is dynamically-typed. Performing operations on values of the wrong type will halt the program with a `Runtime error`.\n\nYou can use the `type` function to get the \"approximate\" type of a value, e.g. `type 2 == \"Num\"`, `type [1, \"abc\"] == \"List\"`.\n\nYou can also throw exceptions using the `throw` function. Any value can be provided as parameter, and will be `show`n in the error message. There is currently no `catch`/`finally` mechanism.\n\n## VS Code Extension\n\nThis repo also includes a VS Code extension for syntax highlighting.\n\nYou can install it by running the `install-vscode-ext.sh` script.\n\n## Build instructions\n\n### Prerequisites\n\n* GHC (\u003e= 9.0.1)\n* cabal (\u003e= 3.6)\n\n(Can be installed via [ghcup](https://www.haskell.org/ghcup/))\n\n### Build the interpreter\n\n```sh\ncabal build\n```\n\n### Run the interpreter\n\n```sh\ncabal run . \u003cscript file\u003e \u003cargs for boros script\u003e\n```\n\nIf not already built, `cabal run` will also build the project.\n\ne.g.\n\n```sh\ncabal run . Examples/Factorial.brs 100\n```\n\n## License\n\nThis repository is licensed under the terms of the GNU General Public License v3.\n\nFor more details, see [the license file](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faionescu%2Fboros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faionescu%2Fboros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faionescu%2Fboros/lists"}