{"id":22367235,"url":"https://github.com/yeyom/universal-turing-go","last_synced_at":"2025-07-13T21:07:12.271Z","repository":{"id":242959956,"uuid":"809883319","full_name":"YeyoM/universal-turing-go","owner":"YeyoM","description":"Turing machine simulator written in go, because why not?","archived":false,"fork":false,"pushed_at":"2024-06-05T21:52:48.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T13:36:17.152Z","etag":null,"topics":["golang","turing-machine","turing-machine-simulator"],"latest_commit_sha":null,"homepage":"","language":"Go","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/YeyoM.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-06-03T16:22:39.000Z","updated_at":"2024-07-06T23:08:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"1047f7f4-2487-4b9e-ade8-6dc6c339323b","html_url":"https://github.com/YeyoM/universal-turing-go","commit_stats":null,"previous_names":["yeyom/universal-turing-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/YeyoM/universal-turing-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeyoM%2Funiversal-turing-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeyoM%2Funiversal-turing-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeyoM%2Funiversal-turing-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeyoM%2Funiversal-turing-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YeyoM","download_url":"https://codeload.github.com/YeyoM/universal-turing-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeyoM%2Funiversal-turing-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265205686,"owners_count":23727511,"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":["golang","turing-machine","turing-machine-simulator"],"created_at":"2024-12-04T18:16:53.310Z","updated_at":"2025-07-13T21:07:12.072Z","avatar_url":"https://github.com/YeyoM.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Turing Machine\n\nThe Universal Turing Machine is a Go program that simulates a Turing machine based on a description provided in a file and an input string. The machine processes the input string according to the rules defined in the file, simulating the computation step by step.\n\n### Features\n\n- Customizable Machine Description: Specify the Turing machine description via a file.\n- Input String Handling: Pass the input string via a flag or prompt.\n- Verbose Mode: Display the tape and current state at each step.\n\n\n### Installation\n\n1. Clone the repository:\n\n```sh\nCopy code\ngit clone https://github.com/yourusername/universal-turing-machine.git\ncd universal-turing-machine\n```\n\n2. Build the project:\n\n```sh\ngo build -o turing\n```\n\n#### Usage\n\nThe program accepts several command-line flags to control its behavior:\n\n```sh\n./turing [options]\n```\n\n####Options\n\n- --help, -h: Display the help message.\n- --verbose, -v: Display the tape and the current state of the machine at each step.\n- --step, -s: Display the tape and the current state of the machine at each step, and wait for the user to press enter to continue.\n- --input, -i \u003cinput_string\u003e: Specify the input string for the machine. If not specified, the user will be prompted to enter the input string.\n- --file, -f \u003cfile_path\u003e: Specify the file containing the Turing machine description. If not specified, the user will be prompted to enter the file name.\n\n#### Example\n\n```sh\n./turing --file example.tm --input 0101 --verbose\n```\n\n#### Turing Machine Description File Syntax\n\nThe Turing machine description file should follow this syntax:\n\n- Each line contains a tuple in the form: \u003ccurrent state\u003e \u003ccurrent symbol\u003e \u003cnew symbol\u003e \u003cdirection\u003e \u003cnew state\u003e\n- \u003ccurrent state\u003e: The current state of the machine.\n- \u003ccurrent symbol\u003e: The symbol currently being read.\n- \u003cnew symbol\u003e: The symbol to write.\n- \u003cdirection\u003e: The direction to move the tape ('l' for left, 'r' for right, '*' for no move).\n- \u003cnew state\u003e: The next state of the machine.\n- Use _ to represent a blank (space) symbol.\n- Use ; to add comments.\n- States and symbols are case-sensitive.\n\n#### Special Symbols\n\n- * can be used as a wildcard in \u003ccurrent state\u003e or \u003ccurrent symbol\u003e to match any state or symbol.\n- * in \u003cnew state\u003e or \u003cnew symbol\u003e means no change.\n\n#### Example File\n\n```\n0 0 1 r 1\n1 1 0 l 0\n0 * * * halt\n; This is a comment\n```\n\n#### Implementation Details\n\nThe project consists of several key functions:\n\n- read_file(file_name string): Reads the file and returns a list of tuples.\n- check_line_syntax(line string): Checks if the syntax of a line is correct.\n- initialize_tape(input_string string): Initializes the tape with the input string.\n- run_machine(tape *Tape): Runs the Turing machine on the tape using the specified transitions.\n- display_tape(tape *Tape): Displays the current tape.\n- display_state(state string): Displays the current state of the machine.\n- main(): The main function that orchestrates the reading of inputs and running the machine.\n\n#### Contributing\n\nFeel free to open issues or submit pull requests if you find bugs or want to add features.\n\n#### License\n\nThis project is licensed under the GNU GENERAL PUBLIC License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeyom%2Funiversal-turing-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeyom%2Funiversal-turing-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeyom%2Funiversal-turing-go/lists"}