65.9K
CodeProject is changing. Read more.
Home

Turing Machine (C++ Implementation)

starIconstarIconstarIconstarIconstarIcon

5.00/5 (4 votes)

Nov 12, 2002

CPOL
viewsIcon

86852

downloadIcon

1

The C++-program simulates a Turing Machine (TM). TM is defined by input files: metafile, states file, alphabet file, transition file, input word(s) file(s).

Introduction

The C++-program simulates a Turing Machine (TM).
TM is defined by input files: metafile, states file, alphabet file, transition file, input word(s) file(s):

  1. Each row of metafile contains data related to some Turing machine (number of tapes, names of states file, alphabet file, transition file, input word(s) file(s)).
  2. States file contains a list of initial, halting and internal states.
  3. Alphabet contains a list of empty, input and internal symbols.
  4. Each row of transition contains some transition rule.
  5. Each row of input word(s) contains input word for some tape.

A Turing Machine example (Recognition of Palindromes) from 'The Design and Analysis of Computer Algorithms [1976]' by A.V.Aho, J.E.Hopcroft, J.D.Ullman (See examples 1.8, 1.9) is used as a demo sample of Turing Machine.