Dumbascii-2
Jump to navigation
Jump to search
Dumbascii-2 is essentially the same as Dumbascii, it just adds two commands and custom file extension.
Language Overview
Dumbascii-2, like Dumbascii, works with outputting ASCII characters, but it uses .dumbascii instead of .txt . Commands:
Command | Description |
---|---|
A
|
Outputs the accumulator as an ASCII character |
-
|
Decrements the accumulator by 1 |
+
|
Increments the accumulator by 1 |
N
|
Outputs the accumulator as number |
v
|
Outputs line feed |
Implementation
Python file-reader
n = 0 filename = input("Enter the code file name: ").strip() try: with open(filename, "r", encoding="utf-8") as f: code = f.read() except FileNotFoundError: print("Error: file not found.") raise SystemExit for c in code: if c == "+": n += 1 elif c == "-": n -= 1 elif c == "A": print(chr(n), end="") elif c == "N": print(n, end="") elif c == "v": print("\n")
Python IDE
for c in code: if c == "+": n += 1 elif c == "-": n -= 1 elif c == "A": print(chr(n), end="") elif c == "N": print(n, end="") elif c == "v": print("\n")
Examples
Output "123"
+N+N+N
Output "1\n2\n3"
+Nv+Nv+N