{"id":13836590,"url":"https://github.com/tsoding/turd","last_synced_at":"2026-01-24T01:35:17.602Z","repository":{"id":91698495,"uuid":"304592433","full_name":"tsoding/turd","owner":"tsoding","description":"Turing Machine in D","archived":false,"fork":false,"pushed_at":"2020-10-17T05:52:07.000Z","size":17,"stargazers_count":27,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-17T07:34:59.373Z","etag":null,"topics":["hacktoberfest","hacktoberfest2020"],"latest_commit_sha":null,"homepage":"","language":"D","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/tsoding.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}},"created_at":"2020-10-16T10:19:48.000Z","updated_at":"2023-12-15T15:00:07.000Z","dependencies_parsed_at":"2024-01-13T17:02:23.674Z","dependency_job_id":"d6dc262b-ec5d-474d-bd0a-7853dc285a9d","html_url":"https://github.com/tsoding/turd","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/tsoding%2Fturd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fturd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fturd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fturd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsoding","download_url":"https://codeload.github.com/tsoding/turd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251499139,"owners_count":21599021,"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":["hacktoberfest","hacktoberfest2020"],"created_at":"2024-08-04T15:00:50.440Z","updated_at":"2026-01-24T01:35:17.552Z","avatar_url":"https://github.com/tsoding.png","language":"D","funding_links":[],"categories":["D"],"sub_categories":[],"readme":"# Turing Machine Interpreter\n\nSimple Turing Machine interpreter implemented in D based on Wikipedia article about Turing Machine: [https://en.wikipedia.org/wiki/Turing_machine](https://en.wikipedia.org/wiki/Turing_machine)\n\n## Quick Start\n\nThe build expects [dmd](https://dlang.org/download.html) available in `$PATH`.\n\n```console\n$ make\n$ ./turd turds/add.turd tapes/input-05.tape\n\u003cPRESS ENTER TO STEP DEBUG\u003e\n```\n\n## Turd File Format\n\nTurd files (examples are located in the [./turds/](./turds/) folder) are the files that contain instructions for the Turing Machine to interpret:\n\n- Each instruction is located on a separate line.\n- Correct instruction has the format: `\u003cCURRENT-STATE\u003e \u003cREAD-SYMBOL\u003e \u003cWRITE-SYMBOL\u003e \u003cDIRECTION\u003e \u003cNEXT-STATE\u003e`:\n  - `\u003cCURRENT-STATE\u003e` is a sequence of non-space characters that represents the state in which this instruction is activated.\n  - `\u003cREAD-SYMBOL\u003e` is a sequence of non-space characters that represents the symbol that is read by the head of the machine which along with a specific `\u003cCURRENT-STATE\u003e` activates the instruction.\n  - `\u003cWRITE-SYMBOL\u003e` is a sequence of non-space characters that represents the symbol that is written to the current cell on the tape when the instruction is activated.\n  - `\u003cDIRECTION\u003e` is either symbol `L` or `R` which indicates the direction in which the head of the Turing Machine should step after executing the instruction.\n  - `\u003cNEXT-STATE\u003e` is a sequence of non-space characters that represents the state to which the Machine should switch after executing the instruction.\n- Any line may have any amount of leading or trailing whitespaces. All of them are stripped off before processing any instructions.\n- Any empty line after stripping whitespace is ignored.\n- Any line that starts with `#` after stripping whitespaces is ignored.\n\n## Tape File Format\n\nTape files (examples are located in the [./tapes/](./tapes/) folders) are the files that contain initial state of the Turing Machine tape.\n\n- A tape file consists of sequence of symbols separated by any amount of whitespace characters.\n- Each symbol is a sequence of non-space characters that represents the symbol stored in the corresponding cell of the Machine's tape.\n\n## Execution Process\n\nExecution process starts with\n- loading the provided tape file into the tape of the Virtual Turing Machine,\n- setting the head position to 0 (can be changed with flag `-p`),\n- switch to the state `BEGIN` (can be change with flag `-s`).\n\nThen on each iteration of execution the machine finds the first instruction with the matching `\u003cCURRENT-STATE\u003e` and `\u003cREAD-SYMBOL\u003e` and executes that instruction. If the machine cannot find an instruction with the matching `\u003cCURRENT-STATE\u003e` and `\u003cREAD-SYMBOL\u003e`it halts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Fturd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsoding%2Fturd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Fturd/lists"}