Division

From Esolang
Jump to navigation Jump to search

Division is a stupid language created by User:None1.

Syntax

Any valid program in Division looks like this:

a/b

a and b are non-negative decimal numbers.

Any invalid program raises a syntax error:

Syntax error

For a valid program, if b is 0, it raises an error:

You can't divide by zero!

Otherwise, it raises an error:

I'll raise an error because you don't want me to!

For any program, Division will always raise an error.

Example Programs

Division by Zero

1/0

Quine

Syntax error

Interpreter

Python

a=input().split("/")
if len(a) != 2:
    print("Syntax error")
else:
    try:
        b,c=int(a[0]),int(a[1])
    except:
        print("Syntax error")
    else:
        if b<0 or c<0:
            print("Syntax error")
        elif b==0:
            print("You can't divide by zero!")
        else:
            print("I'll raise an error because you don't want me to!")

Another Python Interpreter

a=input().split("/")
if len(a) != 2:
    raise SyntaxError
else:
    try:
        b,c=int(a[0]),int(a[1])
    except:
        raise SyntaxError
    else:
        if b<0 or c<0:
            raise SyntaxError
        elif b==0:
            raise ZeroDivisionError("You can't divide by 0!")
        else:
            raise SyntaxError("I'll raise an error because you don't want me to!")