{"id":20425431,"url":"https://github.com/catseye/beturing","last_synced_at":"2025-08-24T09:23:28.728Z","repository":{"id":3652080,"uuid":"4719987","full_name":"catseye/Beturing","owner":"catseye","description":"https://codeberg.org/catseye/Beturing : A language corresponding to Turing machines with planar control graphs","archived":false,"fork":false,"pushed_at":"2014-08-19T15:23:33.000Z","size":328,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-29T09:40:43.844Z","etag":null,"topics":["esolang","esoteric-language","fungeoid","turing-machine"],"latest_commit_sha":null,"homepage":"https://catseye.tc/node/Beturing","language":"Lua","has_issues":false,"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/catseye.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-19T22:31:34.000Z","updated_at":"2023-11-09T10:45:10.000Z","dependencies_parsed_at":"2022-08-31T04:00:30.388Z","dependency_job_id":null,"html_url":"https://github.com/catseye/Beturing","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/catseye/Beturing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FBeturing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FBeturing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FBeturing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FBeturing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catseye","download_url":"https://codeload.github.com/catseye/Beturing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FBeturing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267578003,"owners_count":24110351,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","esoteric-language","fungeoid","turing-machine"],"created_at":"2024-11-15T07:13:19.222Z","updated_at":"2025-07-28T20:09:02.190Z","avatar_url":"https://github.com/catseye.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Beturing\r\n========\r\n\r\na Befunge-flavoured Turing machine\r\n----------------------------------\r\n\r\n*v1.1, Chris Pressey, June 8 2005*\r\n\r\n### Introduction\r\n\r\nBeturing is a programming language based on a \"universal\" Turing machine\r\nwith an unbounded, 2-dimensional \"tape\". (The Turing machine on which it\r\nis based is \"universal\" in the sense that the machine's state transition\r\ndiagram is stored on the \"tape\" along with the data.)\r\n\r\n### General Layout\r\n\r\nThis 2-dimensional \"tape\" is where all the action happens; it is called\r\nthe *playfield* and is divided into discrete units called *cells*. Each\r\ncell may store exactly one of a number of *symbols* drawn from a finite\r\nalphabet.\r\n\r\nThere are two \"heads\" that access the playfield, one of which (the *data\r\nhead*) reads and alters the data (like in a common Turing machine,) the\r\nother of which (the *code head*) reads the state transition diagram.\r\n\r\nThe state transition diagram is made up of *codes*. Each code is a 2x2\r\nblock of cells in the following form:\r\n\r\n    ab\r\n    \u003e/\r\n\r\nThe code head is considered to be over a code when it is over the\r\nupper-left cell of it. The names and meanings of the four parts of the\r\ncode are as follows:\r\n\r\n-   The upper-left cell of a code contains a symbol to look for, called\r\n    the *seek symbol*. All symbols are valid seek symbols.\r\n-   The upper-right cell of the code contains a symbol to replace it\r\n    with, called the *replacement symbol*. All symbols are valid\r\n    replacement symbols.\r\n-   The lower-left cell of the code contains an indication of how to\r\n    move the data head, called the *data head movement operator*. The\r\n    set of valid data head movement operators is {`\u003e`, `\u003c`, `^`, `v`,\r\n    `.`, `*`}.\r\n-   The lower-right cell of the code contains an indication of what to\r\n    do with the code head, called the *state transition operator*. The\r\n    set of valid state transition operators is {`\u003e`, `\u003c`, `^`, `v`, `/`,\r\n    `@`}.\r\n\r\n### Syntax\r\n\r\nWhen a Beturing playfield is loaded from source such as a text file,\r\nlines are translated to rows in the playfield. The first line is loaded\r\nat (0, 0), and subsequent lines are loaded at (0, 1), (0, 2), etc. Lines\r\nwhich begin with a `#` are not loaded into the playfield. Certain lines\r\nthat begin with `#`, listed below, are directives meaningful to any\r\nBeturing interpreter. The rest may have a local interpretation (such as\r\nthe `#!` convention on Unix systems,) or be ignored. A line which begins\r\nwith `##` is guaranteed to be ignored.\r\n\r\n-   Lines of the form `# @(x, y)` where *x* and *y* are integers\r\n    reposition the loading of the text file; subsequent lines will be\r\n    loaded into the playfield at the given position.\r\n-   Lines of the form `# C(x, y)` specify the initial position of the\r\n    code head. The last such line is the one that takes effect.\r\n-   Lines of the form `# D(x, y)` specify the initial position of the\r\n    data head. The last such line is the one that takes effect.\r\n\r\n### Semantics\r\n\r\nWhen a Beturing machine is set in motion, it *interprets* the code under\r\nthe code head, transitions to a new state by moving the code head, then\r\nrepeats indefinitely until the machine enters the *halt* state.\r\n\r\nHere is how each code is interpreted:\r\n\r\n-   If the data head movement operator is the special symbol `*`, the\r\n    following things happen:\r\n    -   The data head is moved by the positive interpretation of the\r\n        replacement symbol. (Note that this behaviour is new in version\r\n        1.1; no data head movement would occur in the `*` case in v1.0.)\r\n    -   The code head is moved by the positive interpretation (x2) of\r\n        the state transition operator.\r\n\r\n-   Otherwise, if the symbol under the data head matches the seek\r\n    symbol, the following things happen:\r\n    -   The replacement symbol is written to the cell under the data\r\n        head.\r\n    -   The data head is moved by the positive interpretation of the\r\n        data head movement operator.\r\n    -   The code head is moved by the positive interpretation (x2) of\r\n        the state transition operator.\r\n\r\n-   Otherwise the symbol under the data head does **not** match the seek\r\n    symbol, and the following things happen:\r\n    -   The code head is moved by the negative interpretation (x2) of\r\n        the state transition operator.\r\n\r\nThe positive and negative interpretations of the data head movement and\r\nstate transition operators are given below:\r\n\r\n    Symbol    Positive interpretation   Negative interpretation\r\n    --------- ------------------------- -------------------------\r\n    \u003e         Move right                Move right\r\n    \u003c         Move left                 Move left\r\n    ^         Move up                   Move up\r\n    v         Move down                 Move down\r\n    .         Don't move                Don't move\r\n    /         Move right                Move down\r\n    \\         Move left                 Move down\r\n    |         Move up                   Move down\r\n    -         Move left                 Move right\r\n    `         Move right                Move up\r\n    '         Move left                 Move up\r\n    @         Halt                      Halt\r\n\r\nNote that \"x2\" in the rules given above means to advance two cells in\r\nthe given direction; this is used everywhere for moving the code head\r\nbecause codes are 2x2 cell blocks.\r\n\r\n### Discussion\r\n\r\nThe Beturing language was designed (in part) as a test of the\r\nwire-crossing problem, in the following manner. Note these things about\r\nBeturing:\r\n\r\n-   Unlike Befunge's instruction pointer, the code head does not have\r\n    \"direction\" or \"delta\" state; it has only \"position\" state. Its next\r\n    position (and thus the machine's next state) is determined entirely\r\n    by the state transition operator of the current code.\r\n-   Also unlike Befunge and its `#` instruction, there is no \"leap over\"\r\n    state transition operator. Therefore the next state must always be\r\n    reachable by a continuous, unbroken path through the playfield.\r\n-   Lastly, unlike Befunge and its torus, the Beturing playfield is\r\n    really unbounded in all four directions - there is no wrapping\r\n    around, making it a true plane.\r\n\r\nAll this added together means that a Beturing machine is incapable of\r\nhaving a state transition diagram that is not a planar graph. A state\r\ntransition diagram which is a complete 5-vertex graph, for example, is\r\nnot planar.\r\n\r\nThis **might** mean that it is impossible to construct a true universal\r\nTuring machine in Beturing, *if* a universal Turing machine requires a\r\nstate diagram that is not a planar graph.\r\n\r\nIf this were the case then Beturing would not be Turing-complete, and in\r\nfact its level of computational power would probably be difficult to\r\ndetermine.\r\n\r\n### Update\r\n\r\nVersion 1.0 of the Beturing language, and an interpreter for it written\r\nin Lua 5, was released June 6th 2005.\r\n\r\nOn June 7th, graue's development of the Archway language, and my\r\nsketches for a Smallfuck interpreter in Beturing have both strongly\r\nsuggested that a universal Turing machine's state diagram can indeed be\r\na planar graph. I'd still like to go ahead and implement the Smallfuck\r\ninterpreter, though, since (even if it's a foregone conclusion) it would\r\nbe pretty impressive to see in action.\r\n\r\nOn June 8th I added the \"data head can move on `*`\" semantics for v1.1,\r\nin preparation for implementing a Smallfuck interpreter from my\r\nsketches. Note that this addition does not constitute an increase in\r\nBeturing's computational power, only its expressiveness. It was possible\r\nto do the same thing in v1.0, but it required one code per symbol in the\r\nalphabet, which was a little excessive.\r\n\r\nOn June 10th I added extra \"decision\" state transition operators (shown\r\nwith a grey background in the above table) for extra flexibility; there\r\nare some planar graphs that can't be rendered in Beturing with just `/`:\r\nsee the diagram of the Uhing 5-state Busy Beaver machine, for example.\r\nAs always, you can use the `-o` flag to the interpreter to enforce the\r\nv1.0 semantics where these aren't available, if you're a purist.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fbeturing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatseye%2Fbeturing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fbeturing/lists"}