Calculator fuck

From Esolang
Jump to navigation Jump to search

The Calculator fuck esoteric programming language, designed by User:Esowiki201529A, is based upon the arithmetic manipulation and output of two signed integer variables, agnominated x and y, employing commands of exactly two characters' length.

Data Types

The primary type in currency during a program's application constitutes the unbounded signed integer, stored in the variables and referenced by a preponderance of the available instructions.

Reserved for output situations, the character type, contingently as potent as the Unicode repertoire, responds to a textual perspective on the integer foundation.

Architecture

The complete program memory is defined in terms of its two variables x and y, both signed integers of any magnitude, and admissive to modifications using arithmetic operations, as well as textual display in the form of their corresponding characters.

Destitute of a dedicated input medium, the optional initialization of these variables to a default value other than zero (0) is assigned to the concrete interpreter's efforts.

Syntax

Every Calculator fuck program is composed of zero or more commands, any of which comprehends two characters. The evaluation of the source code proceeds in a very rigid manner, repeatedly consuming a twain of consecutive characters. Upon a correspondence to a command identifier, the same's execution transpires; if, however, no such interpretation can be administered to the compound, the token is regarded as a comment, retaining no effect.

Commands

The language provides twenty-seven operations for the manipulation and printing of its two variables. However, neither input facilities nor conditionals are incorporated.

Command Effect
*+ Increment variable x by one.
+* Increment variable y by one.
*- Decrement variable x by one.
-* Decrement variable y by one.
** Swap the values of the two variables x and y.
$+ Set the value of the variable x to the sum of x + y.
+$ Set the value of the variable y to the sum of x + y.
$- Set the variable x to the difference x - y.
-$ Set the variable y to the difference x - y.
@- Set the variable x to the difference y - x.
-@ Set the variable y to the difference y - x.
!* Negate the value of the variable x.
*! Negate the value of the variable y.
*2 Double the value of the variable x.
2* Double the value of the variable y.
*m Multiply the value of the variable x by the value of y.
m* Multiply the value of the variable y by the value of x.
*g Halve the value of the variable x and round it down: x = floor(x / 2).
g* Halve the value of the variable y and round it down: y = floor(y / 2).
*d Set the variable x to the quotient x / y and round it down: x = floor(x / y).
d* Set the variable y to the quotient x / y and round it down: y = floor(x / y).
*f Set the variable x to the quotient y / x and round it down: x = floor(y / x).
f* Set the variable y to the quotient y / x and round it down: y = floor(y / x).
*p Print the character associated with the variable x in the role of its character code.
p* Print the character associated with the variable y in the role of its character code.
*0 Set the value of the variable x to zero.
0* Set the value of the variable y to zero.

Examples

Hello, World!

This program prints out the words Hello World!:

*++*$++$$++$$++$$++$$+g*g*$-g*$-*+*+*p$+2*2*$+*-*pg*g*$+*+*p*pg*$+*p*g2*2*$-*+*p$-*p*2*2$-g*g*$+*p+*2*$-*pg*$+*-*p2*$-*+*+*p$-*pg*-**d*p*d*-*p

See also

Calculator fuck/HTML Code

Interpreter

  • Common Lisp implementation of the Calculator fuck programming language.