BikiniScript

"I'm ready! I'm ready to code!" : SpongeBob SquarePants

View on GitHub

What is BikiniScript?

BikiniScript is a fully working, tree-walking interpreter written in Node.js : themed entirely around SpongeBob SquarePants. It supports variables, functions, classes, loops, conditionals, arrays, and recursion. All of the keywords fit the theme, so you declare variables with krabby, write functions with spatula, and loop with jellyfishing. It's a complete, usable language living at the bottom of the sea.

The Language at a Glance

krabby variable
spatula function
give back return
aye aye if
nay nay else
jellyfishingfor loop
crusty class
aye / nay true / false
plankton null
NetBag[] array
shout() print
self this

Example Programs

hello.bs : Hello, Bikini Bottom!
// Variables, loops, and conditionals

jellyfishing (krabby i = 1; i <= 3; i++) {
  shout("Krabby Patty #" + i + " is ready!")
}

krabby hungry = aye
aye aye (hungry) {
  shout("I'm ready! I'm ready! Time to make patties!")
} nay nay {
  shout("Not hungry... which never happens.")
}
fizzbuzz.bs : BubbleBass
// Divisible by 3 → "Bubble", by 5 → "Bass", by 15 → "BubbleBass"

spatula bubbleBass(n) {
  jellyfishing (krabby i = 1; i <= n; i++) {
    aye aye (i % 15 == 0) {
      shout("BubbleBass")
    } nay nay aye aye (i % 3 == 0) {
      shout("Bubble")
    } nay nay aye aye (i % 5 == 0) {
      shout("Bass")
    } nay nay {
      shout(i)
    }
  }
}

bubbleBass(100)
fibonacci.bs : Jellyfishing Fibonacci
// Recursion + loops

spatula fibonacci(n) {
  aye aye (n <= 1) { give back n }
  give back fibonacci(n - 1) + fibonacci(n - 2)
}

shout("Fibonacci Sequence, first 10 terms:")

jellyfishing (krabby i = 0; i < 10; i++) {
  shout("fib(" + i + ") = " + fibonacci(i))
}

Try It Yourself

Clone the repo and run any .bs file with Node.js:

git clone https://github.com/da-belt/bikiniscript.git
cd bikiniscript
node bin/bikiniscript.js examples/fizzbuzz.bs