An esoteric extension to CoffeeScript based on My Little Pony: Friendship is Magic
CoffeeScript Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 19 commits ahead, 301 commits behind michaelficarra:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

FiMScript: Friendscript is Magic

"Friendscript/FiMscript" is a friendship report-inspired esoteric extension to CoffeeScript, with an implementation based on Michael Ficarra's Kickstarted rewrite of CoffeeScript.

For those not familiar with CoffeeScript:

CoffeeScript is a little language that compiles into JavaScript. Underneath all those awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. The golden rule of CoffeeScript is: "It's just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable and pretty-printed, passes through JavaScript Lint without warnings, will work in every JavaScript runtime, and tends to run as fast or faster than the equivalent handwritten JavaScript.

Friendscript allows CoffeeScript to include blocks containing a Javascript-suitable variation on the Friendship Reports 1.0 language specification:

FiM++ is an esoteric programming language inspired by the “friendship reports” written by Twilight Sparkle in the 2010 television show My Little Pony: Friendship is Magic. It follows the same general structure as Java, but uses full English, generally past-tense words and sentence structure.

(For more information, see the Scala reference implementation and the original post on Equestria Daily that launched the craze)

Friendscript intends to make this into a full-featured programming language suitable for production use in web clients and on Node.JS. Therefore, important changes have been made to the FiM++ syntax to support first-class functions, prototypes, and dynamic typing.

All source map and JS pretty printing support present in CoffeeScript 2 will be present in Friendscript, and development will track the bleeding edge of CS2.

Practically any existing CoffeeScript file will compile without changes. However, if a valid Friendscript block is detected (between a "Dear" salutation and a "Your faithful student" valediction), it is interpreted as Friendscript. To remove ambiguity regarding apostrophes, and for more informative syntax errors, a Friendscript block can be surrounded in triple-backticks. Thus, Friendscript/FiM++ and CoffeeScript can be interspersed. In fact, Friendscript can be used as an rvalue!

An example and test suite is at test/

Basic Example

console.log "Hello from CoffeeScript"
Derpy = "a perfectly normal pony"
DerpyHooves = {}

result =
Dear Princess Celestia, 

I said "Hello from FiMscript"!

Did you know that Derpy was "wall-eyed"?
I learned that Derpy Hooves's vision was "MUFFINS".

I learned to make friends.
I said "Making friends!".
Then you got "Friendship is Magic".
That's how to make friends.

I learned that somepony would make friends.
Then I got somepony.

Your faithful student,
Twilight Sparkle

console.log "Derpy is #{Derpy} and her vision is #{}"
console.log "When you make friends: #{result}"

compiles into this Javascript:

(function () {
  var Derpy, DerpyHooves, result;
  console.log('Hello from CoffeeScript');
  Derpy = 'a perfectly normal pony';
  DerpyHooves = {};
  result = function () {
    var makefriends, somepony;
    console.log('Hello from FiMscript');
    Derpy = 'wall-eyed'; = 'MUFFINS';
    makefriends = function () {
      console.log('Making friends!');
      return 'Friendship is Magic';
    somepony = makefriends();
    return somepony;
  console.log('Derpy is ' + Derpy + ' and her vision is ' +;
  return console.log('When you make friends: ' + result);

which outputs on the command line:

Hello from CoffeeScript
Hello from FiMscript
Making friends!
Derpy is wall-eyed and her vision is MUFFINS
When you make friends: Friendship is Magic

Getting Started

For those of you new to Node.js, visit and install.

Clone the repository, and (in the root directory):

npm install
make -j test
bin/coffee --help


To (slowly) bootstrap, recompile, and run/compile all tests:

make -j build test

To quickly test changes to only the grammar and friendscript test, without rebuilding the other parts of the compiler:

make quick

Browserify support (to use this in the browser) is being developed. Once it is, and the language is a bit stabilized, there's no better way to put a pony easter egg in a web application!

Notable Contributors to Michael Ficarra's CoffeeScript II

And of course, thank you Jeremy (and all the other contributors) for making the original CoffeeScript compiler.