turing complete

Table of Contents

Any (imaginary) machine is turing complete if it can be used to simulate a turing machine, namely, implements the 4 primitives of turing machine.

1. Example: C is turing complete

to simulate turing machine with C:

const N = 20;
// tape and head
char *tape;
int head = 0;
tape = (char*)malloc(sizeof(char) * N);

// moving head
head--; // move head left 1 step
head++; // move head right 1 step
// read and write
char read = tape[head]; // read from where head points to
tape[head] = read; // write to where head points to

Author: Linfeng He

Created: 2024-04-03 Wed 20:21