Ѧ simple laחguagέ
ഽor ƩveЯyone

Universal Programming Language

The Citrine Project aims to create a programming language that allows everyone to write code in their native language. By doing so, we hope to make programming more accessible and improve the quality of software.

NEWS   API    WHY  
☞ f := Reeks ← 0 ; 1.

{
   ☞ a := f laatste.
   ☞ b := f een-na-laatste.   
   ☞ som := a + b.
  
   ✎ schrijf: som.

   f toevoegen: som.

} * 12.
Download Citrine 0.8.4 download citrine
1
2
3
5
8
13
21
34
55
89
144
233
377
$_

The basics

In Citrine, everything is an object. A program in Citrine is a conversation between objects. Objects can talk to eachother by sending messages.

☞ x := 3.6 round.
☞ x := 3.6 round even?.

Here we send the message round to number 3.6 (which is an object), the resulting value (4) gets assigned to x (we use the hand and := for that). On the second line we chain two messages (round and even?), resulting in x = True. A keyword message is a message with arguments. The following code snippet shows how to draw a random number between 1 and 10 by sending the message between:and: to Number.

☞ x := Number between: 1 and: 10.

A message that is just one single symbol (+-/*) is a binary message and always has exactly one argument; the object that follows. In the following example we use binary message + to add numbers 2 and 3, resulting in x = 5.

☞ x := 2 + 3.

You can chain keyword messages using a comma (,):

✎ write: 'hello ', write: 'world'.
hello world
$_

Control Flow

To execute block of code several times multiply the block:

{ :x ✎ write: x. } * 5.

This will run the block of code 5 times. If you want to break out of a loop, send the message break to a an expression that yields True or False. To create a condition:

(money ≥ price) true: {
   basket add: product.
}.

You can catch errors by attaching a catch block to your code:

{  2 / 0. } catch:
{ :error ✎ write: error. }, run.
Division by zero.
$_

Objects

To create your own object:

Cat := Object new.

We now have our own cat! To make it possible to give our cat a name we need to define the following behaviour:

Cat on: 'name:' do: { :x 
 ⚿ identity := x.
}.

Upon receiving the message name: followed by an actual name, this piece of code will assign the specified name to an internal property called identity. To indicate that this is an internal property, accessible only from within the object, we prefix it with a key symbol. Now we are ready to name our cat!

cat name: 'Diva'.

Our cat may be aware it's own name, but it has no means to tell us! So, we need to add that as well:

Cat on: 'name' do: {
 ↲ ⚿ identity.
}. 

Here we answer the message name with the name of the cat, stored in the internal property identity. So, to write the name of our cat on the screen, we can now ask the cat for its name like this:

✎ write: cat name.

Great! Now you area able to start writing your first Citrine program.
For advanced details see the FAQ.

How to translate?

To translate a Citrine program from one language into another:

ctr -t en2nl.dict myprogram.ctr

Dictionaries have the following format:

t "SOURCE" "TARGET"
s "SOURCE" "TARGET"

Use t for tokens and s for strings.
To generate a dictionary from 2 versions of Citrine in different languages:

ctr -g /nl/dictionary.h /en/dictionary.h

About Citrine

Citrine can be compiled in different languages. This means the core messages can be for instance English, Dutch, French or Icelandic. This allows Citrine to be used by a wider audience (i.e. schools). At time of writing, only English and Dutch versions are available. If you like to translate Citrine into your language, please contact me! While some language distributions are available on the download page, this site does not cover all different language versions (that would be too much work). The idea is that a Citrine ambassador will create and maintain a separate website for a language-specific distribution of Citrine.

What makes the Citrine project interesting?

Programming in your native language might help to better solve complex coding problems and improve code quality. It also allows non-technical people to read and help verify algorithms. Many programming languages have tried to make code more readable, writing programs in your native language can be considered a step in this direction. The Citrine project believes this is a difficult yet crucial step.

If Citrine respects all languages, why is this website in English?

As a developer, entrepeneur or scientist, you need to be able to read English texts. Citrine does not try to change that. However, writing complex programs in a foreign language is a different story. The Citrine project aims to reduce the number of mistakes in software by allowing everyone to use the language they know best. The manuals will still be mainly in English although translations in other languages may appear in the future or maybe summaries. The Citrine project also encourages ambassadors to host language specific implementations of Citrine along with translated manuals.

Is Citrine meant for non-programmers?

This is a common misunderstanding. Citrine is not meant for non-programmers. Citrine is and always will be a real general purpose programming language. However, even for professionals, programming in your native language reduces the number of mistakes. Citrine does try to make code as readable and maintainable as possible and helps to lower the barriers to programming for students and schools. However, Citrine is not an educational tool or a game to learn programming. In the end, Citrine is a full-fledged, powerful programming language that can be used for business purposes.

For more questions and answers, see the FAQ.

gaborsoftware Citrine can be considered is a high potential, experimental technology that may change the world of information technology. As such, Citrine might be interesting to international corporations having innovation budgets and depending on software development teams in different nations working together. Citrine might help to improve the overall quality and pace of software development.

If you are interested in experimenting with this exciting, yet highly experimental technology, contact me. Being the lead developer of Citrine I can offer support implementing the language as well as the required infrastructure (language server) for your organization.

The Citrine Programming Language is a product of GaborSoftware © copyright 2018 all rights reserved. Citrine Programming Language created by Gabor de Mooij and the Citrine community. In-language (citrine.ttf) icons from the ionicons project (MIT licensed), FontAwesome (SIL OFL 1.1) by Dave Gandy - http://fontawesome.io and Typicons by S. Hutchings (SIL Open Font Licence).
'Citrine in a box' icon created by Gabor de Mooij using multiple assets from the WikiMedia Commons Project.
Contact me:

Credits
Founder & Original Author: Gabor de Mooij
Windows version of Citrine: Twiggler
Foundation work Json & Curl plugins: MadcapJake
Special thanks to: DennisCGc, Takano32, LeoTindall, Janus, Shinriyo, Marianne.
Citrine Community

Citrine respects your privacy and does not use cookies. For details read the Citrine Privacy Statement.
29107 visits since 3 March 2018