{"id":13863048,"url":"https://github.com/dieggsy/turing-machine","last_synced_at":"2026-01-17T16:37:15.363Z","repository":{"id":110400682,"uuid":"89989517","full_name":"dieggsy/turing-machine","owner":"dieggsy","description":"Single tape turing machine simulator in emacs and python, inspired by http://morphett.info/turing/turing.html","archived":false,"fork":false,"pushed_at":"2018-02-22T04:45:00.000Z","size":66,"stargazers_count":16,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-05T06:06:37.597Z","etag":null,"topics":["emacs","emacs-lisp","python","turing-machine","turing-machine-simulator"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","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/dieggsy.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-05-02T03:54:15.000Z","updated_at":"2023-10-28T22:40:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"81409e5d-637c-4651-a04f-72995bbffe4b","html_url":"https://github.com/dieggsy/turing-machine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dieggsy%2Fturing-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dieggsy%2Fturing-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dieggsy%2Fturing-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dieggsy%2Fturing-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dieggsy","download_url":"https://codeload.github.com/dieggsy/turing-machine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225980898,"owners_count":17554919,"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":["emacs","emacs-lisp","python","turing-machine","turing-machine-simulator"],"created_at":"2024-08-05T06:02:00.632Z","updated_at":"2026-01-17T16:37:15.345Z","avatar_url":"https://github.com/dieggsy.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"* turing-machine\n[[https://melpa.org/#/turing-machine][file:https://melpa.org/packages/turing-machine-badge.svg]]\n[[https://stable.melpa.org/#/turing-machine][file:https://stable.melpa.org/packages/turing-machine-badge.svg]]\n[[https://www.gnu.org/licenses/gpl-3.0.txt][file:https://img.shields.io/badge/license-GPL_3-green.svg]]\n\nImplementation of a single tape turing machine simulator in emacs-lisp and\npython (separately).\n\nInspired by http://morphett.info/turing/turing.html\n\n** Usage\n*** Syntax\nThe syntax for turing code is described in the link above, but for redundancy:\n#+begin_quote\nSyntax:\n\n   - Each line should contain one tuple of the form ~\u003ccurrent state\u003e \u003ccurrent symbol\u003e \u003cnew symbol\u003e \u003cdirection\u003e \u003cnew state\u003e~.\n   - You can use any number or word for ~\u003ccurrent state\u003e~ and ~\u003cnew state\u003e~, eg. ~10~, ~a~, ~state1~. State labels are case-sensitive.\n   - You can use any character for ~\u003ccurrent symbol\u003e~ and ~\u003cnew symbol\u003e~, or ~_~ to represent blank (space). Symbols are case-sensitive.\n   - ~\u003cdirection\u003e~ should be ~l~, ~r~ or ~*~, denoting 'move left', 'move right' or 'do not move', respectively.\n   - Anything after a ~;~ is a comment and is ignored.\n   - The machine halts when it reaches any state starting with ~halt~, eg. ~halt~, ~halt-accept~.\n\nAlso:\n\n   - ~*~ can be used as a wildcard in ~\u003ccurrent symbol\u003e~ or ~\u003ccurrent state\u003e~ to match any character or state.\n   - ~*~ can be used in ~\u003cnew symbol\u003e~ or ~\u003cnew state\u003e~ to mean 'no change'.\n   - ~!~ can be used at the end of a line to set a breakpoint, eg ~1 a b r 2 !~. The machine will automatically pause after executing this line.\n   - You can specify the starting position for the head using ~*~ in the initial input.\n#+end_quote\nThe [[./examples]] directory should contain relevant examples. Source should be\nlisted near the top when not my own.\n*** Python\nWrite a file with the syntax above, and pass it to the script as indicated\nbelow. This is in Python 3. It should be pretty trivial to implement in\npython 2.\n#+begin_example\nUsage:\n  turing_machine.py FILENAME INITIAL\n  turing_machine.py FILENAME INITIAL [-r|--rate] [RATE]\n\nOptions:\n  -h --help\n  -r --rate  specify delay rate\n#+end_example\n*** Emacs\n- Write a file/buffer with the syntax described above, and run\n  ~turing-machine-execute~ to run the simulator.\n- Add ~-*- mode: turing-machine -*-~ to the top of the file to automatically\n  start in ~turing-machine-mode~ when you next open the file.\n- In ~turing-machine-mode~ you can press ~C-c C-c~ (~turing-machine-execute~) to start the machine.\n- Within the code file, you can use ~;; INITIAL: [Some initial state]~ to denote\n  the initial state and ~;; RATE: [some number]~ to denote the update rate\n  in seconds.\n  + If intial state is not set, you will be prompted for it through the\n    minibuffer. To be prompted anyway, call ~turing-machine-execute~ with a\n    prefix argument ~C-u~.\n  + If rate is not set, it will default to the fastest speed (this is still\n    pretty slow). With a double prefix argument ~C-u C-u~, you will be prompted\n    for rate through the minibuffer\n- Spaces are allowed in initial input, but surrounding spaces are trimmed. You\n  can be explicit with ~_~.\n- You can choose to hide visualization of spaces with an underscore by setting\n  ~turing-machine-visual-spaces~ to ~nil~.\n** Emacs Installation\nThis package is on Melpa. To install using [[https://github.com/jwiegley/use-package][use-package]]:\n#+begin_src emacs-lisp\n(use-package turing-machine\n  :ensure t)\n#+end_src\n\nUsing [[https://github.com/quelpa/quelpa-use-package][quelpa-use-package]]:\n#+begin_src emacs-lisp\n(use-package turing-machine\n  :quelpa (turing-machine\n           :fetcher github\n           :repo \"therockmandolinist/turing-machine\"))\n#+end_src\n\nOr [[https://github.com/quelpa/quelpa][quelpa]]:\n#+begin_src emacs-lisp\n(quelpa '(hacker-typer\n          :fetcher github\n          :repo \"therockmandolinist/turing-machine\"))\n#+end_src\n\nOtherwise, download the files to somewhere on your load path, and enable\nturing-machine:\n#+begin_src emacs-lisp\n(require 'turing-machine)\n#+end_src\n\n** Todo\n - Better syntax highlighting.\n - Get rid of cursor in ~*turing-machine*~ buffer.\n - File extension\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdieggsy%2Fturing-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdieggsy%2Fturing-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdieggsy%2Fturing-machine/lists"}