Rosetta Code:Add a Language: Difference between revisions

(CafeOBJ is a algebraic specification and programming language.)
Line 11:
==Basic Information==
 
TheseCafeOBJ areis thea bitsalgebraic that should be done for everyspecification language.
It has an executable sub-language which broadly similar to Haskell or ML.
CafeOBJ has many advanced features including: multiple logics, flexible mix-fix syntax, powerful and clear typing system with ordered sorts, parametric modules and views for instantiating the parameters, and module expressions, and more.
Many of these features are inherited from OBJ3 (http://en.wikipedia.org/wiki/OBJ3).
For download and manual see: http://www.ldl.jaist.ac.jp/cafeobj/)</small>
 
===Category Page===
 
Once you're sure the language doesn't already have a page on Rosetta Code, you'll need to create a category page for the language. Let's say you're adding a language called Ayrch ('''This is a hypothetical language name; please change it to your actual language name when you actually add your language.''') The first thing you need to do is create the category page. The easiest way is to click on the Search field, type '''Category:Ayrch''', and click Go. It will tell you there is no current page with that name. Click "create this page", and it will give you an empty page to edit.
 
One simple way to start is to make this the entire body of the page:
 
<pre>{{stub}}{{CafeOBJ}}</pre>
<small>(CafeOBJ is a algebraic specification language.
It has an executable sub-language which broadly similar to Haskell or ML.
CafeOBJ has many advanced features including: multiple logics, flexible mix-fix syntax, powerful and clear typing system with ordered sorts, parametric modules and views for instantiating the parameters, and module expressions, and more.
Many of these features are inherited from OBJ3 (http://en.wikipedia.org/wiki/OBJ3).
For download and manual see: http://www.ldl.jaist.ac.jp/cafeobj/)</small>
 
That will automatically give you a basic language page, and even a nice little stub notification reminding people who visit to fill in more information.
 
===Redirect===
 
<pre>#REDIRECT [[:Category:AyrchCafeOBJ]]</pre>
The next step is to create a redirect page. This is important, because the ''actual'' page for your Ayrch language is at '''http://rosettacode.org/wiki/Category:Ayrch''', and we want people to be able to go to '''http://rosettacode.org/wiki/Ayrch''', and be able to use syntax like <nowiki>[[Ayrch]]</nowiki> within the wiki to refer to it.
 
As before, click on the Search field on the left, but this time type '''Ayrch''', and click Go. Again, click "create this page", and it will again give you an empty page to edit.
 
This time, make the entire body of the page:
 
<pre>#REDIRECT [[:Category:Ayrch]]</pre>
 
Now, when anyone goes to the Ayrch page, they will be immediately redirected to the category page for Ayrch.
 
===Examples===
<pre>
=={{header|AyrchCafeOBJ}}==
 
<lang CafeOB>
''You're not done yet!''
-- Here is a sample sorting program.
mod! SORTING-NAT {
pr(NAT)
[Nat < Strg ]
-- Simple list structure
op nil : -> Strg
op _._ : Strg Strg -> Strg { assoc id: nil }
 
vars N N' : Nat
You've created a language category page and have ensured that people who visit the page in the main namespace will reach the right place. You might even have gone back to the category page and filled in a few more details like some history and links to the official sites and resources for the language.
-- A very short sorting program using transitions in POA logic, which is a type of rewrite logic
ctrans [swap] : (N . N') => (N' . N) if N' <= N .
}
 
**> Sorting natural numbers using exec command
What could be missing? ''Code!''
open SORTING-NAT
exec (3 . 2 . 1) .
**> Sorting natural numbers using search command
**> we can use (show path N) with this command, where N is the nuber of possible states.
red (3 . 2 . 1) =(1,1)=>* (1 . 2 . 3) .
red (3 . 2 . 1) =(1,2)=>* (1 . 2 . 3) .
red (3 . 2 . 1) =(1,3)=>* (1 . 2 . 3) .
**> search for any number of solutions at any depth
red (3 . 2 . 1) =(*,*)=>* (1 . 2 . 3) .
**> print the transitions from initial to goal state
show path 5
eof
</prelang>
</pre>
 
You need to provide at least one or two token examples, to give people a taste of the language. Otherwise, there really isn't much of a point for the language to be mentioned on the wiki; Nobody is likely to notice it.
 
If you're pressed for time, browse the [[:Category:Programming Tasks|list of tasks]] and find a couple simple ones you can implement. [[User Output]], [[Loop Structures]] and [[Conditional Structures]] are some common ones that most languages support. For the sake of this demonstration, let's suppose that Ayrch looks a lot like BASIC, and implement [[User Output]].
 
We would need to go to that page, find where the language would fit, and add this code:
 
<pre>
=={{header|Ayrch}}==
<lang ayrch>PRINT "GOODBYE, WORLD!"</lang>
</pre>
 
That's a very simple example; You might try adding some descriptive information before the <nowiki><lang></nowiki>, such as what compiler it works with, or perhaps some interesting information of how Ayrch does things differently from other languages. Whatever helps to illustrate the language and identify what makes this example interesting.
 
===Tasks Not Implemented===
Records and full object style classes.
 
Finally, you're going to want to create an easy way for other people to discover and add tasks that have not yet been implemented in your language. In the bottom right of your page, click the link that says, "If you know '''Ayrch''', please write code for some of the ''tasks not implemented in Ayrch''." In the new page that opens, enter the following for the page contents:
 
<pre>
{{unimpl_Page|Ayrch}}
</pre>
 
==More Advanced==
101

edits