FiM++ Wiki
Register
(→‎Example Programs: linked to mane method article)
(→‎Example Programs: stupid editing errors)
Line 20: Line 20:
   
 
A program that uses two methods, a [[mane method]] and a utility method, to add all the numbers from 1 to 100:
 
A program that uses two methods, a [[mane method]] and a utility method, to add all the numbers from 1 to 100:
{{codeblock|{{code|keyword|Dear}}{{code|whitespace|&nbsp;}}{{code|class|Princess Celestia}}{{code|punctuation|:}}{{code|whitespace|&nbsp;}}{{code|class|I can add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|<STRONG>Today</STRONG> I learned}}{{code|whitespace|&nbsp;}}{{code|method|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|the answer}}{{code|whitespace|&nbsp;}}{{code|keyword|was}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|whitespace|&nbsp;}}{{code|keyword|using}}{{code|whitespace|&nbsp;}}{{code|literal|1}}{{code|whitespace|&nbsp;}}{{code|keyword|and}}{{code|whitespace|&nbsp;}}{{code|literal|100}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|I said}}{{code|whitespace|&nbsp;}}{{code|variable|the answer}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace|&nbsp;}}{{code|method|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|I learned}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|whitespace|&nbsp;}}{{code|keyword|with}}{{code|whitespace|&nbsp;}}{{code|type|a number}}{{code|whitespace|&nbsp;}}{{code|keyword|using}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|first}}{{code|whitespace|&nbsp;}}{{code|keyword|and}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|the last}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|keyword|was}}{{code|whitespace|&nbsp;}}{{code|literal|0}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|As long as}}{{code|whitespace|&nbsp;}}{{code|variable|the first}}{{code|whitespace|&nbsp;}}{{code|operator|was no more than}}{{code|whitespace|&nbsp;}}{{code|variable|the last}}{{code|punctuation|,}}{{code|whitespace|<BR/>}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|keyword|became}}{{code|whitespace|&nbsp;}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|operator|plus}}{{code|whitespace|&nbsp;}}{{code|variable|the first}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|variable|the first}}{{code|whitespace|&nbsp;}}{{code|operator|got one more}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|That's what I did}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|Your faithful student}}{{code|punctuation|,}}{{code|comment| Kyli Rouge}}{{code|punctuation|.}}}}
+
{{codeblock|{{code|keyword|Dear}}{{code|whitespace|&nbsp;}}{{code|class|Princess Celestia}}{{code|punctuation|:}}{{code|whitespace|&nbsp;}}{{code|class|I can add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|<STRONG>Today</STRONG> I learned}}{{code|whitespace|&nbsp;}}{{code|method|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|the answer}}{{code|whitespace|&nbsp;}}{{code|keyword|was}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|whitespace|&nbsp;}}{{code|keyword|using}}{{code|whitespace|&nbsp;}}{{code|literal|1}}{{code|whitespace|&nbsp;}}{{code|keyword|and}}{{code|whitespace|&nbsp;}}{{code|literal|100}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|I said}}{{code|whitespace|&nbsp;}}{{code|variable|the answer}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace|&nbsp;}}{{code|method|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|I learned}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|whitespace|&nbsp;}}{{code|keyword|with}}{{code|whitespace|&nbsp;}}{{code|type|a number}}{{code|whitespace|&nbsp;}}{{code|keyword|using}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|first}}{{code|whitespace|&nbsp;}}{{code|keyword|and}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|last}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace|&nbsp;}}{{code|type|the number}}{{code|whitespace|&nbsp;}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|keyword|was}}{{code|whitespace|&nbsp;}}{{code|literal|0}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|As long as}}{{code|whitespace|&nbsp;}}{{code|variable|first}}{{code|whitespace|&nbsp;}}{{code|operator|was no more than}}{{code|whitespace|&nbsp;}}{{code|variable|last}}{{code|punctuation|,}}{{code|whitespace|<BR/>}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|keyword|became}}{{code|whitespace|&nbsp;}}{{code|variable|sum}}{{code|whitespace|&nbsp;}}{{code|operator|plus}}{{code|whitespace|&nbsp;}}{{code|variable|first}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|variable|first}}{{code|whitespace|&nbsp;}}{{code|operator|got one more}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|That's what I did}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace|&nbsp;}}{{code|method|how to add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|Your faithful student}}{{code|punctuation|,}}{{code|comment| Kyli Rouge}}{{code|punctuation|.}}}}
   
 
=== Mirror in Java ===
 
=== Mirror in Java ===
Line 41: Line 41:
 
}
 
}
 
 
public static double howToAdd(double theFirst, double theLast) {
+
public static double howToAdd(double first, double last) {
 
double sum = 0;
 
double sum = 0;
while (theFirst <= theLast) {
+
while (first <= last) {
 
sum = sum + theFirst;;;
 
sum = sum + theFirst;;;
theFirst++;
+
first++;
 
}
 
}
 
}
 
}

Revision as of 22:48, 25 October 2012

FiM++ (AKA Friendship Reports) is a programming language inspired by Friendship Reports, Java and Shakespeare, whose syntax is not dissimilar to that of ALGOL. The main goal of FiM++ is to be readable by humans, to the point that a well-written FiM++ program could be mistaken to be a mere letter.

Structure

The general structure of a FiM++ program is class-based. That is, code is organized in individual files, called classes. Within each file, there are imports that help reference other classes, the class itself, methods, literals, variables, and constants.

History

  • Feb 23, 2011: The first ideas of a programming language pop up in a Google Code repository. This project is abandoned June 12 of that same year.
  • Oct 4, 2012: Cereal Velocity makes a post about FiM++ on Equestria Daily.
  • Oct 4, 2012: DeftCrow on deviantART creates the first real program in FiM++, 99 Jugs of Cider and Hello World. This works out some inconsistencies and sets the stage for a fully-fledged language.
  • Oct 5, 2012: An admin on Equestria Forever named Twilight Sparkle makes a forum post about the aforementioned posts, also detailing some more propositional features of the language.
  • Oct 11, 2012: Supuhstar (AKA Kyli Rouge) asks permission from DeftCrow and Cereal Velocity to make a formal document fully specifying the language.
  • Oct 18, 2012: This wiki is created when the document becomes too daunting to scroll through.

Versions

Currently, there is only one official version, which is 1.0, codename “Sparkle”. That is the version that this wiki details.

Example Programs

A program that simply uses one method to print "Hello World" and exits:

Dear Princess Celestia:Hello World!

Today I learned how to say hello world!
I said “Hello, World!”!
That's all about how to say hello world.

Your faithful student, Kyli Rouge.

A program that uses two methods, a mane method and a utility method, to add all the numbers from 1 to 100:

Dear Princess Celestia: I can add!

Today I learned how to add a lot.
Did you know that the number the answer was how to add using 1 and 100?
I said the answer!
That's all about how to add a lot.

I learned how to add with a number using the number first and the number last.
Did you know that the number sum was 0?
As long as first was no more than last,
sum became sum plus first...
first got one more.
That's what I did!
That's all about how to add!

Your faithful student, Kyli Rouge.

Mirror in Java

FiM++ can be translated into Java relatively easily. Here's the above Hello World example in Java:

public class HelloWorld extends Object {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

And here's the above addition program:

public class ICanAdd extends Object {
    
    public static void main(String[] args) {
        double theAnswer = howToAdd(1, 100);
        System.out.println(theAnswer);
    }
    
    public static double howToAdd(double first, double last) {
        double sum = 0;
        while (first <= last) {
            sum = sum + theFirst;;;
            first++;
        }
    }
}