GuLang

GuLang is an esoteric programming language invented by User:Turk (usually known as Camroku, Katroku or Arnolxu) in 2022.
== Overview ==
Some things to know about:
* In GuLang, there's no such thing as 'variable' or 'stack', but registers. There are 10 registers that can have a value in GuLang, and their values are integers.
* To set value of a register, you have to select it. The selected register is usually referred to as the current register. The current register is 0 when the program starts.
* To start running a code in another section of the program, you need to know its address, which means its position in the file including the newline characters.
* In the instructions table below, a, b and other characters are the arguments of that instruction, which should be replaced with a value.
== Instructions ==
Some aliases to make this table shorter:
* crv = current register's value
* int = integer
* char = character
* reg = register
Instruction	Description 	Example 	Example Description
0 - 9 	Set crv to that number. 	3 	Set crv to 3.
`a 	Set current reg to a. 	`4 	Set current reg to 4.
+ab 	Set crv to reg a's value + reg b's value. 	+12 	Set crv to reg 1's value + reg 2's value.
-ab 	Set crv to reg a's value - reg b's value. 	-12 	Set crv to reg 1's value - reg 2's value.
*ab 	Set crv to reg a's value * reg b's value. 	*12 	Set crv to reg 1's value * reg 2's value.
/ab 	Set crv to reg a's value / reg b's value. 	/12 	Set crv to reg 1's value / reg 2's value.
%ab 	Set crv to reg a's value % reg b's value. 	%12 	Set crv to reg 1's value % reg 2's value.
" 	Print crv as a char. 	`15`22`0*12" 	Set reg 1 to 5, set reg 2 to 2, set reg 0 to reg 1 * reg 2, print crv as a char (prints a newline)
' 	Print crv as an int. 	5' 	Set crv to 5, print it as an int.
:a 	Set crv to a's ASCII value. 	:G" 	Set crv to G's ASCII value (71), print it as an char.
# 	Set crv to int input. 	#" 	Get int input and print it as a char.
@ 	Set crv to char input. 	@' 	Get char input and print it as an int.
= 	Set crv to next instruction's address. 	=' 	Get next instruction's address and print it as an int. (In a single file without any other code, this'll be 1)
^ 	Set current address to crv. 	=^ 	A loop that continously sets current address to 1.
! 	Exit with code 0. 	! 	Exit with code 0.
ab 	If crv is 0 jump to code at reg a's value, else jump to code at b. Skip if the variable is empty.	An example for this would be too long, check the test.gul file in src directory in the original interpreter's repository	None
[ 	Set crv to next instruction's address and skip until you find ] 	[`1'!]`15`0^ 	Set crv to 0, skip until ], set current reg to 1, set crv to 5, set current reg to 0, jump to address 1, set current reg to 1, print crv as int, exit.
] 	Skipped 	] 	Nothing
any space 	Skipped 	None 	Nothing
== Examples ==
=== Hello, World! ===
 :H":e":l":l":o":,": ":W":o":r":l":d":!"
=== Calculator ===
 `0:G":u":L": ":C":a":l":c":u":l":a":t":o":r"
 `05`12`2*01"
 `05`12`2*01"
 `0:1":+": ":2":-": ":3":*": ":4":/"`05`12`2*01"
 `9[`0:n":u":m"::": "`1#`0:n":u":m"::": "`2#`3+12'`05`12`2*01"!]
 `8[`0:n":u":m"::": "`1#`0:n":u":m"::": "`2#`3-12'`05`12`2*01"!]
 `7[`0:n":u":m"::": "`1#`0:n":u":m"::": "`2#`3*12'`05`12`2*01"!]
 `6[`0:n":u":m"::": "`1#`0:n":u":m"::": "`2#`3/12'`05`12`2*01"!]
 `0#`11`0-01|9 -01|8 -01|7 -01|6 `0:e":r":r"`05`12`2*01"!
== External resources ==
* The Original Interpreter written by User:Turk
* GuLang specification and documentation
Category:Implemented
Category:Languages
Category:Cell-based
Category:Low-level
Category:2022