From Esolang
Jump to navigation Jump to search

™ or TM is an esolang that can do a Truth Machine (except type 4, which is basically a joke), created by User:None1.

Syntax

Type 1

There is only one valid program: , which is a Truth Machine.

Other programs raise a syntax error:

Syntax error

Type 2

There are only three valid programs:

  1. , which is a Truth Machine.
  2. ©, which is a cat program.
  3. ®, which is a reverse cat program.

Other programs raise a syntax error:

Syntax error

Type 3

There is only one valid program: an empty program, which is a Truth Machine.

Other programs raise a syntax error:

Syntax error

Type 4

Every program raises a syntax error:

Syntax error

It is obvious that type 4 is a Nope. derivative.

Type 5

Every program is a Truth Machine.

Type 6

Every program that isn't empty is a Truth Machine.

An empty program raises a syntax error:

Syntax error

Example Programs

Type 1

Truth Machine

Quine

Syntax error

Type 2

Cat Program

©

Reverse Cat Program

®

Truth Machine

Quine

Syntax error

Type 3

Truth Machine


The Truth Machine for type 3 is shorter than Truth Machine in any other language.

Quine

Syntax error

Type 4

Quine

Syntax error

Self interpreter

No matter what this is.

Self interpreter 2

Syntax error

Type 5

Truth Machine


Alternative
Hello World!

Type 6

Truth Machine

Truth Machine

Interpreters

The following interpreters are in Python.

Type 1

import sys
code=sys.stdin.read()
if code=='™':
    x=input()
    if x=='0':
        print(0)
    else:
        while 1:
            print(1)
else:
    print('Syntax error')

Type 2

import sys
code=sys.stdin.read()
if code=='™':
    x=input()
    if x=='0':
        print(0)
    else:
        while 1:
            print(1)
else if code=='©':
    print(sys.stdin.read())
else if code=='®':
    a=input()
    l=list(a)
    l.reverse()
    print(''.join(l))
else:
    print('Syntax error')

Type 3

import sys
code=sys.stdin.read()
if code=='':
    x=input()
    if x=='0':
        print(0)
    else:
        while 1:
            print(1)
else:
    print('Syntax error')

Type 4

print('Syntax error')

Type 5

import sys
code=sys.stdin.read()
if True:
    x=input()
    if x=='0':
        print(0)
    else:
        while 1:
            print(1)
else:
    print('Syntax error') # Just kidding!

Type 6

import sys
code=sys.stdin.read()
if code:
    x=input()
    if x=='0':
        print(0)
    else:
        while 1:
            print(1)
else:
    print('Syntax error')