Spam

From Esolang
Jump to navigation Jump to search

Spam is an esolang invented by User:None1. Its programs are to imitate a kind of spam in text massages that wastes time for people who see it by letting you eyes move between lines and ending up saying that you are fooled.

Syntax

Every program consists of lines like this:

<first clause>, <second clause>.

The space after the , is mandatory and programs are case sensitive.

There are two cases, one case is that the first clause is I just want to say and the second clause is you are fooled, in this case, the program terminates when reaching the line. Otherwise the first clause is a command and the second clause is a jump.

Unlike normal languages, a 'jumpin a line in a Spam program tells you which line to execute next, a jump is like this:

please read line value

value can be an integer or a variable. The line (value-1)%n+1 (n is the total number of lines) is jumped in case that the value is less than 1 or more than n.

There are these commands, variables store unbounded signed integers, when attempting to read a non-existent variable, a variable with value 0 is created (uppercase letters stand for variables and i1, i2, i3... stands for integers, v1, v2, v3... stands for integers or variables):

Command - Meaning
I want to tell you a secret - Where to start the program, there must be exactly one of this command in a program (but it doesn't need to be in the first line)
Add A by v1 - Explains itself
Subtract A by v1 - Explains itself
Multiply A by v1 - Explains itself
Set A to v1 - Explains itself
Say v1 - Print v1 as integer
Speak v1 - Print v1%65536 as Unicode character
Hear A - Input A as integer
Listen A - Input A as Unicode character
Mess up A - Make A a random integer from 0~A-1 if A is positive, and 1-A~0 if negative, and 0 if zero
Print "string" - Prints string

EOF returns 0.

Examples

Hello, World!

I want to tell you a secret, please read line 2.
Print "Hello, World!", please read line 3.
I just want to say, you are fooled.

Cat Program

I want to tell you a secret, please read line 2.
Listen a, please read line 3.
Speak a, please read line 2.

A+B Problem

Hear a, please read line 4.
I want to tell you a secret, please read line 1.
I just want to say, you are fooled.
Hear b, please read line 6.
Say a, please read line 3.
Add a by b, please read line 5.

Truth Machine

I want to tell you a secret, please read line 2.
Hear a, please read line 3.
Add a by 4, please read line 5.
I just want to say, you are fooled.
Say a, please read line a.