{"id":16627087,"url":"https://github.com/ttulka/strokepm","last_synced_at":"2025-03-28T03:15:17.841Z","repository":{"id":242044681,"uuid":"808452000","full_name":"ttulka/strokepm","owner":"ttulka","description":"Stroke+- is an esoteric structured programming language","archived":false,"fork":false,"pushed_at":"2024-06-07T16:41:54.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T05:54:19.548Z","etag":null,"topics":["esolang","javascript","programming-language","stroke","turing-complete"],"latest_commit_sha":null,"homepage":"https://esolangs.org/wiki/Stroke%2B-","language":"JavaScript","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/ttulka.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":"2024-05-31T05:21:42.000Z","updated_at":"2024-06-07T16:41:58.000Z","dependencies_parsed_at":"2024-05-31T10:44:57.114Z","dependency_job_id":"c09cb4ec-cf5f-4c84-9a9a-7161a4c3402f","html_url":"https://github.com/ttulka/strokepm","commit_stats":null,"previous_names":["ttulka/stroke-plus-minus"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fstrokepm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fstrokepm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fstrokepm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fstrokepm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttulka","download_url":"https://codeload.github.com/ttulka/strokepm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245960813,"owners_count":20700781,"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":["esolang","javascript","programming-language","stroke","turing-complete"],"created_at":"2024-10-12T04:13:18.417Z","updated_at":"2025-03-28T03:15:17.798Z","avatar_url":"https://github.com/ttulka.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stroke+-\n\n\u003cimg src=\"logo.png\" style=\"width: 20%; float: right; margin: 1rem 0 1rem 2rem; border-radius: 1rem; max-width: 250px; float: right\" align=\"right\" width=\"250\"\u003e\n\n**Stroke+-**, also `+{/|\\}-`, is an esoteric structured programming language.\n\nWith only four instructions, it aims to be the simplest Turing-complete structured programming language possible.\n\nIt uses conditional loops and an unbounded number of non-negative integer variables along with manipulation of their values.\n\nStroke+- is an extension of [Stroke](https://github.com/ttulka/stroke) which is even simpler but at the cost of sacrificing Turing completeness.\n\n## Language\n\nStroke+- code consists of stroke symbols `/`, `|`, `\\`, and arithmetic signs `+`, `-`. \n\nAll other symbols are ignored.\n\n### Instructions\n\n| Instr   | Name       | Meaning |\n| ------- | ---------- | ------- |\n| `+var` | Increment  | Increments the value of the variable |\n| `-var` | Decrement  | Decrements the value of the variable |\n| `/var` | Loop start | Enters a new loop if the variable is non-zero |\n| `\\`     | Loop end   | Jumps back to the matching loop start |\n\nThe example code in Stroke+-:\n\n```stroke+-\n+ | \n/ | \n  - | \n  + || \n\\ \n+ |||\n```\n\ncan be translated into the following pseudocode:\n\n```\ninc var0\nwhile var0\n  dec var0\n  inc var1\ninc var2\n```\n\nOptionally, the instruction for output `!` may be implemented.\n\n### Variables\n\nA Stroke+- program runs on a theoretically infinite tape of non-negative integer cells that are randomly accessible via variables denoted by consecutive vertical stroke symbols (`|`) in unary form starting from zero. For instance, `|` refers to the variable indexed by 0, `||` refers to the variable indexed by 1, `|||` refers to the variable indexed by 2, and so on.\n\n## Examples\n\n(White spaces are added only for the sake of readability.)\n\n### Empty program\n\nThe simplest program is the empty program:\n\n```stroke+-\n```\n\n### Infinite loop\n\nAs variable *0* is never reset, the program loops forever:\n\n```stroke+-\n+ | / | \\\n```\n\n### Clear\n\nSets the value of variable *0* to zero:\n\n```stroke+-\nCLR 0:\n/ |\n  - |\n\\\n```\n\n### Move\n\nMoves the value in variable *0* to *1*:\n\n```stroke+-\nMOV 0 1:\n/ |\n  - |     dec 0\n  + ||    inc 1\n\\\n```\n\n### Copy\n\nCopies the value in variable *0* to *1* using *2* as an auxiliary:\n\n```stroke+-\nCPY 0 1:\n/ |\n  - |     dec 0\n  + ||    inc 1\n  + |||   inc 2\n\\\n/ |||\n  - |||   dec 2\n  + |     inc 0\n\\\n```\n\n### Add\n\nAdds the values in *0* and *1* to *0*:\n\n```stroke+-\nADD 0 1:\n/ ||\n  - ||\n  + |\n\\\n```\n\n### Conditional branching\n\nConditional branching (IF) can be simulated via loops:\n\n```stroke+-\nIF 0:\nCPY 0 2     aux 2\n/ ||| \n  / ||| - ||| \\  clr aux 2\n\n  do something conditionally...\n\\\n```\n\n### Fibonacci sequence\n\nComputes the Fibonacci sequence in *0* using *1* and *2* as auxiliaries:\n\n```stroke+-\nFIB:\n+ |||||\n/ |||||    forever\n  MOV 1 2\n  MOV 0 1\n  CPY 2 0\n  ADD 1 2\n\\\n```\n\n### Hello World\n\nFor computing \"Hello World\" the numeric values must be interpreted as a string. \n  It can achieved by defining a binary alphabet:\n\n| Symbol | Binary |\n| ------ | ------ |\n| ` `    | 000    |\n| `d`    | 001    |\n| `e`    | 010    |\n| `H`    | 011    |\n| `l`    | 100    |\n| `o`    | 101    |\n| `r`    | 110    |\n| `W`    | 111    |\n\nThe binary number `011010100100101000111101110100001` then corresponds to \"Hello World\".\n\nTo be concise, eight variables can be used and concatenated to represent the output. \n  They must contain values `00011`, `01010`, `01001`, `01000`, `11110`, `11101`, `00001`:\n\n```stroke+-\n+ | + | + |\n+ || + || + || + || + || + || + || + || + || + ||\n+ ||| + ||| + ||| + ||| + ||| + ||| + ||| + ||| + |||\n+ |||| + |||| + |||| + |||| + |||| + |||| + |||| + ||||\n+ ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + ||||| + |||||\n+ |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + |||||| + ||||||\n+ |||||||\n```\n\n## Computational class\n\nStroke+- is Turing complete according to [the structured program theorem](https://en.wikipedia.org/wiki/Structured_program_theorem), as conditional branching (selection) can easily be simulated via loops.\n\n## JavaScript interpreter\n\n```sh\nnpm i strokepm\n```\n\n```js\nconst strokepm = require('strokepm')\n\nstrokepm('+|/|-|+||\\\\+|||')  // [0, 1, 1]\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fstrokepm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttulka%2Fstrokepm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fstrokepm/lists"}