update e2c 1

Documentation Version for Comments and Changes

You are invited to make any changes...add any comments.

Changes will `eventually` be merged into the offical documentation.

Leave any commnents here...


... back to index page OE documentation

Euphoria To C Translator


The Euphoria to C Translator (translator) will translate any Euphoria program into equivalent C source code.

There are versions of the translator for Windows and Unix operating Systems. After translating a Euphoria program to C, you can compile and link using one of the supported C compilers. This will give you an executable file that will typically run much faster than if you used the Euphoria interpreter.

The translator can translate and then compile itself into an executable file for each platform. The translator is also used in translating/compiling the front-end portion of the interpreter. The source code for the translator is in euphoria\source. It is written 100% in Euphoria.

Supported Compilers

The Translator currently works with GNU C on Unix OSes, GNU C on Windows from MinGW or Cygwin using the -gcc option and with Watcom C (the default) on Windows. These are all free compilers.

GNU C will exist already on your Unix system. The others can be downloaded from their respective Web sites.


  • Warnings are turned off when compiling directly or with makefiles. If you turn them on, you may see some harmless messages about variables declared but not used, labels defined but not used, function prototypes not declared etc.
  • For the -gcc option on Windows you will need a eu.a compiled with MinGW or Cygwin. The official distribution may only contain eu.lib compiled with Watcom. Also, the -stack and -con options may not produce the expected result with GCC C.
  • Currently, only 32-bit compilers are supported on 64-bit platforms.

Run the Translator

Running the Translator is similar to running the Interpreter:

euc -con allsorts.ex 

Note: that on Unix the demos might be installed to /usr/share/euphoria/demo

Instead of running the allsorts.ex program, the Translator will create several C source files in a temporary build directory, compile them and result in a native executable file. For this to work, you have to have a supporting compiler installed (mentioned above). The optional parameter used in this example, -con, will be explained in full detail below.

When the C compiling and linking is finished, you will have a file called allsorts.exe or simply allsorts on *nix systems. The C source files will have been removed to avoid clutter.

When you run the allsorts executable, it should run the same as if you had typed:

eui allsorts 

to run it with the Interpreter, except that it should run faster, showing reduced times for the various sorting algorithms in euphoria\demo\allsorts.ex.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu