Wednesday, April 29, 2015

Source code

 

I'm migrating my source code to GitHub. SVN repository is now obsolete!

New repository address is now - http://github.com/ELENA-LANG/elena-lang

There are two branches: master (the latest release) and current (work in progress)

The latest build is now available and from github as well - http://github.com/ELENA-LANG/elena-lang/releases/tag/v1.9.19.4a

P.S. updated to reflect change from three to two branches

Tuesday, April 28, 2015

ELENA 1.9.19.4 build (win32 / linux32) is out

A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/
$nil pseudo variable is added, to replace nil one.
In Linux version new examples are ported : goods, textfile, textdb
In Windows version gui samples added : agenda, c_a_g, graph

Wednesday, April 15, 2015

Tutorial: Literal as an array of characters

In this tutorial we will see how could we read the literal a character by character.

Let's consider the simple example: we will read each literal character and print it on the screen.

import extensions.

// ...

        var l := "Hello world".
        var i := 0.
        while (i < l length)
        [
            console write:(l@i).
            
            i := i + 1.
        ].

Let's make our example a little bit more difficult:

        l := "Привет Мир".
        var i := 0.
        while (i < l length)
        [
            console write:(l@i).
            
            i := i + 1.
        ].

The first loop works but the second one fails.

Let's find what breaks our code.

Starting from 1.9.19 LiteralValue is UTF-8. So the literal is actually twice as long. All Russian characters are encoded by two bytes. So why the code was not broken in the first loop? Because CharValue is UTF-32. It has enough place to store any Unicode characters. But when we read the second byte CharValue raises the exception because the code is invalid.

Note that it would works well if "l" is WideLiteralValue. But we will have the similar problem for Chinese symbols.

Fortunately we could easily fix the problem if we will use CharValue.length method. It returns how much bytes it take to encode the symbol.

        i := 0.
        while (i < l length)
        [
            console write:(l@i).
            
            i := i + l@i length.
        ].

Or we could use an enumerator:

        var enum := l enumerator.
        while (enum next)
        [
            console write:(enum get).
        ].

And the simplest way would be to use extensions'control helper:

       control run:l forEach: (:ch) [ console write:ch. ].

Sunday, April 12, 2015

ELENA 1.9.19.3 build (win32 / linux32) is out

A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

It includes several critical bug fixes (UTFxEncoder, elc2).

In Linux version new examples are ported : translit, matrix

In Windows version agenda sample is reintroduced (native implementation)

As usually any bug report is welcomed

Thursday, April 9, 2015

ELENA 1.9.19.2 build (win32 / linux32) is out

A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

It includes several critical bug fixes (e.g. LiteralValue.new&length&index&chararray).

In Linux version new examples are ported : binary, bsort, replace, words

As usually any bug report is welcomed

Friday, April 3, 2015

Work in progress : first Linux alpha release

ELENA is finally ported to Linux. The first alpha release is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

From the beginning I planned to implement ELENA on several platforms. But it took a lot of time to actually did this. When I implemented Unicode support I chose UTF-16 because of Windows. But when I started porting to Linux I realize that it gives me actually no advantages, so I switched to UTF-8 and now ELENA internally is 100% UTF-8. UTF-16 is used in Windows version for file and display operations. LiteralValue is UTF-8. For Windows I implemented WideLiteralValue, which is UTF-16 and CharValue is UTF-32.

Currently only console operations are supported but I will move the rest of the code (except GUI) during this month.