Localized Programming Language
Citrine Programming Language
Citrine is one of the first*
embeddable**, general purpose, localized scripting languages, designed
for developers (and power users) who just want to write scripts in their mother tongue.
Hopefully, by doing so, Citrine will improve the quality of everyday scripting.
Learn Citrine in a minute.
* Development started in 2009
** Citrine can be used as serverless/FAAS language
Latest News
0.9.3 Solleveld
0.9.2 Wapendal
0.9.1 Van Leydenhof
Citrine 0.8.4
Citrine 0.7.4
Citrine 0.6
Changelog & Roadmap
☞ greeting ≔ ‘Hello country!’. greeting country: ‘Great Britain’. ✎ write: greeting.
☞ groet ≔ “Hallo land!”. groet land: “Nederland”. ✎ schrijf: groet.
☞ salut ≔ ‘Bună țară!’. salut țară: ‘România’. ✎ scrie: salut.
☞ sveikinimas ≔ ‘Sveika šalis!’. sveikinimo šalis: ‘Lietuva’. ✎ atspausdinti: sveikinimas.
Features
Localized
Allows everyone to code in their native language. Making code more accessible and expressive.
Pure Objects
True, Smalltalkish, Object Oriented Programming: the way it was meant to be.
Simple Grammar
Very simple, minimalistic grammar. Easy to learn and remember.
Prototypes
Flexible prototypal inheritance, just like JavaScript but without the quirkiness.
Dynamic Scope
Extremely powerful dynamic scoping, just like good old BASIC and some LISPs.
Translate
International teams? Automatically Translate code from one language into another.
Manual
Citrine is very easy to learn, you create a program by
sending messages to objects. There are 3 types of messages:
unary (no arguments), binary (one argument) and
keyword messages (one or more arguments),
here's how:
☞ x ≔ ‘Hello’ length. ☞ x ≔ 3 + 7. ☞ x ≔ Number between: 0 and: 10.
We use ☞ to declare a new variable. In the second example we send a message +7 to 3, the resulting object will be 10. There is no need for if, while or for statements, to execute code conditionally send true: to a boolean, to run code in a loop, multiply the task by sending ×:
(x ≥ y) true: { ✎ write: ‘buy!’. }. { :i ✎ write: i. } × 3. { x add: 1. } while: { ↲ x < 9. }.
There is no special syntax needed for string interpolation, just send a non-defined message to a string to replace the word specified by the message with the argument:
‘hi you!’ you: ‘World!’.
With Citrine you can create a list or a map like this:
☞ fruit ≔ List new • ‘banana’ • ‘mango’. ☞ price ≔ Map new pie: 3.00, cookie: 2.25. ✎ write: (fruit position: 1), stop. ✎ write: price cookie, stop.
Note that lists start with element no. 1, just like in natural language.
To create your own object, send new to the main Object, you can also use other objects as a prototype. You can add new logic to all objects with on:do:, even existing ones. There are no classes.
☞ x ≔ Object new. x on: ‘greet’ do: { ↲ ‘hi!’. }. ☞ y ≔ Number new. y on: ‘double’ do: { ↲ ⛏ × 2. }.
Note that ⛏ refers to the object itself. To store a value as an object property use: ⚿, all properties are private.
cat on: ‘name:’ do: { :me ⚿ name ≔ me. }.
Apart from a few details, that's basically all there is to
it! Now you know Citrine! More details here (English).
For more examples, open the learn-by-example manual, which is available
for all languages supported by Citrine, i.e. Dutch*, French, Russian and many more!
* Translated manual available
EXAMPLES (ALL LANGUAGES)
Citrine is a localized scripting language.
For some languages, we have to rely on machine translations
because we haven't found translators yet.
We appreciate any help!
All natural languages are welcome**, even if they are not very common (EGIDS-status 6).
** Artificial languages, fantasy languages, private languages and other
non-natural languages will not be included but you are free to fork the project of course.
Products
Citrine is open source (licensed BSD) and the source
code is available for free.
DOWNLOAD CITRINE (FREE)
GET SOURCE CODE (FREE)
TRY ONLINE DEMO (FREE)
Citrine is being tested continously using Travis/CI, read the latest test reports.
If you don't like to compile the source yourself, I can
create a binary for your platform and language of choice for
a small fee (Citrine translators get it for free, of course).
ORDER CUSTOM BUILD
Do you want development support for Citrine? Do you want to
integrate the Citrine Programming Language into your cloud service,
online platform or business application?
ENTERPRISE SUPPORT
FAQ
Why Citrine?
Citrine is simple, minimalist, localized programming language following the Kayan philosophy1, for developers who prefer to write code in their native language without having English keywords in the mix. Citrine features a very limited grammar and lacks unnecessary complex concepts like classes, string interpolation syntax and data-types (everything is an object), making it easy to learn and remember. Citrine also features localized numbers, dates and punctuation. Localization can be seen as the final step in producing a more readable and maintainable programming language. Coding and studying in your own language has been proven to have a positive impact on learning outcomes2 and quality3,4. Citrine can also translate code. 1. After the Philosophy of American Computer Scientist Dr. Alan Kay (regarded as inventor of Object Oriented Programming) 2. Learning to Code in Localized Programming Languages (MIT) 3. Effects of localization on Exceptions in Java 4. Engelstaligonderwijs slecht voor studie (PDF)
Why is this page in English?
As a developer, you have to know some English. Nobody is going to change that anytime soon. Writing complex logic in a foreign language is something different though. Citrine allows you to put your thoughts into the words of the language you know best: your mother tongue. That being said, if you want to translate a manual page, feel free to help!
Who are the users?
Citrine can be used as a general purpose programming language by developers who wish to improve maintainability and readability by writing minimalist, pure object code in their native language. Also, Citrine can be embedded into serverless cloud or FAAS* platforms as a localized scripting language or localized DSL for power users, to lower adoption barriers and reach new audiences. Furthermore, Citrine can be used to teach programming in a language agnostic way at schools and universities.
Can I contribute?
Sure, Citrine is open source (Licensed BSD1,2) and we can share code using e-mail or Github or other systems. See the plug-in wishlist for a start! Citrine is written in C. The Citrine Project is apolitical. 1. BSD License explained 2. Citrine Programming Language License on website
Other questions?
Consult the Extended Technical FAQ >.
Why icons in the language?
Abstract, yet frequently used concepts are represented as icons in Citrine. For example, to declare a new variable in a Citrine program you use a pointing finger (☞). The inspiration for this approach comes from Smalltalk-701. Apart from pictograms, Citrine also allows the use of thin space to separate words in object names and message parts to avoid CaMelCase and snake_case. You can use the icons in your code by installing the Citrine font (Citrine.ttf, part of the download package) and using the unicode codes (Linux: CTRL + SHIFT + u), the Berlian IDE or a Geany Macro package, see Extended Techical FAQ. 1. Smalltalk-72 Manual
What type of scoping does Citrine use?
Citrine uses dynamic scoping, for instance, the following example prints '2':
☞ f ≔ { q ≔ 2. }. {☞ q ≔ 1. f run. ✎ write: q.} run.
Can I use inheritance?
Yes. Assuming we have a Cat object that can print its name, here, we override the behaviour for message 'name' with a new response. The ⛏ symbol 'plays' back another response from the same object. Sending the same message invokes the overridden behaviour. If you really want recursion (i.e. invoke the code you're currently running) prefix your message with the word 'recursive'.
RoyalCat ≔ Cat new. RoyalCat on: 'name' do: { :n ↲ ‘your royal highness ’ + ( ⛏ name ). }. ✎ write: ((RoyalCat new name: ‘Diva’) name).
What happens if a message is not understood?
If an object does not understand a message, the message will be ignored (Null Pattern). You can intercept those messages though, similar to PHP's magic methods:
echo ≔ Object new. echo on: ‘respond:’ do: { :s ↲ s + s }. echo ho!.
About the authors
Gabor de Mooij
Core language design & Linux/BSD implementations.
Software developer from the Netherlands.
Aavesh Jilani
Windows, Android/ARM platform support.
Software developer from India.
The creator of Dragon (programming language)
and Suasive (search engine).
Special thanks to:
John Calistro, Tirifto, Twiggler, MadcapJake,
DennisCGc, Takano32, LeoTindall,
Janus, Shinriyo, Sean Eshbaugh,
Georgel Preput, Lina Dapkute
& Marianne.
contact: gabordemooij at gaborsoftware dot nl