Help:Adding a new compiler/interpreter: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Creating a New Example: Fixed links to point to compiler, not compiler collection)
(→‎Creating a New Example: reflect header template usage)
Line 9: Line 9:


<nowiki>
<nowiki>
==[[C]]==
=={{header|C}}==
'''Compiler:''' [[gcc]] 4.0.1
'''Compiler:''' [[gcc]] 4.0.1

Revision as of 01:13, 26 November 2007

Adding a compiler is very simple.

Programming Example

You should probably start by examining the existing programming tasks, and finding one that you can complete with your compiler of choice.

Creating a New Example

Then you may need to add a programming example to that task. Find the place in the list of languages already applied where your language would fall, alphabetically. Then enter something like this:

 =={{header|C}}==
 '''Compiler:''' [[gcc]] 4.0.1
 
  int main ( void ) {
       // Some code here
  }

You don't have to use the C programming language, you definitely don't have to use gcc, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you. To create a link, surround the text with double square brackets. For example, gcc would be represented as [[gcc]].

Finally, note the importance of the extra space in front of the code. That creates a dashed box around the code sample, and puts it in a monospace font.

Using an Existing Example

If there's already a programming example written in a language your compiler supports, then all you need to do is ensure that the programming example works as expected in your compiler. Once you've determined that, you need only add your compiler to the list of compilers that support that code and that programming language.

Assuming you want to add Visual Studio.NET 2005 to the list of compilers that support a programming example written in C++...

 ==[[C plus plus|C++]]==
 '''Compiler:''' [[GCC]] 4.0.1
  int main ( void ) {
       // Some code here
  }

...becomes...

 ==[[C plus plus|C++]]==
 '''Compiler:''' [[GCC]] 4.0.1, [[Visual Studio.NET]] 2005
  int main ( void ) {
       // Some code here
  }

...and there you have it. There's really only one thing to watch out for, here. Do not include the compiler's version number in the link. A compiler is a product, and compiler pages should be one-to-a-product.

Compiler or Interpreter Page

If a programming example which mentions the compiler already exists, creating a compiler page is extremely simple. Just click on the link to the compiler link, and click "Create this article", on the resulting page. Add whatever information is appropriate, and end the article with the compiler template.

Compiler/Interpreter Template?

That's right. Each compiler page has the compiler template applied to it, and each interpreter page has the interpreter template applied to it. Each template points out that the article describes a compiler or interpreter, depending, and offers a link pointing back to any page that points to it. In this way, someone curious about a compiler or interpreter can find all of the programming examples that use it.

The templates also add the page to the Compilers and Interpreters category, so that people interested in seeing a complete list of compilers and interpreters at Rosetta Code can go to the Compilers and Interpreters Category index page to see the list.

To add the compiler template to a page, add the text {{compiler}} to the end of the page. To add the interpreter template to a page, add the text {{interpreter}} to the end of the page.

Click Preview Page, and you can see what your page will look like. Click Save Page, and you'll also see the page added to the Compilers and Interpreters category.

Cool, huh?

Conclusion

Thanks for showing an interest in adding information to Rosetta Code. With the help of people like you, Rosetta Code will become a true programmer's resource!