Daniel Temkin

Olympus

A sample line of code:

Lord Zeus, master of storms, father of the gods, defender of cities, defender of homes, defender of the travelers and of those far from home, I beg you to create a function called printBeerInsideLoop for parameter n that prints n, beerString, " on the wall", n, beerString, ".\nTake one down, pass it around, ".

How it's interpreted:

Lord Zeus, ← god

master of storms, father of the gods, defender of cities, defender of homes, defender of the travelers and of those far from home, ← epithets

I beg you to ← supplication

create a function called ← declare function

printBeerInsideLoop ← function name

for parameter n ← params

that prints n, beerString, " on the wall", n, beerString, ".\nTake one down, pass it around, ". ← initial contents

The grammar is defined as a PEG (using Peggy.JS), perfect for this kind of wordy language:
Zeus = ("Lord" _)? "Zeus," _ f:( "who rules Olympus" "," _ / "defender of cities" "," _ / defender of homes" "," _ / "defender of the travelers and of those far from home" "," _ / "master of storms" "," _ / "father of the gods" "," _ / "of the lightning strike" "," _ / "of the sturdy oak" "," _ / "cloud-gathering" "," _ )+
{
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 4, "Zeus");

return {
god: "Zeus",
praise_factor: 3,
epithets: f,
score: score
};
} // Anything structural
The complete 99 Bottles program:

Come, happy, deathless Gods! Hearken to my prayer!

Great and good Athena, purger of evils, who hears all words spoken in market and assembly, please make a function called printBot for parameter n that prints n, beerStr, and " on the wall!\n".

Ariadne, pure one, ancient one, mistress of the labyrinth, wise and cunning one whose agile mind finds purchase on the frailest of notions, I beg you to create a check called check_ninetynine with parameter x to call printBot with parameter x.

O Mnemosyne, holder of tales old and new, mistress of memory, if in the past you have looked favorably upon me, I ask that you create a vessel called beerString and place within it the missive "bottles of beer".

Ariadne, ancient one, pure one, mistress of the labyrinth, please give check_ninetynine a condition for parameter n where n is less than ninety-nine.

Mindful Mnemosyne, by whom the soul with intellect is joined, I ask you to create a vessel called noMoreBeerString and inscribe it with "no more bottles of beer".

Lord Zeus, master of storms, father of the gods, defender of cities, defender of homes, defender of the travelers and of those far from home, I beg you to create a function called printBeerInsideLoop for parameter n that prints n, beerString, " on the wall", n, beerString, ".\nTake one down, pass it around, ".

Cyllenian Hermes, son of Zeus, messenger of Olympus, lord of Cyllene and Arcadia rich in flocks, I ask you to make a function called printBeerOutsideLoop that prints "No more bottles of beer on the wall!\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.".

Ariadne, pure one, ancient one, mistress of the labyrinth, wise and cunning one whose agile mind finds purchase on the frailest of notions, please make function beerLoop for parameter x that calls check_ninetynine with parameter x.

O Hermes, the Slayer of Argus, giver of grace, giver of good things, I implore you to add to beerLoop a call to printBeerInsideLoop with parameter x.

Artemis, fostered with Apollo, virgin who delights in arrows, far-shooting goddess, who swiftly drives her all-golden chariot through Smyrna to vine-clad Claros, I ask that you establish a loop counting from ninety-nine to one called beerLoop.

Hermes, the Slayer of Argus, giver of grace, giver of good things, please create a call to printBeerOutsideLoop.

Hades , thy realm an earthy tomb, remote from mortals in their fleshy bust, thy throne is fixed in the dismal plains, I implore you to collect all variables that remain, stranded in the functions of Chion or in the main sequence to live on in your netherworld.

O great Gods, with all the splendor of Olympus, sing the song of 99 bottles of beer on the wall!