Git Product home page Git Product logo

turing's Introduction

C Turing Machine

A program that simulates a single tape Turing machine.

Build

Make sure to have the Meson build system installed on your system, if not, follow the instructions from https://mesonbuild.com/Quick-guide.html

Once Meson is installed, run the following commands on the root directory of this project:

setup meson build 
cd build
meson compile 

Run

This program accepts two arguments as input as follows:

./turing <Input String> <Instruction File> 

Input String

An string that the machine would use as its tape. If the Input String is rejected by the machine, it would output "Reject".

Instruction File

This file should contain the instructions that the Turing machine will follow. Each instruction should follow this syntax:

<Input State> <Accept String>|<Overwrite Char>,<Instruction> <Output State>

Input State

Executes the instruction if the current state of the machine is the same as this string.

Accept String

Checks if the content of the current cell of the tape is inside this string, if not then it would look to another instructions that contains the same Input State.

Overwrite Char

Character that will be used when overwriting the current tape cell. If the Overwrite Char is '/' then the machine would not perform overwriting.

Instruction

The instruction that the machine will perform: R(Right) L(Left) S(Halt the machine)

Output State

Indicates the state in which the machine will be after executing the instruction

Examples

A machine that multiplies a number by 10:

q0 123456789|/,R q1 
q0 0|/,S qS
q1 0123456789|/,R q1
q1 _|0,S qS 

A machine that multiplies a number by 100 and then adds 10:

q0 123456789|/,R q1
q1 0123456789|/,R q1 
q1 _|1,R q2
q2 _|0,S qS

turing's People

Contributors

jmmalqui avatar sillygabe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.