A?!

From Esolang
Jump to navigation Jump to search

A?! is a minimalistic esoteric programming language, created by User:Someone else.

Description

Alphanumeric variables can be created that contain boolean values. There are input and output streams, that both operate in ASCII. Input is streamed in little endian, and output is in big endian.

Syntax Function Notes
<variable>! Flips specified variable.
<variable>? Skips next instruction if specified variable is false. Comments don't count as instructions.
<variable>. Sends the value of specified variable to the output stream. Letter is only printed when all 8 bits are specified. The program won't fill in zeroes if 8 bits aren't reached, and will throw an error.
<variable>... Gets one bit from the input stream and puts it in the specified variable. Realtime input is supported. If it's called again after EOF, the program halts.
>>>...> Skips in forward direction the same amount of instructions as there are >. A single >, for instance, would skip only the immediately following instruction line. Counts as one instruction.
<<<...< Moves back an amount of lines equal to the tally of consecutive <. A single <, for example, would return to the line immediately preceding this instruction. > and < can't be mixed together. It wouldn't make sense anyway.

Everything between a # and a newline is a comment. A newline is required after every instruction. Additional newlines are ignored.

Computational class

There is only 62 alphanumeric variable names. And that's including case-sensitivity. Considering that they are all just bits, this language is hardly useful for computation. If we get rid of this limitation, the computational class would be a finite-state automata, because there is no relative addressing, cell values are finite, but flow control is still possible.

Examples

Truth machine

# The variable 'A' stores the bit value zero (0).
A...
A...
# The variable 'B' stores the bit value one (1).
B...
B...
# The variable 'C', through the last input, stores either 0 or 1.
C...
C...
C...
C...

# Print the input as an ASCII character.
A.
A.
B.
B.
A.
A. 
A.
C.

# If the user input was 0, skip the iterative section.
C?
# This instruction, encountered for a 1 input, jumps to the loop.
>
# This instruction, encountered for a 0 input, skips the coming loop.
>>>>>>>>>

# Start of the iterative printing section for an input of 1.
A.
A.
B.
B.
A.
A. 
A.
C.
<<<<<<<<

Infinite loop

>
A! #This instruction will never be executed.
<<

Cat program

A...
B...
C...
D...
E...
F...
G...
H...
A.
B.
C.
D.
E.
F.
G.
H.
<<<<<<<<<<<<<<<<

Increment a single-digit number: (wrap around)

#Input
A...
B...
C...
D...
E...
F...
G...
H...

#Increment
H?
>
>>>>>>>
G?
>
>>>
F?
E!
F!
G!
H!

#Wrap-around
E?
>
>>>>>
G?
>
>>
E!
G!

#Print
A.
B.
C.
D.
E.
F.
G.
H.

See also

Interpreter

  • Common Lisp implementation of the A?! programming language.