Telegram

From Esolang
Jump to navigation Jump to search

Telegram is a language created by User:PuzzleHunter84 that says what it wants to be done (almost like a real programming language).

The Language

Telegram uses capital letters to denote instructions and only uses variables for memory (separate ones for numerals and strings). Its variable names use only letters and are either all lowercase or all uppercase depending on whether their value is a numeral or a string. Numerals are written out in all uppercase letters like: ONE HUNDRED.

START, END, and STOP

START is used to start the program, so writing comments is easy because anything before the START instruction is ignored. END stops the program execution immediately. STOP ends lines.

GO TO (IF) and SKIP (IF)

GO TO n, where n is a positive integer or a numeral variable set to a positive integer less than or equal to the number of lines in the program, immediately begins executing at the first instruction on line n. Lines may have any number of instructions, and the first instruction is on line 1. GO TO n IF x y z performs the GO TO n if the condition x y z is true where x and z are integers or numeral variables and y is any of the following: EQUALS, IS GREATER THAN, IS LESS THAN, DOES NOT EQUAL, IS NO GREATER THAN, IS NO LESS THAN. SKIP is used to skip over the next non-STOP instruction, even if that instruction is on a separate line. SKIP IF x y z performs the SKIP if the condition x y z is true where x and z are integers or numeral variables and y is any of the following: EQUALS, IS GREATER THAN, IS LESS THAN, DOES NOT EQUAL, IS NO GREATER THAN, IS NO LESS THAN.

SET TO and SET TO STRING

SET x TO y is used to set numeral variable x to numeral or the value of numeral variable y. Numeral variables must be entirely lowercase and numerals must be written out in uppercase letters. SET X TO STRING Y is used to set string variable X to string Y or the value of string variable Y. String variables must be entirely uppercase, but the strings they hold may be any non-numeral value.

INPUT and INPUT STRING

INPUT x inputs a numeral and sets numeral variable x to that value. INPUT STRING X inputs a string and set string variable X to that value.

PRINT and PRINT STRING

PRINT x prints the value of numeral variable x to output. PRINT STRING X prints the value of string variable X to output.

CALCULATE AND SET TO IT and CONCATENATE STRINGS AND SET TO IT

CALCULATE w x y AND SET z TO IT is used to do math functions with w and y via x and set numeral variable z to the solution, where w and y are integers or numeral variables set to integers, z is a numeral variable, and x is any of the following: PLUS, MINUS, TIMES, DIVIDED BY, MODULO, TO THE POWER OF. CONCATENATE STRINGS X Y AND SET Z TO IT concatenates strings X and Y or string variables X and Y, and sets string variable Z to the result.

TRANSPOSE TO

TRANSPOSE x TO X is used to set string variable X to the ASCII character denoted by the numeral value that numeral variable x is set to. TRANSPOSE X TO x is used to set numeral variable x to the value denoted by the initial ASCII character of the string that string variable X is set to.

Programs

Hello, world!

START SET X TO STRING Hello, world! PRINT STRING X STOP END

Computational Class

It can implement a Collatz function. using equivalence to 3-cell no I/O Brainfuck.

First, there should be 3 vars defined.(For example:X, Y, Z)

[...]Depends on the place of code...anyway, it can be inplemented with 2 GO TO (IF) statements.

+CALCULATE X PLUS ONE AND SET X TO IT

-CALCULATE X MINUS ONE AND SET X TO IT

< and >Does not directly produce code...just switch the current var controlled.

And, this shows that Telegram is Turing-complete.

(Above, X can be any of the 3 predefined variables)