WinReg

From Esolang
Jump to navigation Jump to search

WinReg is an esoteric programming language created by User:Dominicentek. It's syntax is similar to his other language called FolderCode. Instead of it being a folder structure, it is a tree of keys and values in the Windows Registry.

Initialization

In HKEY_LOCAL_MACHINE/SOFTWARE, create a key called WinReg, and put all of your programs in there. To make a program, simply make a key and the program will be that key.

Commands

All commands, exactly like in FolderCode, are indexed with numbers.

Command Value Type Parameter Description
var SZ Variable name Set open variable/create a new variable
assignstr SZ Variable value Assigns a string value to an open variable
assignint DWORD Variable value Assigns an integer value to an open variable
assignfromvar SZ Variable name Assigns a value from a variable to an open variable
user SZ Variable name Assings user input to a variable
if KEY Variable name Compares an open variable with a variable
else KEY None If the above if statement returns false, this gets executed instead
print SZ Variable name Prints variable value into console
add SZ Variable name Adds a number to an open variable
sub SZ Variable name Subtracts a number from an open variable
mul SZ Variable name Multiplies a number in an open variable
div SZ Variable name Divides a number in an open variable
mod SZ Variable name Modules a number in an open variable
loop KEY Variable name Loops inside code a number of times in a variable and stores its loop amount into an open variable
random SZ Variable name Assigns a random number to an open variable based on the range
delay SZ Variable name Delays the code for a number of milliseconds
function KEY Function name Defines a function
callfunc SZ Function name Calls a function
toint SZ Variable name Converts a string variable to an integer
tostr SZ Variable name Converts an integer variable to a string
exit ANY None Exits the program

On KEY types, the parameter acts as the type's default value.

Examples

Hello World

┏ var text
┣ assign Hello World!
┗ print text

Truth-machine

┏ user input
┣ toint input
┣ var one
┣ assignint 1
┣ if input
┃ ┣ function printone
┃ ┃ ┣ print one
┃ ┃ ┗ callfunc printone
┃ ┗ callfunc printone
┗ else
   ┣ var zero
   ┣ assignint 0
   ┗ print zero

Fizz Buzz

┏ user input
┣ toint input
┣ var zero
┣ assignint 0
┣ var three
┣ assignint 3
┣ var five
┣ assignint 5
┣ var fizz
┣ assignstr Fizz
┣ var buzz
┣ assignstr Buzz
┣ var newline
┣ assignstr \n
┣ var loopamount
┗ loop input
   ┣ var threereminder
   ┣ assignvar loopamount
   ┣ var fivereminder
   ┣ assignvar loopamount
   ┣ var threereminder
   ┣ mod three
   ┣ var fivereminder
   ┣ mod five
   ┣ var threereminder
   ┣ if zero
   ┃ ┗ print fizz
   ┣ var fivereminder
   ┣ if zero
   ┃ ┗ print buzz
   ┣ var threereminder
   ┣ if zero
   ┣ else
   ┃ ┣ var fivereminder
   ┃ ┣ if zero
   ┃ ┗ else
   ┃    ┗ print loopamount
   ┗ print newline

Interpreter

Download