80 likes | 541 Views
Algol 68. Third language in the Algol Language Family An extension to Algol 60's capabilities Code blocks Variable Scopes Algol 68 was known for its orthogonality The goal was to develop a language with few language restrictions. Intended to make the language easier to learn. Algol 68.
E N D
Algol 68 • Third language in the Algol Language Family • An extension to Algol 60's capabilities • Code blocks • Variable Scopes • Algol 68 was known for its orthogonality • The goal was to develop a language with few language restrictions. • Intended to make the language easier to learn
Algol 68 • Algol 68 Basic Features • Common Language Services: IF ... THEN ... [ELSE,ELSE-IF], WHILE, DO ... WHILE, FOR ... NEXT • Procedural Abstraction: Can define new procedures and functions for generalizing tasks. • Dynamic Arrays: Arrays, of any type, can shrink and grow dynamically. This is also called “flex arrays”. Arrays can be of any dimensions. • Array Slicing: Using special syntax, new arrays can be created from old arrays.
Algol 68 • Algol 68 Basic Features • Operator Definition And Overloading: Users can create new operators, overload existing operators using user types and change the priority of operators. • Highly Orthogonal. Examples: • 3 * (a := c + 4) + 2 ; • X := IF a < 2 THEN 3.2 ELSE 5.2 FI ; • IF a < 2 x THEN y FI := 3.5 ; • Strong Type Checking • Users can use system-provided modes or can define new modes through new structures or unions.
Algol 68 • Algol 68 Basic Features • Support for call-by-value as well as call-by-reference. • All procedures defined are values, with their names as values: Can use Algol 68 for some functional programming. • Algol 68 Library Support • I/O facilities provided through architecture-independent “transput” (unlike what was provided with Algol 68.) • Current implementations provide support for scientific code libraries.
Algol 68 • Examples: PROC factorial = (INT x)INT: BEGIN (x = 1 OR x = 0|x|x * factorial(x-1)) END; PROC map and print = ([]INT x, PROC (INT)INT proc)VOID: BEGIN FOR i FROM LWB x TO UPB x DO print(proc(x[i]) OD; END
Algol 68 • More Examples of Orthogonality: REF INT size = LOC INT; read(size); REF[]INT a = LOC[1:size]INT could also be done as: REF[]INT r = LOC[1:(REF INT i=LOC INT; read(i);i)]INT