Examples

Example .woof programs from the Bark repo, ready to run with jbark or pbark.

All shipped .woof files use story syntax with filler.

Save any program below as a .woof file and run with ./bark yourfile.woof or ./pbark yourfile.woof. Install steps are in Getting started. You can also just copy-paste them into the try-it editor. Same files live in examples/woof on GitHub.

Hello world(ish)

goodboy.woof: Short story about Pepon.

bark "My wife's dog Pepon:"

My wife has a dachshund
He is 5 years old
His name is "Pepon"

when he has 0 toys then he howls "WHOOOO!" otherwise he woofs "Woof"

he finds a toy
when he has 1 toy then he growls his name

The adventure of Bimba

bimba.woof: Bimba the labrador, greedy trait, print voices, sharing.

bark "Narrator: Bimba waits by her food bowl while the house still sleeps."

So, my wife has a labrador
She has 2 toys
Her name is "Bimba"

bark "Narrator: Bimba's cookie jar sits on the counter, tempting her nose..."

her cookie jar holds some items: "cookie", "cookie", "cookie", "cookie"
memory is count of the items in the cookie jar
her toy box holds some items: "ball", "squeaky toy", "stick"

bark: "Narrator: with the jar out of her reach, she decides to focus on her toys."
when she has 4 toys then she woofs "time to play!" otherwise she whines "I want more toys!"

bark "Narrator: with the humans still asleep it is time to play, but first Bimba needs more toys!"
she snags a toy
the toy box loses the first item
she snags a toy
the toy box loses the first item
she snags a toy
the toy box loses the first item
bark "Narrator: Greedy dogs always take more than one toy, three in this case!"

bark "Narrator: Bimba now has this many toys: "
bark how many toys Bimba has
bark "Narrator: The toy box now has this many toys: "
bark how many toys the toy box has

bark "Narrator: But after playing the cookies are now too temping, Bimba knocks the cookie jar onto the ground"
she whimpers as she wants and takes the first biscuit from her cookie jar

bark "Narrator: Bimba is not alone, there is also the dachshund Pepon"
I have a dachshund.
bark "Narrator: He is a bit simple and enters the room, tail already wagging."
Bimba shares with the dachshund

bark "Narrator: Bimba shared toys with Pepon (a miracle) and now looks at her remaining toys and says:"
when she has 3 toys then she howls "That was fine" otherwise she whines "I want it back!"

bark "Narrator: She decided to inform Pepon of how many toys she had left by barking."
she woofs how many toys she has

bark "Narrator: Bimba also informed Pepon of how many toys he now has..."
she woofs how many toys the dachshund has

bark "Narrator: a human is finally awake shouts how how many toys are left in the box:"
shout how many items are in the toy box

bark "Narrator: they made the mistake of putting the jar on the ground and looked away for a second"
Bimba pinches a treat
she pinches a treat
she pinches a treat
the cookie jar is empty

bark "Narrator: The human checks how many cookies are left and shouts: "
The human shouts how many items are in the cookie jar

bark "Narrator: The human checks how many snacks Bimba stole:"
when Bimba has 4 treats then the human growls "Nothing left." otherwise they growl memory minus how many treats Bimba has, "missing!"

bark "Narrator: I wonder who took the other cookie... The naughty dogs run away with their little stomping feet"

bark bark bark

Tradition

Esolang inside joke/ This is apparantly a thing. so I am just following the tradition that seems to exist as can always appreciate those!.

counter-tradition.woof: counter loop (Brainfuck +++++. spirit).

// Esolang tradition demo: counter loop (Brainfuck joke, Bark edition).

I have a corgi.

while she sniffs less toys than 8 then
   she finds a toy
bury

bark "The count is:"
she woofs how many toys she has

Learn

More syntax examples.

tutorial.woof: Bimba at the park.

// Bimba's morning at the park. The Bark tutorial story.

bark "The gate opens and Bimba trots into the sun."

I have a labrador.
She has 2 toys.
Her name is "Bimba".

bark "She checks her toys before the others arrive."
she woof how many toys she has

when she has 2 toys then she woof "Ready to play." otherwise she whine "Needs more toys."

I have a corgi.
bark "Hazel shows up late, as always."
she passes a toy to the corgi

her cookie jar holds "biscuit", "stick"
bark "Someone left treats in the jar by the bench."
she whimpers as she wants the first biscuit from her cookie jar

when she has 1 toy then she woofs her name

bark "The pack heads home when the jar is empty."
her cookie jar is empty
she woof how many toys she has
she woof how many toys the beagle has

bark bark bark

If / while demo

loops.woof: multiline branches and loops.


labrador
my labrador has 3 toys

when she has more than 2 toys then
   she woofs "Plenty."
   she misplaces a toy
otherwise when she has 1 toy then
   she woofs "Just one."
otherwise
   she woofs "None."
bury

while she has more than 0 toys then
   she woofs "Still going."
   she misplaces a toy
bury

Dog state is nine fields per breed (food, items, inventory, age, name, description, color, happy, fed). Story usually says toys and treats. See Dog fields.