Coder Social home page Coder Social logo

turingmachinesimulator's Introduction

The project contains simulator, simple high level language and compiler for Turing machine. A simple UI is presented.

The syntax of the language:

<program> := <symbol list> <main-statement>

<main-statement> := <statement>

<statement> := <block-statement> | <if-statement> | <if_else-statement> | <while-statement> | <do_while-statement>| <repeat_until-statement> | <write-statement> | <left-statement> | <right-statement> | <exit-statement> | <error-statement> | <continue-statement> | <break-statement> | <switch-statement>

<block-statement> := '{' <statement>+ '}'

<if-statement> := 'if' <symbol list> <statement>

<if_else-statement> := 'if' <symbol list> <statement> 'else' <statement>

<while-statement> := 'while' <symbol list> <statement>

<do_whlie-statement> := 'do' <statement> 'while' <symbol list> ';'

<repeat_until-statement> := 'repeat' <statement> 'until' <symbol list> ';'

<write-statement> := 'write' <symbol> ';'

<left-statement> := 'left' ';'

<right-statement> := 'right' ';'

<exit-statement> := 'exit' ';'

<error-statement> := 'error' ';'

<continue-statement> := 'cointinue' ';'

<break-statement> := 'break' ';'

<switch-statement> := 'switch' '()' <case-statements>

<case-statements> := <case-statement>+

<case-statement> := 'case' '(' <symbol> ')' <statement>

<symbol list> := <not> '(' <symbol> ( <comma> <symbol> )* ')' | '(' <symbol> ( <comma> <symbol> )* ')'

<symbol> = ASCII printable character

<not> := 'not'

<comma> := ','

Description of statements.

  • if statement
    The statements of if statement are executed only if the symbol in the current cell of the tape is available in symbol list.

  • if-else statement
    The if branch statements of if-else statement are executed when the symbol in the current cell of the tape is available in symbol list, otherwhies the else branch statements are exequted.

  • while statement
    The statements of while statement are executed while the symbol in the current cell of the tape is available in symbol list.

  • do_while statement
    The statements of do_while statement are executed while the symbol in the current cell of the tape is available in symbol list. In contrast of while statement, the statements are eqequted at least once.

  • repeat_until statement
    The statements of repeat_until statement are executed until the symbol in the current cell of the tape is available in symbol list.

  • switch statement
    Similar of common languages (C, C++, etc.) switch-case statement.

  • write statement
    Writes the symbol in the currect cell of the tape.

  • left statement
    Turns the head of the machine left.

  • right statement
    Turns the head of the machine left.

  • exit statement
    Halts the machine.

  • error statement
    Gives error command to the machine to halt unsuccessfully.

  • continue/break statements
    These statements are used as flow controls in while, do_while and repeat_until loops.
    If these statements aren't contained in any of loops given above, the parser trows an exception.

turingmachinesimulator's People

Contributors

kamosevoyan avatar

Watchers

 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.