Lisaac

Lisaac
Paradigm object-oriented prototype-based
Designed by Benoît Sonntag
Developer Benoît Sonntag & Jérôme Boutet
First appeared 2003
Stable release 0.13.1 (specification) / 17 February 2008
Typing discipline static typing
Website http://www.lisaac.org
Major implementations
Lisaac
Influenced by
Smalltalk, Self, Eiffel

Lisaac is the first compiled object-oriented language based on Prototype-based programming|prototype concepts. The ideas in Lisaac are mostly inspired by Smalltalk (all values are objects), Self (prototype-based side) and Eiffel (design by contract). Although it stands as a Self's successor, it distinguishes itself in many ways, essentially because of system-programming constraints. Lisaac allows low-level programming but remains a high-level language. Its powerful compiler uses original compilation techniques for late binding suppression and optimisations of type predictions and code specialisation. This compiler gives the target code an efficiency that no other languages of the same type has matched so far.

Features

  • Was originally developed to implement the Isaac operating system
  • Supports interruptions and device memory mapping
  • Lisaac compiler generates optimized portable ANSI C code
  • Performs nearly as fast as native C code[1][2]
  • Although Lisaac is strongly typed, there is no distinction between data and code
  • Despite being compiled, all objects retain their dynamic abilities

Basic syntax

Lisaac is case sensitive. Keywords are capitalized (Section, Header, Public, …), type identifiers are written in upper case letters (INTEGER, BOOLEAN, OBJECT, …), and identifiers denoting variables and slots are written in lower case letters. Objects are composed of slots, which can be data or code. The ':' symbol is used to declare types. Slot names are prefixed with a '+' or '-' symbol to indicate whether the slot is local to an object or shared between objects.

Parentheses are used to delimit lists of semicolon separated statements. Statement lists may have zero, one or more return values. The ':=' symbol is used to bind a slot to a statement or statement list that is executed at the loading/initialization of an object. The '<-' symbol is used to bind a slot to a statement list that is executed on the call of the slot.

Code samples

«Hello, World» program

 Section Header 
    + name := HELLO_WORLD; Section Public 
    - main <- 
    (
        "Hello world\n".print;
    );

Dynamic inheritance

The parent of each object is just a slot that can be assigned as required in the code, for instance:

 Section Header
    - NAME := DECOD_MPEG2_TO_SCREEN; Section Inherit
    - videoparent : OBJECT <- 
    ( 
        + result : OBJECT;
        typ
        .when 1 then { result := WINDOW;}
        .when 2 then { result := VIDEO_VGA;}
        .when 3 then { result := VIDEO_TVOUT;};
        result
    ) Section Public
    - typ : INTEGER; 
    - decode_stream <- 
    (
        putimage decode_to_bitmap;
    )

Operator redefining

In Lisaac, an operator is a slot and can be redefined. For example overloading the + operator for a NUMERIC object:

    - '+' Left 80 other:SELF :SELF <- Self - -other;

Or for a matrix:

    - '+' Left 80 other:SELF :SELF <-
    (
        + result : SELF; 
        result := SELF.create count; 
        1.to tab.count do {
            i : INTEGER;
            result.put (item i+other.item i) to i; 
        }; 
        result
    )

Genericity

Generic objects are supported, for instance:

 ARRAY[E], DICTIONARY[KEY, VALUE]

Contract programming

Contract programming using Z notation is provided.

References

Cite error: Invalid <references> tag; parameter "group" is allowed only.

Use <references />, or <references group="..." />

External links

  1. Lisaac
  2. bmstu.wiki
    1. "Isaac project benchmarks". Archived from the original on 2007-11-12. Retrieved 2007-07-24. 
    2. "Computer Language Benchmarks Game". Archived from the original on 2012-03-19. Retrieved 2008-07-08. 
    Read in another language