EggLanguage

Last edit August 29, 2006
An anonymous language devised by EwDijkstra for the examples in his book A Discipline of Computer Programming. Dijkstra did not implement its language. The term egg refers to a recent Java implementation which is available at http://www.andrewcooke.free-online.co.uk/jara/egg/ .

  • It is a block-structured imperative language in the Algol tradition.

  • It has GuardClauses and guarded command sets. A guarded statement only executes if its accompanying condition (guard) is true. A set of GuardClauses can be written as part of an if or do statement, with the semantics described in GuardClause. These constructs replace all flow-of-control constructs in procedural languages, but are easier to prove correct.

  • Variables are local or global, with special consideration given to uninitialized globals.

  • The only aggregate structure is one-dimensional arrays whose bounds can be adjusted at run time. (Essentially indexible dequeues.)

Here is EuclidOfAlexandria's GCD algorithm, taken from the distribution:

   begin privar X, Y, x, y ;
    X vir int, Y vir int := 12345 * 9876, 12345 * 6789 ;
    if X > 0 and Y > 0 ->
     x vir int, y vir int := X, Y ;
     do x > y -> x := x - y | y > x -> y := y - x od ;
     print( x ) { for 12345 * 9876, 12345 * 6789 answer is 37035 }
    fi
   end 


According to the LanguageList Dijkstra "later (1972) referred to this language as DOVPA (Dijkstra's Own Version of Pidgin Algol)".