EEL (Extensible Embeddable Language)
Encyclopedia
The Extensible Embeddable Language (EEL) is a scripting and programming language in development by David Olofson. EEL is intended for scripting in real time systems with cycle rates in the kHz range, such as musical synthesizers and industrial control systems, but also aspires to be usable as a platform independent general purpose programming language.

Philosophy

As to the language design, the general idea is to strike a practical balance between power, ease of use and safety. The intention is to help avoiding many typical programming mistakes without resorting to overly wordy syntax or restricted functionality.

History

The first incarnation of EEL was in the form of a simple parser for structured audio definitions, used in the sound engine of the Free/Open Source game Kobo Deluxe, an SDL
Simple DirectMedia Layer
Simple DirectMedia Layer is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices....

 port of the X11
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

 game XKobo. This was a simple interpreter with very limited flow control, and a syntax that's quite different from that of current versions. This initial branch of EEL was first released in 2002, and is still used in Kobo Deluxe as of version 0.5.1.

In December 2003, EEL was split off into a stand-alone project and subject to a major rewrite, in order to be used for real time scripting in an embedded
Embedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...

 rheology
Rheology
Rheology is the study of the flow of matter, primarily in the liquid state, but also as 'soft solids' or solids under conditions in which they respond with plastic flow rather than deforming elastically in response to an applied force....

 application. This is where the switch from interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

 to compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

/VM
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 was made, and the actual programming language EEL materialized. The first official release was in January 2005. Since then, EEL has evolved slowly, driven mostly by the personal and professional needs of its author.

General

The language is not strictly designed for any particular programming paradigm
Programming paradigm
A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation A programming paradigm is a fundamental style of computer programming. (Compare with a...

, but supports object oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, or more specifically, prototype-based programming
Prototype-based programming
Prototype-based programming is a style of object-oriented programming in which classes are not present, and behavior reuse is performed via a process of cloning existing objects that serve as prototypes. This model can also be known as classless, prototype-oriented or instance-based programming...

, through a minimal set of syntax sugar features. Other paradigms, such as functional
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

, modular
Modular programming
Modular programming is a software design technique that increases the extent to which software is composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish...

 and metaprogramming
Metaprogramming
Metaprogramming is the writing of computer programs that write or manipulate other programs as their data, or that do part of the work at compile time that would otherwise be done at runtime...

 are also supported.

As a result of avoiding pointers and providing fully managed structured data types, EEL is "safe" in the sense that EEL programs should not be able to crash the virtual machine or the host application.

Highlights

  • C-like syntax.
  • Opaque references
    Reference (computer science)
    In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...

     (as opposed to raw pointers).
  • Dynamic typing.
  • Automatic memory management.
  • Exception handling.
  • Built-in structured data types, such as:
    • string - immutable string
      String (computer science)
      In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

      .
    • dstring - dynamic string
      String (computer science)
      In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

      .
    • vector - fixed type numeric array
      Array data type
      In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array...

      .
    • array - array
      Array data type
      In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array...

       of dynamically typed elements.
    • table - associative array
      Associative array
      In computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....

      .

Example code

The classic hello world program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 can be written as follows:

export function main
{
print("Hello, world!\n");
return 0;
}

The following is an example of a recursive
Recursion
Recursion is the process of repeating items in a self-similar way. For instance, when the surfaces of two mirrors are exactly parallel with each other the nested images that occur are a form of infinite recursion. The term has a variety of meanings specific to a variety of disciplines ranging from...

 function:

export function main
{
print("Recursion test 1:\n");

procedure recurse(arg)
{
print("arg = ", arg, "\n");
if arg
recurse(arg - 1);
}

recurse(10);

print("Recursion test 2; Mutual Recursion:\n");

procedure mrecurse2(arg);

procedure mrecurse1(arg)
{
print("arg = ", arg, "\n");
if arg
mrecurse2(arg);
}

procedure mrecurse2(arg)
{
mrecurse1(arg - 1);
};

mrecurse1(10);

print("Recursion test 2; Mutual Recursion with Function Reference:\n");

procedure mrrecurse1(arg, fn)
{
print("arg = ", arg, "\n");
if arg
fn(arg, fn);
}

local mrr2 = procedure (arg, fn)
{
mrrecurse1(arg - 1, fn);
};

mrrecurse1(10, mrr2);

print(Recursion tests done.\n);
return 0;
}

Internals

EEL source code is compiled into bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...

 for a custom VM
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

, which has a relatively high level instruction set designed to minimize instruction count and thus overhead. The EEL VM is register based
Register machine
In mathematical logic and theoretical computer science a register machine is a generic class of abstract machines used in a manner similar to a Turing machine...

 and "stackless", as in not relying on the C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 call stack
Call stack
In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack"...

for managing VM contexts.

The basic memory management method is reference counting, which allows automatic memory management with deterministic timing, without the need for concurrent garbage collection.

The VM uses "limbo lists" to keep track of intermediate objects created inside expressions and the like, which greatly simplifies exception handling, and eliminates the need for active reference counting in every single operation.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK