Automaton simulator usage instructions

This is a help file for the automaton simulator here. It can be used to create and test deterministic and nondeterministic finite automata, regular expressions, context-free grammars, and (deterministic) Turing machines.

This application is mainly tested with the Chrome web browser, and it may have problems with other web browsers.

Please send questions/bug reports to This application was written in Elm.

How to use

Play around! Most features are self-explanatory. Below are some notes about aspects that may require more detailed explanation.

Entering input

If the option "Run immediately" is selected, then all changes to input and automaton descriptions are immediately processed. If you uncheck this box, then a "Run" button will appear, which must be pressed to see if the automaton description is valid, and if so, what is the result of running the automaton on the input. This may be useful if the simulator is taking a long time to process each change, for instance if the Turing machine has an infinite loop.

To load a text file from your computer into the editor window, click the "Choose file" button next to "Upload:". To save the contents of the editor to a file on your computer, click the "Download" button. Pressing the "Load Default" button will replace the editor with a description of the default automaton for that type.

The contents of the editor are automatically saved locally in your browser's local storage, so when you first open the page, the editor should display the same thing you saw last time the page was open. However, this is merely for convenience and should not be relied upon: it is strongly recommended to save the file manually when you are done working. If the app is updated, for instance, a bug or a change in storage format may erase your stored data.

Clearing local storage if app does not load

There may be rare circumstances where the app does not load due to a bug in how it loads the automaton from your browser's local storage. To clear local storage (which should reset the app), follow these steps.

  1. Open the simulator web page.
  2. Open Developer Tools by pressing Ctrl+Shift+I in Chrome or Firefox.
  3. (Alternately, in Chrome click on the top right menu → More tools → Developer tools, and in Firefox click on the top right menu → Web Developer → Web Developer Tools.)
  4. Once Developer Tools are open, select "Application" in Chrome or "Storage" in Firefox.
  5. Click "Local Storage" on the left.
  6. Right-click https://web.cs.ucdavis.edu/ and select "Clear".
  7. Refresh the page.

Example input files

The easiest way to explain the input file format is by example. The files no-000-end.dfa, contains-010.regex, 0-three-from-end.nfa, 0s1s2s.nfa, balanced-parens.cfg, double.tm, and palindrome-single-tape.tm are examples of input files for the finite automata, regular expression, context-free grammar, and Turing machine simulators.

Turing machine simulation time limit

Turing machines are run for at most 10,000 steps.

Turing machine left move on leftmost tape cell

If a Turing machine attempts to move a tape head left when it is already on the leftmost tape cell, then the tape head stays where it is instead.

Step-by-step simulation

The finite automata and Turing machine simulators have a back and forward button to step through individual transitions of the machine. In both cases the current state is highlighted. In the case of Turing machines, the tape(s) are shown with the tape head position(s) highlighted.

In the case of finite automata, the input is shown with a caret symbol placed in between the symbol just read and the symbol about to be read. For example, in reading the string , the finite automaton will have four transitions and visit five states total, with the "read position" being indicated in each case as:

If the input field and editor are not selected, then the and (comma and period) keys can also be used to do forward and backward transitions. This can be useful to quickly jump several transitions ahead by holding down the key.

Output conventions for Turing machines

Turing machines have two different notions of "output".

  1. Boolean output, which is indicated by whether the final configuration is in the accept state or the reject state.
  2. string output, used to define Turing machines that compute functions f: Σ* → Σ*.

    The string output in the final configuration is represented on the last tape. The output is defined to be the string from the tape head to the first blank to the right (represented by an underscore ), not including the blank. This means that although the input is from the input alphabet, the output could have nonblank symbols from the tape alphabet.

    For instance, suppose the content of the last tape is and the tape head at the leftmost . Then the output string is . If the content of the last tape is and the tape head is at position 0 (in other words, if the tape head is scanning a blank symbol), then the output string is the empty string ε.

Notes about file format