A program that uses two paragraphs, a [[mane paragraph]] and a utility paragraph, to add all the numbers from 1 to 100:
A program that uses two paragraphs, a [[mane paragraph]] and a utility paragraph, to add all the numbers from 1 to 100:
−
{{codeblock|{{code|keyword|Dear}}{{code|whitespace| }}{{code|report|Princess Celestia}}{{code|punctuation|:}}{{code|whitespace| }}{{code|report|I can add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|<STRONG>Today</STRONG> I learned}}{{code|whitespace| }}{{code|paragraph|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|the answer}}{{code|whitespace| }}{{code|keyword|was}}{{code|whitespace| }}{{code|paragraph|how to add}}{{code|whitespace| }}{{code|keyword|using}}{{code|whitespace| }}{{code|literal|1}}{{code|whitespace| }}{{code|keyword|and}}{{code|whitespace| }}{{code|literal|100}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|I said}}{{code|whitespace| }}{{code|variable|the answer}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace| }}{{code|paragraph|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|I learned}}{{code|whitespace| }}{{code|paragraph|how to add}}{{code|whitespace| }}{{code|keyword|to get}}{{code|whitespace| }}{{code|type|a number}}{{code|whitespace| }}{{code|keyword|using}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|first}}{{code|whitespace| }}{{code|keyword|and}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|last}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|sum}}{{code|whitespace| }}{{code|keyword|was}}{{code|whitespace| }}{{code|literal|0}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|As long as}}{{code|whitespace| }}{{code|variable|first}}{{code|whitespace| }}{{code|operator|was no more than}}{{code|whitespace| }}{{code|variable|last}}{{code|punctuation|,}}{{code|whitespace|<BR/>}}{{code|variable|sum}}{{code|whitespace| }}{{code|keyword|became}}{{code|whitespace| }}{{code|variable|sum}}{{code|whitespace| }}{{code|operator|plus}}{{code|whitespace| }}{{code|variable|first}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|variable|first}}{{code|whitespace| }}{{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| }}{{code|paragraph|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| }}{{code|report|Princess Celestia}}{{code|punctuation|:}}{{code|whitespace| }}{{code|report|I can add}}{{code|punctuation|!}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|<STRONG>Today</STRONG> I learned}}{{code|whitespace| }}{{code|paragraph|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|the answer}}{{code|whitespace| }}{{code|keyword|was}}{{code|whitespace| }}{{code|paragraph|how to add}}{{code|whitespace| }}{{code|keyword|using}}{{code|whitespace| }}{{code|literal|1}}{{code|whitespace| }}{{code|keyword|and}}{{code|whitespace| }}{{code|literal|100}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|I said}}{{code|whitespace| }}{{code|variable|the answer}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace| }}{{code|paragraph|how to add a lot}}{{code|punctuation|.}}{{code|whitespace|<BR/><BR/>}}{{code|keyword|I learned}}{{code|whitespace| }}{{code|paragraph|how to add}}{{code|whitespace| }}{{code|keyword|to get}}{{code|whitespace| }}{{code|type|a number}}{{code|whitespace| }}{{code|keyword|using}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|first}}{{code|whitespace| }}{{code|keyword|and}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|last}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|variable|sum}}{{code|whitespace| }}{{code|keyword|was}}{{code|whitespace| }}{{code|literal|0}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|As long as}}{{code|whitespace| }}{{code|variable|first}}{{code|whitespace| }}{{code|operator|was no more than}}{{code|whitespace| }}{{code|variable|last}}{{code|punctuation|,}}{{code|whitespace|<BR/>}}{{code|variable|sum}}{{code|whitespace| }}{{code|keyword|became}}{{code|whitespace| }}{{code|variable|sum}}{{code|whitespace| }}{{code|operator|plus}}{{code|whitespace| }}{{code|variable|first}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|variable|first}}{{code|whitespace| }}{{code|operator|got one more}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|That's what I did}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|Then you get}}{{code|whitespace| }}{{code|variable|sum}}{{code|punctuation|!}}{{code|whitespace|<BR/>}}{{code|keyword|That's all about}}{{code|whitespace| }}{{code|paragraph|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 51:
Line 51:
first++;
first++;
}
}
+
return sum;
}
}
}
}
Revision as of 00:54, December 26, 2014
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 for being a mere letter.
Structure
The general structure of a FiM++ program is class-based. That is, code is organized in individual files, called reports. Within each file, there are imports that help reference other reports, the report itself, methods (called paragraphs), 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: 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 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.
This wiki details version 1.0, Sparkle. Other versions exist (linked above), but they have no number or name.
Example Programs
A program that simply uses one paragraph to print "Hello World" and exits:
DearPrincess Celestia:Hello World!
Today I learnedhow to say hello world! I said“Hello, World!”! That's all abouthow to say hello world.
Your faithful student, Kyli Rouge.
A program that uses two paragraphs, a mane paragraph and a utility paragraph, to add all the numbers from 1 to 100:
DearPrincess Celestia:I can add!
Today I learnedhow to add a lot. Did you know thatthe numberthe answerwashow to addusing1and100? I saidthe answer! That's all abouthow to add a lot.
I learnedhow to addto geta numberusingthe numberfirstandthe numberlast. Did you know thatthe numbersumwas0? As long asfirstwas no more thanlast, sumbecamesumplusfirst... firstgot one more. That's what I did! Then you getsum! That's all abouthow 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: