Poetic (esolang)

From Esolang
Jump to navigation Jump to search

Poetic is an esoteric programming language created by User:JWinslow23 in 2018. It is a derivative of brainfuck that encodes instructions into the lengths of words. Programs generally look like abstract poetry, and upon execution, they are turned into a list of numbers denoting the lengths of the words, and then executed as instructions.

Overview

The sole form of data storage in Poetic is the unsigned byte (i.e. an integer in the range 0-255). Poetic has a "tape" of 30,000 of these unsigned bytes, and a memory pointer to keep track of which value is currently being accessed.

Source code for Poetic is entered in the form of words, in any natural language. Words are considered to consist of any number of alphabetic characters and apostrophes, and any character that is not either of these is ignored and treated as a delimiter. Apostrophes do not delimit words or add to the letter count. Each word is then converted to numbers as follows:

  • If a word is less than 10 letters long, it is converted to that single digit.
  • If a word is exactly 10 letters long, it is converted to the digit 0.
  • If a word is more than 10 letters long, it is converted to a series of digits, representing the number as written in decimal notation (for example, a 12-letter word becomes 12).

Each digit then turns into an instruction, and then the program is executed. The list of instructions is as follows:

Value Brainfuck Equivalent Description
1 [ If the current byte is equal to 0, jump execution to after the matching 2.
2 ] If the current byte is not equal to 0, jump execution to the matching 1.
3 + Increment the value of the current byte by next_digit. If next_digit is 0, the value used instead is 10.
4 - Decrement the value of the current byte by next_digit. If next_digit is 0, the value used instead is 10.
5 > Increment the memory pointer by next_digit. If next_digit is 0, the value used instead is 10.
6 < Decrement the memory pointer by next_digit. If next_digit is 0, the value used instead is 10.
7 . Output the value of the current byte as an ASCII character.
8 , Read a character from the input stream, and write its ASCII value to the current byte. (Note: This fails to update the current byte upon end of input.)
9 N/A Set the current byte to a random value from 0 to 255.
0 N/A End program execution here. This does not end program execution if it is used as an argument for 3, 4, 5, or 6.

Both the values of bytes and the memory pointer wrap around on overflow and underflow.

Examples

Hello, World!

the proverbial "unconsciousness"

i was already aware
i had understood fully

i saw the devil
i was perfectly still
involuntarily i paused

there said i:
my sheer consciousness
of certain given circumstances
i noticed
it's nothing
     nothing
     nothing any man wouldn't learn

a way of finding these
i know not

nothing common or typical
and yet (somehow)
very little thought
will normally resolve every contradiction

a foolish heart -> an eternal misfortune

Cat program

This program is in the form of a haiku. Such poetic structure is encouraged, though not enforced.

stranger, i confess
i have longstanding problems
i'm unprepared for

Reverse input

whenever i drink a beverage
i'm always intoxicated

.egnarts yllaeR

i am inebriated

ASCII loop

This program prints every ASCII character in an infinite loop.

love is a great mystery
but i couldn't really explain it

Random number

This sets the first cell of the tape to a random number (accomplished with the first word, LIGHTNING), and then outputs it in decimal. Because this feature is not built into the language, it must be done using combinations of other instructions, making this the length of a small piece of prose.

[ LIGHTNING ]

*a flash!*
*a zap!*
*a flash!*
*a zap!*

a...Fourth of July?

I am still electrified.
Inside, I see a burst of flames...
...a fire...

I am the source.

LEAVE IMMEDIATELY
BEHOLD, A HUGE METEOR CRASH
IMMEDIATELY LEAVE

I was frightened
almost traumatized

Have I heard hallucinations?
Unspeakable evils?

I say...
	I think no.

No, their progression and advancement isn't a threat.

I say...
	I think I am worse.
I say...
	I think I'm no longer light.
	I'm shade.
	Inescapable dark.

I am now sinister.

I think I see little,
except a dark, impenetrable cloud...

No...no...never...
...I am purely-intentioned...

I still try...
...try fighting longer....

Too late.
I am truly with my people.
Mischievous, devious...
...a dark disappearing animal.

Gloomy night now is EVERYWHERE.

XKCD Random Number

By User:XKCD Random Number:

Pre crecas condominolovium seclosoponiat exelglios egumbo
 e arbi-brimidozoque fiene a parp-en inbidee nonquaeson!

(it doesn't make any sense at all)

It is detected to be written in a wierd language, and means:

Before the growth of condominium, the shadows of the woods hide.
The fruit of the tree will never be inhabited!

By User:None1:

XKCD Challenge

I was a mouse.
A bad rodent indeed.
I am cats' supper.
Never seeing bright light.

Don't be a Befunge programmer.
Or you'll be like me.

By PSTF if the next_value is always 1:

Ute msi dle wis ake spi rep sil y
Dekut siu sia jel me,
Remfi lat cal miz wer the Uni
metis keo chi cho cha lis pri Von Te.
Miria ssi elt ale siv sia pir don dun fyo je,
Faste vei daa dee bis lai ris api lei vun sti sil Ti.
Feotum riazil shamat kalsis viosur bila y?
Solze jund?
Los kat pri zia Vashil!

Implementation

External links

See also

  • PoeticFuck, a brainfuck-like way to represent Poetic.