Help:Adding a new programming language: Difference between revisions

From Rosetta Code
Content added Content deleted
(list good starter examples)
(→‎Language Page: Added info about paradigms and language features)
 
(6 intermediate revisions by 2 users not shown)
Line 3: Line 3:
==Programming Example==
==Programming Example==


You should probably start by examining the existing [[:Category:Programming Tasks|programming tasks]], and finding one that you can complete with your language of choice. Good starter examples are [[Empty Program]], [[Comments]], [[User Output]], and those in [[:Category:Control Structures]] and [[:Category:Basic Data Operations]].
You should probably start by examining the existing [[:Category:Programming Tasks|programming tasks]], and finding one that you can complete with your language of choice. Good starter examples are [[Empty Program]], [[Comments]], [[User Output]], and those in [[:Category:Control Structures]] and [[:Category:Basic Data Operations]]. See [[:Help:Adding a new programming example]] for details.

Then you 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:

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

You don't have to use the C programming language, 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 <nowiki>[[GCC]]</nowiki>.

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.


==Language Page==
==Language Page==


Rosetta code uses the Category namespace for describing programming languages, with a normal page redirecting to it for more convenient links.
If a programming example already exists for the language, creating a language page is extremely simple. Just click on the link to the language, and click "Create this article", on the resulting page. Add whatever information is appropriate, and end the article with the language template.


If a programming example already exists for the language, creating a language page is simple. Just click on the red link to the language, and click "Create this article" on the resulting page and add at least this boilerplate:
===Language Template?===


<pre><nowiki>
That's right. Each language page has the language template applied to it. The language template points out that the article describes a programming languages, and offers a link pointing back to any page that points to it. In this way, someone curious about a language can find all of the programming examples that use it.
{{language}}
Short description of your language.
</nowiki></pre>


Your language description should briefly point out unique features of the language and provide links to external sites for more information or downloads. You can also provide wiki links to other languages or other wiki pages for cross-reference. If you have little to say, please prepend the text <code><nowiki>{{stub}}</nowiki></code> to let us know more information needs to be added. There are also other options that can be added to the language template to specify features of the language. See [[Template:Language]] for usage instructions. You may also specify programming paradigms used by this language by adding <nowiki>{{language programming paradigm|paradigm name}}</nowiki>. See [[:Category:Programming paradigm]] for paradigm options. Now click the "Save" button.
The language template also adds the page to the Language category, so that people interested in seeing a complete list of languages at Rosetta Code can go to the Language Category index page to see the list.


Next you need to add a page that redirects to this page so that people can link to your language easier. Enter the name of your language in the search bar on the left and click "Go". Once again, click "crate this page" and add this text replacing ''My Language'' with the name of your language:
To add the language template to a page, add the text <nowiki>{{Programming Language}}</nowiki> to the end of the page.


<pre><nowiki>
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 Language category.
#REDIRECT [[:Category:My Language]]
</nowiki></pre>


Now hit "Save" again. Go back to the example page and reload. Check that clicking the header link for your language takes you to the category page you just created, and that the example shows up in a section titled '''Articles in category "My Language"'''.
Cool, huh?


==Conclusion==
==Conclusion==

Latest revision as of 14:09, 3 September 2009

If you're familiar with the language, adding a new programming language is simple enough.

Programming Example

You should probably start by examining the existing programming tasks, and finding one that you can complete with your language of choice. Good starter examples are Empty Program, Comments, User Output, and those in Category:Control Structures and Category:Basic Data Operations. See Help:Adding a new programming example for details.

Language Page

Rosetta code uses the Category namespace for describing programming languages, with a normal page redirecting to it for more convenient links.

If a programming example already exists for the language, creating a language page is simple. Just click on the red link to the language, and click "Create this article" on the resulting page and add at least this boilerplate:

{{language}}
Short description of your language.

Your language description should briefly point out unique features of the language and provide links to external sites for more information or downloads. You can also provide wiki links to other languages or other wiki pages for cross-reference. If you have little to say, please prepend the text {{stub}} to let us know more information needs to be added. There are also other options that can be added to the language template to specify features of the language. See Template:Language for usage instructions. You may also specify programming paradigms used by this language by adding {{language programming paradigm|paradigm name}}. See Category:Programming paradigm for paradigm options. Now click the "Save" button.

Next you need to add a page that redirects to this page so that people can link to your language easier. Enter the name of your language in the search bar on the left and click "Go". Once again, click "crate this page" and add this text replacing My Language with the name of your language:

#REDIRECT [[:Category:My Language]]

Now hit "Save" again. Go back to the example page and reload. Check that clicking the header link for your language takes you to the category page you just created, and that the example shows up in a section titled Articles in category "My Language".

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!