A fast turing machine simulator with graphviz export functionality

git clone


2021-08-30 scanner: Replace signed char with int Sören Tempel
2021-08-30 turing: change dirstr return value to int Sören Tempel
2021-07-30 Fix regex in invalid state error message output Sören Tempel
2021-07-20 turing: add assert to writetape Sören Tempel
2021-07-20 parser: remove unnecessary variable assignments Sören Tempel

Clone the repository to access all 159 commits.


A fast turing machine simulator with graphviz export functionality.


The following software is required to build tmsim:


If you installed all dependencies build tmsim the following way:

$ make

To test if tmsim works as expected you can run the test suite using:

$ make test


The following EBNF describes valid tmsim input:

turingmachine = metadata, states;
metadata = "start:", statename, ";",
    "accept:", statenames, ";";

statename = "q", digit, { digit };
statenames = statename, { ",", statename };

states = { state };
state = statename, "{", [ transitions ], "}";

transitions = transition, ";", { transition, ";" };
transition = symbol, direction, symbol, "=>", statename;

symbol = digit | letter | "$";
direction = ">" | "|" | "<";

Besides a comment can be added anywhere in the tmsim input file. Comments begin with the ASCII character ‘#’ and end with a newline.


The entire code base is documented with comments that can be parsed by Doxygen. A Doxyfile is not provided but if you are into that sort of thing you can use Doxygen to generate some source code documentation.


This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see