+

From Esolang
Jump to navigation Jump to search

+ is HQ9+ with two differences: there are no "H", "Q", or "9" instructions, and all characters that are not + are explicitly ignored.

Instructions

Unlike some languages, + is relatively simple to learn, even for non-programmers. It has only one instruction, +, which increments the program's accumulator. All others are ignored.

Examples

Increment the accumulator once:

+

Increment it five times:

+++++

What a useful language!

Computational class

+ is a push-down automaton, as the + instruction simulates pushing to a stack. The initial state can also be a halt state, and the only state, and a + instruction can loop back to the initial/halt/only state, pushing a value to the stack as it does so.

External resources

There is an interpreter written for + in perl in 60 bytes:

my$r=$ARGV[0];open my$z,'<',$r or die$!;my$c=()=<$z>=~/\+/g;

An interpreter written in XENBLN in 12 bytes (input the program):

$a0ŽIÍ=x„+äa

And another interpreter written for + in Lua, hosted here.