Elena programming language

The place to bring up any design issues, or post your own creations

Moderator: Moderator Team

Post Reply
bencz
Posts: 3
Joined: Fri Jan 01, 2016 7:07 pm

Elena programming language

Post by bencz » Sun Jan 10, 2016 8:00 pm

ELENA is a general-purpose, object-oriented, polymorphic language with late binding. It features message dispatching / manipulation, dynamic object mutation, a script engine / interpreter and group object support.
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

Image
Image
Image
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.
Word count:

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
Last edited by bencz on Mon Jan 11, 2016 5:33 pm, edited 2 times in total.

erkinalp
Posts: 756
Joined: Sat Dec 20, 2008 5:55 pm

Re: Elena programming language

Post by erkinalp » Sun Jan 10, 2016 10:12 pm

Very dynamic binding. Stay tuned for new memory management code.
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.
What license standard library is under?
-uses Ubuntu+GNOME 3 GNU/Linux
-likes Free (as in freedom) and Open Source Detergents
-favors open source of Windows 10 under GPL2

bencz
Posts: 3
Joined: Fri Jan 01, 2016 7:07 pm

Re: Elena programming language

Post by bencz » Sun Jan 10, 2016 10:25 pm

Hi (:
The entire project license is Apache V2

manuel
Posts: 401
Joined: Thu Jan 28, 2010 11:20 pm
Location: México
Contact:

Re: Elena programming language

Post by manuel » Mon Jan 11, 2016 5:21 pm

Would be good put a reference of this post on EPIC WIN! 8-)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest