Calculator

From Esolang
Jump to navigation Jump to search

Calculator, is an esoteric programming language, where we are doing operations on numbers. Idea of this language was invented by Ivan Homenko.

Examples

Hello, World!

.!;
H.72.v;H.@;
e.101.v;e.@;
l.108.v;l.@;l.@;
o.111.v;o.@;
comma.44.v;comma.@;
space.32.v;space.@;
W.87.v;W.@;
o.111.v;o.@;
r.114.v;r.@;
l.108.v;l.@;
d.100.v;d.@;
!.33.v;!.@;
linefeed.10.v;linefeed.@;

Truth-machine

var.$.v;
var.0.1.!0;
0.?;
0.0.v;
0.#;
.~;
1.?;
1.1.v;
1.#;
1.^;

Cat

in.$.v;in.#;

Docs

Basic instruction syntax it's:

arg1.arg2.'''...'''.command;

End of instruction should be ended by

;
Instruction Desc
a.b.+ Var a += var b
a.b.- Var a -= var b
a.b.* Var a *= var b
a.b./ Var a /= var b
a.b.% Var a %= var b
a.b.v Sets value of var a by value b, but if b is $ symbol, value takes from input
a.b.> Var a = var b
a.# Output var a
a.@ Output var a as ascii
.! Clears output
.~ Stops program
a.^ Jumps to label a
a.b.c.!0 If value of var a == 0, jumps to label b, else jumps to label c
a.b.c.!1 If value of var a == 1, jumps to label b, else jumps to label c
a.b.c.d.!= If value of var a == value of var b, jumps to label c, else jumps to label d
a.b.c.d.!== If value of var a != value of var b, jumps to label c, else jumps to label d

External resources