$!
Jump to navigation
Jump to search
$! is a minimalist esoteric programming language created by User:TheCanon2.
Commands
$! has a single 8-bit cell, xxxxxxxx. $! has 2 commands.
| Command | Action |
|---|---|
| $ | Shift 1 bit to the left |
| ! | Flip the rightmost bit. |
The accumulator is printed as a number at the end of each line.
Examples
Hello, World!
!$$$!$$$ $!$!$$$!$$! $!$$!$!$$ !$!$!$! $$$!$$!$!$$ $!$$$$$ !$$!$$!$!$! !$!$!$!$! !$$!$ !$$!$!$$ $!$$ $$$!
This prints the ASCII values of the characters in 'Hello, World!' since $! has no character output.
XKCD Random Number
!$$
Implementations
The following Python script is an interpreter.
data = 0
code = [""]
while code[len(code)-1] != "eof":
code.append(input('> '))
code.pop(0)
code.pop()
code.append("")
code = '\n'.join(code)
for inst in range(0, len(code)):
if code[inst] == "$":
data *= 2
elif code[inst] == "!":
if data % 2 == 1:
data -= 1
else: data += 1
elif code[inst] == "\n":
print(data)
data = data % 256
This interpreter uses the symbol eof to mark the end of the program.