We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Plaintext

From Esolang
Jump to navigation Jump to search

plaintext is an esolang inspired by languages such as FORTRAN and COBOL heavily, so much so as to solely use regular English words. It was created by ASCIIguy out of annoyance for the difficulties of such languages, leading them to parody them.

Syntax

plaintext paragraphs begin with PARAGRAPH [LABEL]; they have sentences, which are instructions. Within these instructions are words, such as GO or WHEN or VAR. At the end of a line is a comma; there are two exceptions. If the line is an IF or WHEN statement or some other statement that could require indentation shortly after, a colon is used, and if the statement is at the end of a paragraph, the end of the line is a full stop. To define variables at the start, use a data paragraph. A program in plaintext is known as a book, and other books can be imported for their paragraphs at the start by defining a library: this goes:

LIBRARY:
  INCLUDE MATHS.TXT,
  INCLUDE STDIO.TXT.

Features

plaintext supports user input, loops, conditionals, functions, imports, and more. Comments are included in plaintext, beginning with ' or going over the 80th column; this latter method is not preferred due to 80 column displays, and also because the creator is biased towards Usenet netiquette. An example would be WHEN X IS ABOVE Y: ' CHECKS IF X > Y. To put input into a variable, use PUSH INPUT TO X. However, there is a stack, which you can push and pop from.

Examples

Fizzbuzz:

DEFINE BOOK FIZZBUZZ.

PARAGRAPH DATA:
  DEFINE FIZZ AS 0.

PARAGRAPH FIZZBUZZ:
  WHEN FIZZ IS BELOW 100:
    IF FIZZ MODULO 3 IS 0 THEN:
      DISPLAY "FIZZ".
    IF FIZZ MODULO 5 IS 0 THEN:
      DISPLAY "BUZZ".
    IF FIZZ MODULO 5 AND 3 IS NOT 0 THEN:
      DISPLAY FIZZ.
    ADD 1 TO FIZZ.
  HALT FIZZBUZZ.

PARAGRAPH ENTRY:
  CALL PARAGRAPH FIZZBUZZ,
  HALT ENTRY.

Cat:

DEFINE BOOK CAT.

PARAGRAPH CAT:
  PUSH INPUT INTO X,
  DISPLAY X,
  HALT CAT.

PARAGRAPH ENTRY:
  CALL PARAGRAPH CAT,
  HALT ENTRY.

Infinite Loop:

DEFINE BOOK LOOP.

PARAGRAPH LOOP:
  CALL PARAGRAPH LOOP.

PARAGRAPH ENTRY:
  CALL PARAGRAPH LOOP,
  HALT ENTRY.

Fun Video Game:

DEFINE BOOK GAME.

PARAGRAPH DATA:
  DEFINE X AS 0.

PARAGRAPH GAME:
  PUSH INPUT TO Y,
  WHEN Y IS X THEN:
    ADD 1 TO X,
    PUSH INPUT TO Y.
  HALT GAME.

PARAGRAPH ENTRY:
  CALL PARAGRAPH GAME,
  HALT ENTRY.

Deadfish Interpreter:

 DEFINE BOOK DEADFISH.

PARAGRAPH DEADFISH:
  ASSIGN Y TO 0,
  WHEN X IS NOT 0:
    PUSH INPUT TO X,
    IF X IS "i" THEN:
      ADD 1 TO Y.
    IF X IS "d" THEN:
      SUBTRACT 1 TO Y.
    IF X IS "s" THEN:
      MULTIPLY Y TO Y.
    IF X IS "o" THEN:
      DISPLAY Y.
    ELSE:
      DISPLAY "NOT A VALID COMMAND!".
  HALT DEADFISH.

PARAGRAPH ENTRY:
  CALL PARAGRAPH DEADFISH,
  HALT ENTRY.