Opal (programming language)

{{About|the functional programming language|the Ruby interpreter|Ruby (programming language)#Alternative implementations}}

{{Use dmy dates|date=June 2022|cs1-dates=y}}

OPAL (OPtimized Applicative Language){{cite web | website=TU-Berlin/opal - Optimized Applicative Language |title=Opal| url=https://github.com/TU-Berlin/opal | access-date=23 September 2023}} is a functional programming language first developed at Technische Universität Berlin.

There is a later framework for static code analysis also called Opal.{{cite web | website=OPAL Project|title=Home page| url=https://www.opal-project.de/ | access-date=25 November 2023}}

Example program

This is an example OPAL program, which calculates the GCD recursively.

; Signature file (declaration)

SIGNATURE GCD

FUN GCD: nat ** nat -> nat

; Implementation file (definition)

IMPLEMENTATION GCD

IMPORT Nat COMPLETELY

DEF GCD(a,b) == IF a % b = 0 THEN b

ELSE IF a-b < b THEN GCD(b,a-b)

ELSE GCD(a-b,b)

FI

FI

References

{{Reflist}}