Skip to content

Using command‐line tools

Aleksey Rakov edited this page Apr 15, 2025 · 7 revisions

Compiling with a command-line compiler

elena-cli (for 32 bit) and elena64-cli (for 64 bit) are ELENA compiler tools used to compile and generate an executable.

Windows

Please type app_root\bin\elena-cli and the compiler will display the helper page:

ELENA Command-line compiler 6.6.176 (C)2005-2025 by Aleksey Rakov, ELENA-LANG Org
elena-cli {-key} {source-file+ | project-file}
keys:
   -el{5 | 6}   - specifying grammar compatibility
   -f{fwd=reference}   - add a forward
   -l{profile name}    - select a profile
   -m                  - turning on address mapping output
   -o{0 | 1 | 2}       - set the optimization level
   -p                  - set the base path
   -r                  - clean the compilation output
   -s{ stackReserv:n } - set the linker option - stack reserved
   -t{ template name } - load the project template
   -v                  - turn on a verbose output mode
  - w{ 0 | 1 | 2 | 3 } - set the minimal warnings level to X = { 0 | 1 | 2 | 3 }
   -xb[-]              - turn on / off a conditional boxing
   -xe[-]              - turn on / off a compile-time expression evaluation
   -xj[-]              - turn on / off jump alignment
   -xm[-]              - turn on / off auto loading module extension list
   -xp[-]              - turn on / off generation of the parameter meta info
   -xs[-]              - turn on / off 

To compile the simple program, all you need is to create a source file with l extension:

public program()
{
   Console.writeLine("Hello")   
} 

And compile it:

elena-cli sandbox.l

The output will be:

ELENA Command-line compiler 6.6.176 (C)2005-2025 by Aleksey Rakov, ELENA-LANG Org

Project: sandbox, Platform: Win_x86, Target type: STA Console
Cleaning up
Parsing sandbox.l
Compiling sandbox.
saving sandbox

Successfully compiled
Linking..
Successfully linked

The important information is a platform name - Win_x86 and a target type STA Console.

Win_x86 indicates that 32-bit code will be generated and STA Console means that we are creating a stand-alone single-thread console application.

If we want to have a more complex project, a project file must be created (.prj):

<configuration>
  <platform key="Win_x86">
     <project>
        <executable>translit</executable>
     </project>
  </platform>
  <platform key="Win_x64">
     <project>
        <executable>translit64</executable>
     </project>
  </platform>
  <project>
     <namespace>translit</namespace>
     <template>console</template>
  </project>
  <files>
     <module>
        <include>translit.l</include>
        <include>control.l</include>
     </module>
  </files>
</configuration>

The project file can contain the project for a different target machines. For example this project can be compiled both for 32 bit version (Win_x86) and for 64 bit one (Win_x64).

Here the list of most common settings:

Name Description
project/executable specifies an executable file path
project/namespace specifies the project root namespace
project/template specifies a project type
files/module/include specifies a source file

Project types:

Name Description
lib60 a library (no executable)
console a stand-alone single-thread console application
mt_console a stand-alone multi-thread console application
vm_console a virtual machine single-thread console client
gui a stand-alone single-thread GUI application

Clone this wiki locally