Any program or library consists of modules containing classes and symbols. The main way to interact with objects in ELENA is sending a message. The message name is structured and consists of a verb, a signature and a parameter counter. The verb defines a message action, for example read or write some data. There are only limited set of possible verbs. The signature is user defined and describes the message parameters. If the signature is not provided the message is considered to be generic and can be qualified (by dispatching).
If the object wants to handle the message it has to contain the method with the same name. If no method mapping was found the flow is considered to be broken and the control goes to the next alternative flow (exception handler) or the program is stopped. It is possible to declare generic handler which will be called for all incoming messages.
Features:
[*]Pure polymorphic object oriented language
[*]Dynamic "class mutation"
[*]Message dispatching
[*]ELENA Virtual machine
[*]Command line 32-bit compiler
[*]GUI IDE & Debugger
[*]Unicode support (utf-8)
[*]Complete source code
[*]Number of samples
[*]Getting started tutorial
[*]Simple Assembler compiler
[*]Script Engine / Interpreter
[*]ELENA Virtual Machine Terminal
[ external image ]
[ external image ]
[ external image ]
[ external image ]
Some code examples:
Hello World:
Code: Select all
#import system.
#symbol Program =
[
console writeLine:"Hello World!!" readChar. // wait for any key
].
Dynamic variable:
Code: Select all
// Create a variable with a user-defined name. The variable name should not be written in the program text,
// but should be taken from the user dynamically.
#import system.
#import system'dynamic.
#import extensions.
#class TestClass
{
#field theVariables.
#constructor new
[
theVariables := DynamicStruct new.
]
#method eval
[
#var(type:subject) varRef := Signature new &literal:(console write:"Enter the variable name:" readLine).
theVariables::varRef set:42.
#var v := theVariables::varRef get.
console writeLine:(varRef name):"=":(theVariables::varRef get).
]
}
#symbol program = TestClass new.
Code: Select all
#import system.
#import system'routines.
#import system'collections.
#import system'text.
#import extensions.
#import extensions'routines.
// --- WordList ---
#class WordList
{
#field theTotal.
#field theList.
#constructor new
[
theList := ArrayList new.
theTotal := Integer new &int:0.
]
#method append : aWord
[
theTotal += 1.
(theList ifExists:aWord)
! [ theList append:aWord. ].
]
#method total_words = theTotal.
#method unique_words = theList length.
#method cast : aVerb &to:aTarget
=> theList.
#method cast : aVerb &to:aTarget &with:aParam
=> theList.
#method => theList.
}
// --- Program ---
#symbol Program =
[
console writeLine:"Enter the text(to stop press enter two times):".
#var aText := TextBuffer new.
#var aLine := String new.
// read until the empty string is not entered
[
aText << console readLine:aLine << " ".
]
run &until:[ aLine length == 0 ].
#var aList := WordList new.
aText run &eachWord:anItem [ aList append:anItem ].
console writeLine:"There are ":(aList unique_words):" unique words out of ":(aList total_words).
(aList total_words > 0)
? [ console writeLine:"the list of unique words:":(aList ascendant). ].
console readChar. // wait for any key
].
Support for Windows XP has been removed in the latest version, unintentionally but the next release will be support again Windows XP.
At now, you can download a xp compatible version of last release, at: http://tinyurl.com/elcXP-1 ( an ZIP file with binaries )
There may be some cases of incompatibility.
If are some interest in using Elena language for developing programs or tools to ReactOS we can create project templates or make changes to give further support to the ReactOS.
You can download the compiler and source code in https://github.com/ELENA-LANG/elena-lang.
For more information visit http://elenalang.netu.cf
Project license: Apache v2