GuLang
Ten registers, one at a time, and jumps to the character count of the file.
Tisin (Turk), 2022 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 11 known programs · Test method
Run it
The idea
Tisin made GuLang in 2022. There are no variables and no stack, only ten registers that hold integers. One of them is current, and every instruction works on it. To use another register you select it with a backtick first.
Read the story
A jump goes to an address, the position of a character in the file with the line breaks counted. A program does not write addresses down. It asks for them with = or [, keeps them in registers, and jumps there later.
The machine
A backtick and a digit, as in `4 , make that register current. Everything else works on the current register.
| Instruction | Does |
|---|---|
0 to 9 | Set it to the digit |
+ab -ab *ab /ab %ab | Set it to register a plus, minus, times, divided by or modulo register b |
:c | Set it to the code of the character c |
" ' | Print it as a character or as a number |
# @ | Read a number or a character into it |
= | Set it to the address of the next instruction |
^ | Jump to its value |
|ab | Jump to register a's value if it is 0, else to register b's; a space there goes on |
[ ... ] | Set it to the address after [ and skip the block |
! | Stop |
Spaces, line breaks and ] are skipped.
Example
Hello World needs only : and ".
Hello World needs only : and ". The space is the character after a :.
There are no numbers above 9 to write, so a line break, code 10, is made as 5 times 2.
The example for [ skips a block but keeps its address in register 0. The program sets register 1 to 5 and jumps back into the block, which prints it and stops.
The specification also has a calculator. It stores the address of four blocks in registers 9 to 6, reads a menu choice, and subtracts 1 from it until | finds a 0 and jumps to the block for that choice.
Further
Ideas it shows
See also
Cell-based
Write your own in Run Convert a program from GuLang
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: gulang.
Command line
shib run gulang -e '5'\'''shib manual gulangSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/gulang.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org