{"id":21734988,"url":"https://github.com/janinawibker/tm_vm","last_synced_at":"2026-05-08T08:31:34.392Z","repository":{"id":91737447,"uuid":"253569814","full_name":"JaninaWibker/tm_vm","owner":"JaninaWibker","description":"A virtual machine for turing machines which can output the current state as tex, svg, gif and even react components","archived":false,"fork":false,"pushed_at":"2025-03-14T17:20:16.000Z","size":1315,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-14T18:37:32.639Z","etag":null,"topics":["ruby","svg","tex","turing-machine","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/JaninaWibker.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}},"created_at":"2020-04-06T17:31:45.000Z","updated_at":"2025-03-14T17:20:20.000Z","dependencies_parsed_at":"2024-03-23T14:47:00.525Z","dependency_job_id":null,"html_url":"https://github.com/JaninaWibker/tm_vm","commit_stats":null,"previous_names":["janinawibker/tm_vm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JaninaWibker/tm_vm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaninaWibker%2Ftm_vm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaninaWibker%2Ftm_vm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaninaWibker%2Ftm_vm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaninaWibker%2Ftm_vm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaninaWibker","download_url":"https://codeload.github.com/JaninaWibker/tm_vm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaninaWibker%2Ftm_vm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32772869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ruby","svg","tex","turing-machine","virtual-machine"],"created_at":"2024-11-26T05:11:29.454Z","updated_at":"2026-05-08T08:31:34.374Z","avatar_url":"https://github.com/JaninaWibker.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Turing Machine Virtual Machine\n\n\u003cimg src=\"./output/input.tm.gif\" alt=\"tm visualization gif\" height=\"300\" /\u003e\n\n\u003e **WIP**: some features listed here are not yet implemented such as react and proper pdf output for example.\n\nThe idea is to make it easy to run **small** turing machines and visualize their state using tex.\n\nYou supply the data required to describe a *TM* (turing machine) and it will be turned into a tex document. This document will require some amount of clean-up in regards to positioning of nodes (states) and edges, but this file (after clean-up) will then be used as an input (along side the description of the TM) and will be used to generate pretty output for each state transition. This output can be a tex document, an svg, a png, a pdf for each state transition. There are also GIF\nand react component outputs which aren't produced per state change.\n\n## Usage\n\n```\nusage: ruby src/main.rb \u003coptional flags\u003e \u003cinput file\u003e\n\nflags:\n  -o, --output     Specify the output format (tex, svg, png, gif, pdf, react, custom, default: svg)\n  -t, --template   Specify the file that should be used as a template for the output\n  -e, --expand     Expand aliases\n  -E, --no-expand  Don't expand aliases\n  -d, --duration   Duration between state transitions (ms)\n  -v, --version    Print version\n```\n\nCheck out the `input.tm` file for an example of how the turing machine needs to be specified\n\n## Example\n\nRun the example turing machine as follows:\n\n```bash\nruby src/main.rb input.tm # generate the template from input.tm\n$EDITOR input.tm.tex      # adjust the positioning of the states \u0026 edges\nruby src/main.rb --template input.tm.tex input.tm # generate the output from the template and input.tm\n# output will be placed inside the `./output` directory\n```\n\nMost output formats have other output formats as a dependency:\n\n- **svg** depends on **tex**\n- **png** depends on **svg** (and thereby also tex)\n- **gif** depends on **png** (and thereby also tex, svg)\n- **pdf** depends on **tex**\n- **react** depends on **tex**\n\nOutputting to gif results in the outputs for tex, svg, png and gif to be generated and similar for all other output formats.\n\n\u003e Outputting to png (and thereby also gif) is a bit slow duo to inkscape having to be launched individually each time.\n\n\u003e the option 'custom' at the moment just prints out the state of the turing machine when each step is executed, it does not generate any output. This state is formatted as a ruby hash. In the future it will be more customizable and flexible and allow things such as executing external programs each step. This option is currently mostly used for debugging output when generating a ton of files is a little too slow.\n\n## Features\n\nthere are many macros that can be used inside of the tex template file:\n\n- `\\TMVMCURRSTATE`: the current state\n- `\\TMVMCURRSYMBOL`: the current symbol to be processed\n- `\\TMVMCOMPLETEINPUT`: the complete input (initial state of tape)\n- `\\TMVMCOMPLETETAPE`: the current state of the tape\n- `\\TMVMSTEP`: the step that is currently being executed\n\nAlongside those macros it is also possible to modify how the highlighting of the active state / transition looks\n\nFor that simply modify the `n_highlight` and `e_highlight` styles:\n\n```latex\n\\tikzstyle{n_highlight}=[draw=blue,text=blue]\n\\tikzstyle{e_highlight}=[draw=blue,text=blue]\n```\n\n## Requirements\n\n- ruby\n- a latex* distribution (when outputting to anything other than tex)\n- dvisvgm* (when outputting to anything other than tex)\n- inkscape* (when outputting to png)\n- imagemagick (when outputting to gif)\n\n\u003e *latex*: [BasicTex](https://tug.org/mactex/morepackages.html) is a pretty light weight latex distribution for macOS\n\u003e\n\u003e *dvisvgm*: Can be difficult to install on macOS, [this](https://gist.github.com/tobywf/aeeeee63053aaaa841b4032963406684) script can help with that (some modifications need to be made for it to work properly)\n\u003e\n\u003e *inkscape*: [inkscape 0.9x for macOS is a 32 bit app and, starting with Catalina, no longer supported by macOS](https://inkscape.org/news/2019/11/10/macos-1015-catalina-support/). There is a development release of Inkscape 1.0 available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaninawibker%2Ftm_vm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaninawibker%2Ftm_vm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaninawibker%2Ftm_vm/lists"}