Programming in ELENA

Alex Rakov edited this page May 31, 2018 · 11 revisions

In this tutorial we will learn how to program in ELENA. Let's start!

Hello World -- Your First Program

We will create our first console application and learn how to print to the program console.

Let's start ELENA IDE (elide.exe in BIN sub folder)

To create our first program select: File - New - Project. In the open dialog we have to select: Project typeconsole; Namespaceexample1; Target file nameexample1 and press OK.

Next let’s create a source file: File – New – Source File

Before continue we have to save it: File – Save All (IDE will ask if the new module should be included into the project – press Yes).

We're halfway there.

Now type the following:

// A Hello World! program in ELENA.
public program =
    system'console writeLine("Hello World").

That's it. Now we can run it: Debug – Run.

The output will be:

Hello World

Let's review our program:


The first line is a comment. The characters // convert the rest of the line to a comment.

Note: ELENA uses C-style comments as well: /*My comment block*/

Program entry point

To define our program entry point we have to create a code block with a public name program in the root namespace.

Note: square brackets define the code block (a closure without input parameters)

The program symbol will be executed on start up.

Note: Any exception raised in it will be caught automatically

Sending a message

Everything in ELENA is an object. To interact with it we have to send a message. The simplest (weak, i.e. without an explicit signature) message consists of an action and a parameter list.

The statement should be terminated by a dot.

In our example the action is writeLine and the parameter list consists of a single literal constant. The message target is system'console symbol (implementing input / output operations with a program console).


Any ELENA program or library consists of modules ( files with .NL extension ) containing classes and symbols. Every member of the module is referred by its fully qualified name which consists of namespace and a proper name separated by an apostrophe. The namespace itself may contain sub elements separated by apostrophes.

system'console refers to the symbol console declared in system module

Note: All source files (files with .L extension) located in the same folder are compiled into the corresponding module. A project file ( a file with .PRJ extension ) defines the root namespace and the output type (stand-alone executable, VM executable or a library). The project may produce several modules if it contains the files located in sub folders (the new module namespace consists of the root one and the folder relative path is split by apostrophes).

Literal constant

A literal string consists of zero or more characters enclosed in double quotes.

Note: ELENA supports both UTF8 and UTF16 literal constants

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.