Opal (programming language)


OPAL is a functional programming language first developed at the Technical University of Berlin.

Example program

This is an example OPAL program, which calculates the GCD recursively.
; Signature file
SIGNATURE GCD
FUN GCD: nat ** nat -> nat
; Implementation file
IMPLEMENTATION GCD
IMPORT Nat COMPLETELY
DEF GCD IF a % b = 0 THEN b
ELSE IF a-b < b THEN GCD
ELSE GCD
FI
FI