{"id":20824941,"url":"https://github.com/hornc/abctag","last_synced_at":"2026-04-14T12:34:21.163Z","repository":{"id":37964628,"uuid":"282378401","full_name":"hornc/abctag","owner":"hornc","description":"Experimental Arithmetic-Bitwise-Cyclic-Tag-over-HTTP server.","archived":false,"fork":false,"pushed_at":"2022-07-30T05:03:04.000Z","size":38,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T17:26:09.418Z","etag":null,"topics":["bitwise-cyclic-tag","esolang","tag-systems"],"latest_commit_sha":null,"homepage":"https://abctag.herokuapp.com/","language":"Python","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/hornc.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}},"created_at":"2020-07-25T05:34:08.000Z","updated_at":"2023-08-19T19:59:33.000Z","dependencies_parsed_at":"2022-09-03T20:50:19.144Z","dependency_job_id":null,"html_url":"https://github.com/hornc/abctag","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hornc%2Fabctag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hornc%2Fabctag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hornc%2Fabctag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hornc%2Fabctag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hornc","download_url":"https://codeload.github.com/hornc/abctag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243172144,"owners_count":20247887,"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":["bitwise-cyclic-tag","esolang","tag-systems"],"created_at":"2024-11-17T22:24:21.893Z","updated_at":"2025-12-24T12:54:49.526Z","avatar_url":"https://github.com/hornc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# abctag\nExperimental Arithmetic-Bitwise-Cyclic-Tag-over-HTTP server.\n\nThis is an arithmetic implementation of the low-level Turing complete esoteric programming language [Bitwise Cyclic Tag](https://esolangs.org/wiki/Bitwise_Cyclic_Tag)\n\nIt works as a webserver which redirects (303) between `/\u003cprogram\u003e/\u003cdatastring\u003e/` states. When/if the data string is empty, it returns a 200.\n\nAdditionally, it provides UTF-8 output in response JSON and collects all output in cookies when the datastring ever contains `STX` `ETX` delimited bytes with correct start/stop bits.\n\n## Start the server\n\n    ./abct-web 8080\n\n## Example usage\n\nBrowsers tend to complain about too many redirects when used with most programs.\n\nThe following is a `curl` command demonstrating how to disable redirect limits, and view cookie output for the \"Hello, World!\" example:\n\n    curl -sLc- --max-redirs -1 localhost:8080/5814709794364855124394590463104036274829130886495847474077938692059840777884347510099960415045708498000107405098735286987994946170377558/2\n\nThere is also a `/b/` path that will redirect raw binary BCT data to the corresponding program Gödel number, \n\n    localhost:8080/b/011/0\n\nwill redirect to\n\n     localhost:8080/13/0\n\n## Bitstring to Gödel numbering\n\nThe numbering convention used in this arithmetic implementation of Bitwise Cyclic Tag is simply interpreting a bitstring as a [little-endian](https://en.wikipedia.org/wiki/Endianness) [bijective base-2](https://en.wikipedia.org/wiki/Bijective_numeration) numeral.\n\nThis can be accomplished as a two step process:\n\n* Convert the bitstring to its arithmetic (place value index) order (i.e. reverse the string)\n* Convert the symbols to bijective base-2 (`1` → `2`, `0` → `1`)\n\nA BCT program bitstring is processed left-ro-right, as strings are generally read. For ease of arithmetic processing it is helpful to use this processing order index as the place value of each bit.\nThe left-most bit is treated as the least significant bit of the resulting numeral. This results in reversing the original bitstring from its LTR little-endian order to the conventional numeric positional notation (BE).\n`01000` → `00010`\n\nNow interpret this as a bijective base-2 numeral. This allows both symbols to be meaningful in the MSB position, unlike in binary where leftmost zeros do not affect the value.\n`00010` → `11121`\n\n`11121` as a bijective base-2 numeral represents 33.\n\nThis can be checked by passing the bitstring as a program with a null data string to the abct endpoint\nhttps://abctag.herokuapp.com/b/01000/0 which will redirect to the arithmetic version: https://abctag.herokuapp.com/33/0/\n\n```\n{\n  \"program\": \"01000\",\n   \"data\": \"\"\n}\n```\n\n| bitstring (LE) | bijective base-2 | value |\n|:---------------|-----------------:|------:|\n|           |                  | 0 |\n| `0`       |  1               | 1 |\n| `1`       |  2               | 2 |\n| `00`      | 11               | 3 |\n| `10`      | 12               | 4 |\n| `01`      | 21               | 5 |\n| `11`      | 22               | 6 |\n| `000`     | 111              | 7 |\n| `100`     | 112              | 8 |\n| `010`     | 121              | 9 |\n| `110`     | 122              | 10|\n\n\nNote, the above is just one of many possible conventions for converting bitstrings into numeric values for arithmetic interpretation of Bitwise Cyclic Tag.\nOther conventions will require different arithmetic equations, but the underlying cyclic tag concept and computation will be the same. This implementation uses a slightly different Gödel numbering from the one described at [esolangs.org](https://esolangs.org/wiki/Bitwise_Cyclic_Tag#Arithmetic_interpretation_of_BCT).\nThe program string numbering is identical (reverse the bitstring), but the esolangs' article uses a different system for the data string where the bitstring is *not* reversed. I didn't want to implent two bitstring conversions, so here program and data bitstrings are converted the same way.\nFor our data strings: data is appended as the MSB, and deletions occur at the LSB (i.e. bitshift right, or divde-by-2).\n\n## CLI version\n\nThere is also a command line utility for testing:\n\n    ./abct-cli $(\u003cexamples/hello-world.abct) 2\n    \n2 is the initial data value representing a binary bitstring `1`\n\n1 represents binary bitstring `0`\n\n0 represents the empty datastring, or `null`, and is the halt condtion.\n\nArithmetic BCT programs require an initial starting input of at least 2 to perform any active computation.\n\n### Truth machine example usage\n\nFor the 'zero' case (BCT `10` = bijective base-2 `12` = input value `4`):\n\n    ./abct-cli $(\u003cexamples/truth-machine.abct) 4 | grep OUTPUT\n\nwhich gives a single output line:\n\n    39217909666694773142903776444132544299164543308230190564477239295\t3026142152962\t11000000100100110000010000101001000000110\tOUTPUT\u003e\u003e\u003e\t0\n\nFor the 'one' case (BCT `11` = bijective base-2 `22` = input value `6`):\n\n    ./abct-cli $(\u003cexamples/truth-machine.abct) 6 | grep OUTPUT\n \n which repeats indefinitely:\n \n    39217909666697766298257028305177290289800352374943150376712755052\t12104570709002\t1101000000100100110001010000101001000000110\tOUTPUT\u003e\u003e\u003e\t1\n \n The CLI output columns represent:\n * PROGRAM VALUE.\n * DATA VALUE.\n * DATA as binary.\n * The string `OUTPUT\u003e\u003e\u003e` if any output was completed on this step.\n * Decoded OUTPUT, if any.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhornc%2Fabctag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhornc%2Fabctag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhornc%2Fabctag/lists"}