Trow

From Esolang
Jump to navigation Jump to search

Trow

Trow is an output-only esoteric language designed to generate randomized sentences using different kinds of sentence structures and lists. Multiple lists with different items (strings) can be defined. You can plug these lists in your sentences, which selects a random item from the list and generates a randomized output.

Examples

Simple Hello World Program

- Hello world!

Possible Outputs:

 Hello world!

Randomized Hello World Program

[words]
"world"
"programmers"
"guys"
"friends"
- Hello <words>!

Possible Outputs:

Hello world!
Hello programmers!
Hello guys!
Hello friends!

Multiple Lists

[days]
"saturday"
"sunday"
[seasons] "winter" "summer"
- Today is <days>, a beautiful <seasons> morning!

Possible Outputs:

Today is saturday, a beautiful summer morning!
Today is sunday, a beautiful winter morning!
Today is saturday, a beautiful winter morning!
Today is sunday, a beautiful summer morning!

Multiple Outputs

[food]
"pizza"
"burger"
- I love eating <food>s! - <food>s are bad for our health!

Example Output:

I love eating burgers!
pizzas are bad for our health!

Syntax

Comments

Comments are ignored when the program is ran. Comments can be defined using #. Similar to python.
Example:

# this piece of code will be ignored!

Lists

Lists can be defined using square brackets and their items can be only be strings enclosed in double quotes. These lists can be indexed in output statements.

Example:

[subjects]
"mathematics"
"physics"
"chemistry"
"art"

Print

To throw outputs in the console, we use a hyphen (-). Anything after the hyphen is printed in the console. Random items from specific lists can be included in these outputs using <listname>.

Example:

[emotions]
"happy"
"sad"
"angry"
- Hey, this statement will be printed in the console! This statement does not include random items from lists! - I am so <emotions>. # In the output, <emotions> is replaced with a random item from the list.

Interpreter

  • Common Lisp implementation of the Trow programming language.