Upsilon (Archived)

From Esolang
Jump to navigation Jump to search

Upsilon is an esoteric programming language that replaces all values returned from a function with procedure out-parameters.

Overview

Upsilon has constructs named outvars, which are parameters that pass values out of a subroutine, rather than into it.

assign x, 3. [x is the outvar]
print x. [3]

Here, a subroutine named assign utilizes an outvar, and assigns it the value 3. Then, the outvar is printed. You also see comments in the square brackets, and that periods end instructions.

The syntax for creating your own subroutines is straightforward:

square outvar a, b:
	multiply c, b, b. [c := b * b]
	assign a, c. [a := c]
back.

Here, you also see that back, as opposed to return, is used to return to the caller. All subroutines, even for primitive operations, use outvars to return values.

Here is another example:

factorial outvar result, a:
	equal isZero, a, 0.
	subtract x, a, 1.
	if isZero:
		assign result, 1.
	else:
		factorial result, x.
	end.
back.

if: (else:) end is a special form.