Giter Club home page Giter Club logo

tmlanguage's Introduction

TMLanguage

You call the compiler by doing: ./Parsing SOURCEFILE OUTPUTDOT

A program written in TML is converted to a turing machine. It can manipulate the head and read/write from it.
By default a program rejects everything.

The first thing in a program has to be a list of all characters allowed on the tape.
Then there can be a set of statements.

The default blank symbol is: "BLANK"
Symbols may be of any length and can be the full unicode range.
They should not be empty strings as those can not be written.

The following keywords are available:

IF, WHILE, END, WRITE, MOVERIGHT, MOVELEFT, ACCEPT, REJECT

These are used as control structure, output, the movement of the head and to indicate if we accept or not.

List

A list is a series of symbols.
Example: ["a","b","c"]

IF and WHILE

These keywords take a list behind them. You should include at least one space behind the keywords.
Example: IF ["a","b"]

Then you should follow by a block of statements and at the end you place the keyword END

Example:

    ["a"]
    WHILE ["a"]
        MOVELEFT
    END

This program will move the head left as long as the symbol under the head is an 'a'.

WRITE

Write is used to put a symbol on the tape under the head.
It should also be followed by a list.
Example: WRITE ["a"]

You can not write the empty string, as that means write nothing.

MOVELEFT/MOVERIGHT

These move the head one space to the left or the right.

ACCEPT/REJECT

Accept and reject can be used to put the program into either of the states.

    ["a", "b"]

    IF ["a"]
        ACCEPT
    END

The above program accepts strings that start with 'a' and rejects strings that start with 'b'.

Functions

You can define a function by using NAME
Followed by a block and then the keyword END

Example:

    *RemoveUntillNotC*
        WHILE ["c"]
        	WRITE ["BLANK"]
        	MOVERIGHT
        END
    END

You can call a function by using NAME

Example: RemoveUntillNotC

Functions should not be called within functions.

tmlanguage's People

Contributors

paimei2 avatar jbijtebier avatar inventrax avatar

Watchers

James Cloos avatar Avery Smets avatar  avatar  avatar  avatar

Forkers

inventrax

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.