FiM++

From Esolang
Jump to navigation Jump to search

FiM++ is an object-oriented language made by fans of My Little Pony: Friendship is Magic, which takes its name from the initials of the show's subtitle. Its syntax and structure are inspired by Java and ALGOL. The original idea was published on October 4th, 2012 by Cereal Velocity, one of the bloggers on Equestria Daily and inventor of the language, after being unable to find pre-existing programming language based on My Little Pony. It was then picked up by an team of community programmers and completed within the month.

Syntax

As stated by Cereal Velocity in the initial post,

FiM++ is a dynamically-typed, interpreted, object-oriented language that takes the form of the pony of your choice (I used Twilight for my specification) writing a letter to Princess Celestia. Functions in the language are formatted as paragraphs of the letter. It is intended to be read easily and as in-order as possible, to emulate a letter format. Each letter takes the form of a class, and each program can consist of multiple letters if one so chooses, but the minimum interpreted unit is the class, much like Java. The language does not support libraries- because we are sending a letter the code must be as lightweight as possible. Therefore, all features of the language are packaged with the base interpreter. Datatypes can be enforced if the user desires.

As the language developed, its precise syntax has changed some, but it mostly stayed true to the original idea.

Classes begin with the header "Dear", followed by the name of the parent class (Base class is "Princess Celestia"), and end with "Your faithful student,", followed by the programmer's chosen alias. Functions start with the text "I learned" followed by the function name and end with "That's all about" and a re-statement of the function name. The main function is denoted by placing the word "Today" before the initial "I learned".

Branching statements are supported in FiM++, as well as try-catch-finally blocks.

One thing that most sets this language apart is its strive to be layman-readable. To do this, it utilizes synonyms (e.g. a line can end in ., ,, ;, :, !, or ? depending simply on the coder's preference) and allows whitespace in class, function, and variable names.

Examples

Hello, World!

Here is an example of a Hello World program in FiM++:

Dear Princess Celestia: Hello World!

Today I learned something simple.
I said “Hello, World!”!
That's all about something simple!

Your faithful student, Twilight Sparkle.

Collatz sequence

The number liked by Spike is the starting value, you can change it.

Dear Princess Celestia: Letter describing my experiences with the Collatz sequence.

Today I learned about the Collatz sequence.
Did you know that the final value is one?

Did you know that Spike likes the number 53135714?

Did you know cakes are two?
Did you know that too much cake is three?

By the way, Spike can like any number greater than zero, especially when cakes are involved.

I did this while Spike had more than one:
    I said Spike, because he was helping me taste-test Pinkie Pie's cake sequence.
    Pinkie Pie made the remainder of Spike and the cakes.
    When Pinkie Pie had not less than one:
        Spike made the product of Spike and too much cake, because he felt odd.
        Spike got one more, because he is a greedy dragon.
        I said Spike!
    That's what I did.
    Spike made the quotient of Spike and the cakes, because we were even again.
That's what I did.

I said the final value, because Pinkie Pie's baking sequence was complete!

Your faithful student, Twilight Sparkle.

Cat Program

A cat program writes the user's input directly to the output. This program follows the proposed 1.0 (Sparkle) Language Specification.

Dear Princess Celestia: Cat Program!

Today I learned how to execute the cat program.

    While correct is true,
        Did you know that Spike is the word nothing?
        I asked Spike.
        I said Spike.
    That's what I did.

That's all about how to execute the cat program.

Your faithful student, Twilight Sparkle.

External resources