A IS B

From Esolang
Jump to navigation Jump to search
A IS B
Paradigm(s) imperative
Designed by Gilbert189
Appeared in 2021
Type system weak
Memory system variable-based
Dimensions one-dimensional
Computational class Turing complete
Reference implementation Unimplemented
Influenced by Set
File extension(s) no standard ending

A IS B is a derivative of Set, but with a different, more natural syntax.

Set vs. A IS B

The difference between Set and A IS B is like stated, the syntax. You can say it resembles a certain block-puzzle game.

Instead of:

set a b

you use:

AA IS BB

Natural, isn't it?

Also, unlike Set, you're not setting things, you reference things. For example:

AA IS 2    > set AA to 2
BB IS AA   > reference BB as AA
BB IS 3    > set BB to 3
> AA is 3

The same thing applies backwards.

Variables that don't exist or referenced to nothing will have a value of null.

Should you use A IS B instead of Set? I don't know, both of them are pretty pointless.

Variables

A IS B supports 8353082550 variables. Variables in A IS B can be at most 7 characters long, at least 2 characters long, and are strictly uppercase only. One-character "variables" are literals. There's also some system variables. Unlike regular variables, system variables (and literals) are not reference-able; variables that read or set it will not be affected by it.

TERM variable

TERM indicates input/output. It works exactly the same as the ! in Set.

LINE variable

LINE represent the line of code which is being executed. It works exactly the same as the ? in Set.

AND combiner

AND has 2 functions:

If used after IS, it will combine/add things:

AA IS BB AND 2  > AA is BB plus 2

Note that AA is still referenced with BB (self reference sets the variable, not reference it to itself, that would be very weird).

For example:

AA IS 3
BB IS AA AND 2
AA IS 5
> BB is 7 (AA plus 2)

The same thing applies backwards.

If used before IS, it will apply the reference to both objects:

AA AND BB IS CC > AA IS CC and BB IS CC but AA IS NOT BB

IF...THEN conditional

It's pretty obvious.

Example:

AA IS 1
IF AA IS 0 THEN AA IS 2      > If AA equals 0, then set AA to 2
IF AA IS NOT 0 THEN AA IS 3  > If AA is not equal to 0, then set AA to 3
> AA IS 3

NOT negation

NOT has 3 functions:

If used before variables, it will reference every variable but the variable being NOTed.

AA IS 1
BB IS 2
NOT AA IS 3 
> BB is 3, AA is still 1

If used after IS, it will set a flag such that if the variable equals the flag, it will raise an error.

AA IS 1
AA IS NOT 3 > AA should not be 3
AA IS 3     > error, since AA should not be 3

It may also be used inside IF...THEN. In this case, it equals to [.../...] in Set.

If used after IS and before variables before IS, it will de-reference that variable to every variable.

AA IS 1
AA IS NOT AA > AA is de-referenced

If used after AND (right side), it will negate instead of adding.

AA IS 5
AA IS BB AND NOT 3 
> AA IS 2

Computational class

Any 2-counter Minsky machine can be translated into an equivalent A IS B program. AND 1 as well as AND NOT 1 perform increment and decrement, respectively, with IF ... THEN statements that alter the LINE variable used to perform conditional control depending on decrement. Assuming variables are unbounded as in Set, any Minsky machine can be expressed as an A IS B program.

Example Codes

Hello, world!

TERM IS H
TERM IS e
TERM IS l
TERM IS l
TERM IS o
TERM IS ,
TERM IS 32
TERM IS w
TERM IS o
TERM IS r
TERM IS l
TERM IS d
TERM IS 33

Truth machine

INPUT IS TERM
IF INPUT IS NOT 48 THEN LINE IS 5
TERM IS 49
LINE IS 3
TERM IS 48