C Plus Minus Plus Minus

From Esolang
Jump to navigation Jump to search

C±±

An esoteric language created by User:SoYouWantMeToDoSomethingButIWont that has only 1 operation: NAND

Syntax

The program is divided into "functions" that are denoted like so:

name { code }

The language automatically calculated needed amount of arguments. An expression can be one of the following:

Name Syntax Info Meaning
NAND Gate
'.' a b
a and b are expressions Calculates NAND of a and b
Argument
x
x is a lower-case english letter Becomes a value passed to the function.
Operation
o a...
o is a punctuation symbol, a... are N expressions that o requires Calls the function with N arguments
Assignment
'=' K v
K is a upper-case english letter and v is an expression Creates a local binding
Binding
X
X is an upper-case english letter Value of a local binding
Chain
a ';' b
a and b are expressions Calculates both, but returns the latter
Tuple
a ',' b
a and b are expressions Creates a tuple of a and b
Selector
n a
n is an integer and a is an expression Returns the nth element of tuple a

Comments span from // to the end of a line

Program

At the start, the last function defined is called and the user is prompted with the arguments required to calculate the function and then the result is outputted.

Example

~{.aa} // Not
&{~.ab} // And
|{.~a~b} // Or
^{..a~a.b~b} // Xor
/{&ab,^ab} // Half-Adder
+{=C/ab;=D/0Cc;0D,|1D1C} // Full 1-bit Adder

TODO

Implementations

Currently, there are none.