flag

From Esolang
Jump to navigation Jump to search

flag is an esolang created by User:None1. The interesting thing about this esolang is that tabs are disallowed (vertical tabs are considered tabs, too).

Syntax

flag's syntax is:

<flag><opcodes>

flag should be empty or contains only spaces.

Data storage

flag has its data stored in a bounded tape with 8 bit cells.

There is also a pointer, which points to the origin in the beginning.

All cells shound be 0 in the beginning

Execution

Opcode

Any character (except tab) is considered an opcode in flag. However, there are 2 types of opcode - Special opcode and Ordinary opcode.

Special opcodes

? Reads a character from standard input and overwrites the cell the pointer is pointing at with it. (The user should not enter tab, otherwise the program should raise an error and quit.)

! Prints the character the pointet is pointing at, if the character is a tab, raise an error and quit.

* Increment.

: Moves the pointer to the cell left of it.

; Moves the pointer to the cell right of it.

_ Makes the character after it an ordinary opcode even if it is a special opcode (tabs are still disallowed).

Ordinary opcodes

ordinary opcodes are legal characters that are npt.considered special opcodes, these characters are directly printed to standard output when executed.

Tab

Tab is considered an illegal character in flag, and flag programs which have tabs should not be allowed.

Flag

Flag consists of only spaces, each line of flag programs should have only one flag. Flag controls how many times the code is executed.

N is the length of flag

N   times
0   once
1   ∞ (infinity)
2   The code is executed repeatedly until the pointer points at 0. 
(just like Brainfuck's brackets)
>2  N-1 times

Example Programs

Hello World program:

Hello World_!

Cat program:

 ?!

Quine:

Quine

In fact, any program without linefeeds and tabs and special opcodes, and does not begin with a space can be a quine. That means flag has infinite number of quines.

External Resources

Webpages

The repository of flag, where the standard interpreter of flag is at.

Interpreters

The standard interpreter of flag written by the creator of this language (User:None1) in C++. as Windows executable.