Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Command line compilation

66 views
Skip to first unread message

Jan Pellegrims

unread,
Oct 10, 2012, 9:51:11 AM10/10/12
to
Dear Eiffel enthusiasts,

My task is to develop a website on which students can type Eiffel classes (plain .e-files), click a button and compile what they just have typed.
For that I which to address the command line Eiffel compiler (ec.exe).

How do I execute this compiler so that
- The right class is used as the root class.
- All Eiffel classes in the folder (which are (in-)directly used by that root class are used.
- I can use the precompiled library classes.
- It generates an executable program (ans some other files needed to run that program, like a .melted-file).
- I eventually receive some compiler feedback in case of compilation errors.
- I want the generated files are in the same folder or a subfolder of the original files.
- The size of the project has to be reasonable for download (a simple program, 4 classes generates an .exe + .melted of about 5 Mb).

You can assume that all classes to be compiled are in one directory.


Thank you very much!
Jan

Emmanuel Stapf [ES]

unread,
Oct 10, 2012, 11:28:09 AM10/10/12
to
On 10/10/2012 06:51, Jan Pellegrims wrote:
> Dear Eiffel enthusiasts,
>
> My task is to develop a website on which students can type Eiffel classes (plain .e-files), click a button and compile what they just have typed.
> For that I which to address the command line Eiffel compiler (ec.exe).
>
> How do I execute this compiler so that
> - The right class is used as the root class.

The easiest thing to do is to create an Eiffel Configuration File (.ECF)
which will describe the system:
- Root class and its cluster location
- list all libraries needed
- list all clusters required to compile and find the root class
- other settings.

There is also the ability to compile a system without an ECF and here
you just do `ec my_root_class.e'.

For more details look at:
http://docs.eiffel.com/book/eiffelstudio/eiffelstudio-using-command-line-options#Commands_for_compiling
http://docs.eiffel.com/book/eiffelstudio/eiffelstudio-project-settings-window

> - All Eiffel classes in the folder (which are (in-)directly used by that root class are used.

If they are in the same directory, the above 2 suggestions will find all
the needed classes.

> - I can use the precompiled library classes.

This can be specified in the ECF. If you use the ECF-less strategy, then
the precompiled library of EiffelBase will be used automatically.

> - It generates an executable program (ans some other files needed to run that program, like a .melted-file).

This is the default behavior.

> - I eventually receive some compiler feedback in case of compilation errors.

One just need to parse the output of the compiler.

> - I want the generated files are in the same folder or a subfolder of the original files.

Using the ECF-less strategy, we copy the executable automatically in the
current directory where the project was compiled. Otherwise you have to
create a script that copies the generated files.

> - The size of the project has to be reasonable for download (a simple program, 4 classes generates an .exe + .melted of about 5 Mb).

There are two modes: workbench and finalized. Workbench mode will
generate a large executable, but finalized will generate a smaller
executable. I recommend having them download the finalized version.

Let us know how it goes,
Manu

Jan Pellegrims

unread,
Oct 15, 2012, 10:18:08 AM10/15/12
to
Dear Manu,
thank your for your detailed advice. I have added ec.exe to my path, and I can run ec from any location.

Still, I encounter a fundamental problem. I have made a very simple root class:

class ROOT_CLASS
creation make

feature make is do
io.putstring("test")
io.readline--pauze
end--make
end --ROOT_CLASS

When executing the command ec root_class.e , it gives this compilation error output. It has generated a .ecf-file and a EIFGEN- folder. And this while it compiles normally in EiffelStudio.

Eiffel Compilation Manager
Version 7.1.8.8986 GPL Edition - windows

Degree 6: Examining System
Degree 5: Parsing Classes
-------------------------------------------------

Syntax error at line 4 in class ROOT_CLASS


feature make is do
-----------------^
io.putstring("test")

What could have been wrong? Has the syntax changed over time?

Kind regards,
Jan

Emmanuel Stapf [ES]

unread,
Oct 15, 2012, 11:53:39 AM10/15/12
to
> Degree 6: Examining System
> Degree 5: Parsing Classes
> -------------------------------------------------
>
> Syntax error at line 4 in class ROOT_CLASS
>
>
> feature make is do
> -----------------^
> io.putstring("test")
>
> What could have been wrong? Has the syntax changed over time?

It did. By default when used the command `ec root_class.e' it will use
the latest syntax of Eiffel which has dropped the need to use `is'. If
you have too much code using `is', you can use our `syntax_updater' tool
which is located in $ISE_EIFFEL/tools/spec/$ISE_PLATFORM/bin to upgrade
your code. Once upgraded, you should be able to compile.

The other alternative is to create an Eiffel Configuration File and
specifies that you want to use the old syntax.

Hope this helps,
Manu

Jan Pellegrims

unread,
Oct 16, 2012, 8:32:36 AM10/16/12
to
> Hope this helps,

Dear Manu,

I am able to compile easily. Though, a simple "Hello World" compilation with
ec -stop -finalize ROOT_CLASS.e
results in 35 seconds of compilation time (on a 4 year old system). It generates 12Mb of data, of which the .exe is 1.25 Mb (acceptable size).

Is there a way to speed up the compilation?

Thank you for your help.
Jan

Emmanuel Stapf [ES]

unread,
Oct 16, 2012, 1:49:32 PM10/16/12
to
> I am able to compile easily. Though, a simple "Hello World" compilation with
> ec -stop -finalize ROOT_CLASS.e
> results in 35 seconds of compilation time (on a 4 year old system). It generates 12Mb of data, of which the .exe is 1.25 Mb (acceptable size).
>
> Is there a way to speed up the compilation?

Our compilation process is incremental, the first time it takes longer.
The second time, it is shorter, almost proportional to the amount of
changes you made compared to the size of your system.

However the process of finalization (degree -2 and degree -3) which you
are using is never incremental and we perform the whole optimizations.

For development purpose you should simply use:

ec ROOT_CLASS.e

and the second time it should take no time at all. The executable size
in that mode is larger to accommodate incremental changes and our mixed
of interpreted code and compiled code.

You can use the -verbose options to see more of what is being compiled.

Regards,
Manu

0 new messages