Pluso

From Esolang
Jump to navigation Jump to search

Pluso is an esoteric programming language created by User:Icepy in 2014. This programming language is called pluso because it has two commands: plus and output. The o standing for output, of course. The only data structure in pluso is an accumulator.

Storage

Pluso has a single accumulator, which can hold the integer values 0–26.

The initial value of the accumulator is 1.

Commands

Command Action
p increment the accumulator, modulo 27
o output the value of the accumulator, according to the Pluso charset

The reference implementation ignores any non-command characters in the input file.

Charset

Output uses the Pluso charset:

Value Character ASCII code
0 space 32 0x20
1 uppercase A 65 0x41
2 uppercase B 66 0x42
...
25 uppercase Y 89 0x59
26 uppercase Z 90 0x5A

Examples

Hello world

pppppppo
ppppppppppppppppppppppppo
pppppppoo
pppo
ppppppppppppo
pppppppppppppppppppppppo
pppppppppppppppppppo
pppo
pppppppppppppppppppppo
pppppppppppppppppppo

This will print HELLO WORLD

Implementations

Python

def run(file):
    acc = 65
    file = open(file)
    prgm = file.readlines()
    for line in prgm:
        for cmd in line:
            if cmd == 'p':
                acc += 1
            elif cmd == 'o':
                char = chr(acc)
                print(char, end='')
            if acc == 91:
                acc = 32
            elif acc == 33:
                acc = 65

Ruby

eval'c=1;'+ARGF.read.gsub(/./,'p'=>'c=(c+1)%27;','o'=>'putc c!=0?c+64:32;')