!/*

From Esolang
Jump to navigation Jump to search
!/*
Paradigm(s) Imperative
Designed by User:TenBillionPlusOne
Appeared in Made in 2023, published in 2025
Computational class total
Major implementations below
File extension(s) .islst

!/* or islst is a total language that is Category:Unusable_for_programming. It has three numeric operations: incrementation, division by two and multiplication by three.

Memory

It has one floating-point accumulator, sometimes referred to as x. Digit is a natural number from 1 to 3.

Instructions

Each instruction can be an initial, a command or an operand:

Caption text
Symbol Initial Command Operand
! Set x to 1. Increment x. A + B
/ Set x to 2. Divide x by 2. A / B
* Set x to 3. Multiply x by 3. A * B
^ Set x to a digit from input. Set x to x X digit from input. -
? Set x to a random digit. Set x to x X random number. -
_ - Remove the fractional part of x. -
& - Print x as a number. -
$ - Print x as an ASCII character. -

( X is the next instruction, which is treated as operand. )

An instruction is an initial if it's the first instruction of the code. It initializes the value of the accumulator. An instruction is an operand if it's immediately after ^ or ?. It isn't executed.

Error handling

!/* is very strict when it comes to error handling. Every error is displayed as CRITICAL ERROR.

In the following cases the program reports an error:

  • Non-instruction non-whitespace character found.
  • Unallowed initial found.
  • Unallowed operand found.
  • No operand found.
  • The program is empty.
  • A character is printed when x mod 1 ≠ 0.
  • A character is printed when x > 255.
  • Something other than 1, 2 or 3 is written into input.

Examples

Hello world

*****//++++++++++++_$
**///+++++++++++++++++++_$
+++++++$$
+++$
*///+++_$
/++++++++++$
***///+++++++++++_$
*//++++++++++++++++++++++_$
+++$
*//+++++++++++++++++++++++_$
***/////+++++++++_$
//++++++++_$

Without whitespace:

*****//++++++++++++_$**///+++++++++++++++++++_$+++++++$$+++$*///+++_$/++++++++++$***///+++++++++++_$*//++++++++++++++++++++++_$+++$*//+++++++++++++++++++++++_$***/////+++++++++_$//++++++++_$

Quine

CRITICAL ERROR

Cat program

^&

Works only if the input is 1, 2 or 3.

Implementation

Interpreter in Python:

from random import randint

def err():
    print('CRITICAL ERROR')
    exit(1)
def rnd(): return randint(1,3)

def inp():
    try: digit = input()[0]
    except: err()
    if digit not in '123': err()
    return digit

def op(acc,i,n):
    global program
    cmd = program[i+1]
    program[i+1] = ' '
    if cmd == '!': return acc+n
    elif cmd == '/': return acc/n
    elif cmd == '*': return acc*n
    err()
program = input('>> ')

try: init = program[0]
except IndexError: err()

if init == '!': acc = 1
elif init == '/': acc = 2
elif init == '*': acc = 3
elif init == '^': acc = inp()
elif init == '?': acc = rnd() 
else: err()

i=0
while i<len(program):
    if cmd == '!': acc += 1
    elif cmd == '/': acc /= 2
    elif cmd == '*': acc *= 3
    elif cmd == '^': acc = op(acc,i,inp())
    elif cmd == '?': acc = op(acc,i,rnd())
    elif cmd == '_': acc = int(acc)
    elif cmd == '&': print(acc)
    elif cmd == '$':
        if acc != int(acc) or acc > 255: err()
        print(chr(acc),end='')
    elif cmd in ' \n': pass
    else: err()
    i += 1