Eve Drivers

A driver is the main script of an application and its entry point. This page describes what a driver is and how it runs. The shape that all scripts share is on the Scripts page.

Drivers

A driver represents the application main script. It has the role to lead the application main process. When driver execution is over the application give control back to the EVE virtual machine. If no other process is running, the machine shuts-down after it clean-up the memory.

Notes:

  • Any application can have one or more drivers,
  • A driver is the process entry point,
  • A driver can read configuration files at startup,
  • The main process of a driver can receive parameters;
  • A driver has exactly one process, main: it is the master of the application and applies its aspects one after the other;
  • A driver is independent, can not be imported;
  • A driver is the only script that defines global states;

Driver Execution

When a driver is executed, all its components are compiled in memory, then the main process is executed. An aspect runs its process main when the driver applies it; it can also be loaded from the planned REPL to apply it or call a function, for testing purpose.

The console REPL (parse, debug and execute a script step by step) and the daemon mode are planned for a later version. They describe the tool, not the language, so they are documented in the manual of the implementation: manual/usage.md in the eve-lang repository.

Example: a driver applies an aspect

The aspect is in its own file, print_this.eve. The driver is the only script that is run; it decides when the aspect runs and what it receives.


# the aspect: it receives a parameter and prints it
exclusive aspect print_this is
  process main(p: String) is
    print p;
  return;
end print_this;

# the driver: the entry point of the application
driver greeting is
  process main is
    apply print_this("Hello");        ** serial mode: the driver waits
    apply print_this("Goodbye");
  return;
end greeting;

A driver can not be applied or imported: it is the top of the application, and nothing calls it.


Read next: Aspects