Amiga E

From Bauman National Library
This page was last modified on 21 May 2016, at 23:48.
Amiga E
Paradigm procedural, object-oriented
Designed by Wouter van Oortmerssen
First appeared 1993
Typing discipline weak, dynamic
OS AmigaOS, Windows
Website Amiga E

Amiga E ( or E) - a programming language created by Wouter van Oortmerssen on the Amiga. He has since moved on to develop the SHEEP for the new AmigaDE platform and the CryScript language (also known as DOG) used during the development of Far Cry.

Amiga E is a combination of many features from a number of languages, but follows the original C programming language most closely in terms of basic concepts. Amiga E's main benefits are fast compilation, powerful module system , exception handling, readable source code, flexible type system and Object oriented programming


1993: The first public release of Amiga E.

1997: The last version of Amiga E is released (3.3a).

1999: Unlimited compiler executable of Amiga E is released.

1999: Source code of the Amiga E compiler in M68K assembler is released under the GPL.

1999: First version of CreativE is released. Based on Sourcecode of Amiga E.

1999: First version of PowerD is released. (0.01)

2000: First version of YAEC (Yet Another E Compiler) is released. (1.0)2001: Final version of CreativE (2.12.3) is released.

2002: Final version of YAEC is released (2.5d).

2002: First public release of ECX. (1.0)

2003: Final version of PowerD is released. (0.20)

2008: First public release of PortablE. (r1)

2009: First public release of PortablE for Microsoft Windows. (r4)


Data types

E doesn't have a rigid type-system. There is only one basic, non-complex variable type: 32bit type LONG. A special variation of LONG is the PTR type. Defining the variable:

    DEF <var>[:<type>]

The simple types CHAR (8bit) and INT (16bit) may not be used as types for a basic (single) variable. However they may be used as data type to build ARRAYs from, set PTRs to, use in the definition of OBJECTs etc.

ARRAYs are declared by specifying their length (in elements):

    DEF <var><[size]>:ARRAY [OF <type>]

STRINGs similar to arrays, but different in the respect that they may only be changed by using E string functions, and that they contain length and maxlength information, so string functions may alter them in a safe fashion, i.e: the string can never grow bigger than the memory area it is in. LIST is data structure holds a list of LONG variables which may be extended and shortened like STRINGs.


    OBJECT <objname> [OF <objname>]
        <membername> [ : <type> ]           /* any number of these */

OF used for object inheritance. PRIVATE and PUBLIC let you declare a section of an object as visible to the outer world or not.

List of supported data formats:

  • decimal (1)
  • hexadecimal ($F1)
  • binary (%011)
  • float (1.0)
  • character ("a")
  • string ('bla')
  • list ([1,2,3]) and typed lists
  • lisp-cell (<a|b>)


  • math (+ - * /)
  • comparison (= <> > < >= <=)
  • logical and bitwise (AND OR)
  • unary (SIZEOF ` ^ {} ++ -- -)

++ and -- increase and decrease value SIZEOF returns the size of a object {} returns address of a variable ^ access variable by address ` blocks evaluating

  • triple (IF THEN ELSE)
  • structure (.) - access field of object
  • array ([]) - access array element by index
  • float operator (!) - converts between float and integer
  • assignments expressions (:=)
  • sequencing (BUT) - allows two expressions to be written in a construction that allows for only one. Returns value of the second expression
  • dynamic memory allocation (NEW)
  • unification (<=>) - tries to bind variables in right expression to value to make them equal
  • pointer typing (::) - changes type of pointer


A statement generally stands in its own line, but several of them may be put together on one line by separating them with semicolon, or one may be spread over more than one line by ending each line in a comma ",".

Labels are global-scoped identifiers with a ':' added to them. JUMP <label> continues execution at <label>.

Conditional statement:

    IF <exp>
    [ ELSEIF <exp>           /* multiple elseifs may occur */
        <statements> ]
    [ ELSE ]


    FOR <var> := <exp> TO <exp> STEP <step> DO <statement>


    FOR <var> := <exp> TO <exp> STEP <step>


    WHILE <exp> DO <statement>


    WHILE <exp>


    UNTIL <exp>

Loop-statement (infinite)



    SELECT <var>
    [ CASE <exp>
        <statements> ]
    [ CASE <exp>
        <statements> ]   /* any number of these blocks */
        <statements> ]

Increase statement (does not return value)

    INC <var>
    DEC <var>

Void expressions (calculate expression without returning result)

    VOID <exp>

Memory deallocation

    END <var>


PROC used to collect statements into your own functions.

    PROC <label> ( <args> , ... ) [OF <object>]
    ENDPROC <returnvalue>, ...


     PROC <label> ( <args> , ... ) [OF <object>] IS <returnvalue>, ...

The [OF <object>] tells the compiler it belongs to the object.


Hello world

    PROC main()
        WriteF('Hello, World!\n')

Towers of Hanoi

    PROC move(n, from, to, via)
        IF n > 0
            move(n-1, from, via, to)
            WriteF('Move disk from pole \d to pole \d\n', from, to)
            move(n-1, via, to, from)
    ENDPROC    PROC main()
        move(4, 1,2,3)

Using objects

    OBJECT a_class
        varA, varP
    ENDOBJECT    -> constructor
    PROC init() OF a_class
        self.varP := 10
    self.varA := 2
    ENDPROC    -> destructor
    PROC end() OF a_class
        -> nothing todo here...
    ENDPROC    -> a not so useful getter
    PROC getP() OF a_class IS self.varP    PROC main()
        DEF obj : PTR TO a_class
        NEW obj.init()
        WriteF('\d\n', obj.varA)   
        WriteF('\d\n', obj.varP) 
        WriteF('\d\n', obj.getP())
        END obj