From Esolang
Jump to navigation Jump to search

FolderCode is an esoteric programming language created by Dominicentek. It's main gimmick is that it's written as a folder structure with names being commands. FolderCode compiles into bytecode file called with .fc extension. It's compiler, runtime and interpreter was written in Java.

Commands and Syntax

All commands have to be uppercased. Before you type a command, you enter an order number followed by a space. Exactly like in BASIC. There are 100 storage slots and 100 function slots. Storage slots store signed 32-bit numbers. Function slots store code that can be executed with the CALLFUNC command.

FolderCode commands
Command Syntax Description
SET <storage slot : slot index> <value : new value> Sets a value to a storage slot
PRN <value : printed value> Prints a number to the console
TXTPRN <value : printed character> Prints an Unicode character to the console
LOOP <value : amount> Loops code inside this folder n times
IF <value : left hand value> <IS|NOT|GREATERTHAN|LESSTHAN> <value : right hand value> Performs a condition. If true, code inside this folder gets executed.
ELSE If the above IF command returns false, Code inside this folder gets executed instead
ADD <slot : storage slot index> <value : number> Adds a value to a storage slot
SUB <slot : storage slot index> <value : number> Subtracts a value from a storage slot
MUL <slot : storage slot index> <value : number> Multiplies storage slot value n times
DIV <slot : storage slot index> <value : number> Divides a value in a storage slot
MOD <slot : storage slot index> <value : number> Modules (gets division reminder) a value in a storage slot
TXTUSER <slot : storage slot index> Puts Unicode characters from user input into multiple storage slots.
SETACTIVESLOT <value : slot index> Marks a storage slot as active
FUNCTION <value : function slot index> Puts code inside this folder to a function slot
CALLFUNC <value : function slot index> Executes code inside a function slot
DELAY <value : delay in ms> Pauses the code for specified amount of time (in milliseconds)
EXIT Stops the program from running

Difference between value, slot and constant numbers

Value number can either be a constant or a value command. Slot number can either be a constant or ACTIVESLOT variable, which returns active slot's index. Constant can only be a number.

Value commands
Command Syntax Description
GET <constant : slot index> Gets a value from a storage slot
USER Gets an user input as a number
LOOPAMOUNT Amount of times a loop has executed its code. If there's no loop active, this returns 0.
GETACTIVESLOT Gets a value inside an active slot
RANDOM <constant : range> Generates a random number based on entered range. The range is: 0 to n - 1


Hello World

┣ TXTPRN 101
┣ TXTPRN 108
┣ TXTPRN 108
┣ TXTPRN 111
┣ TXTPRN 111
┣ TXTPRN 114
┣ TXTPRN 108
┣ TXTPRN 100

Truth Machine

┣ IF GET 0 IS 0
┃ ┗ PRN 0
   ┃ ┣ PRN 1
   ┃ ┗ CALLFUNC 0

Fizz Buzz

   ┣ ADD 0 1
   ┣ SET 1 GET 0
   ┣ SET 2 GET 0
   ┣ MOD 1 3
   ┣ MOD 2 5
   ┣ IF GET 1 IS 0
   ┃ ┣ TXTPRN 70
   ┃ ┣ TXTPRN 105
   ┃ ┣ TXTPRN 122
   ┃ ┗ TXTPRN 122
   ┣ IF GET 2 IS 0
   ┃ ┣ TXTPRN 66
   ┃ ┣ TXTPRN 117
   ┃ ┣ TXTPRN 122
   ┃ ┗ TXTPRN 122
   ┣ IF GET 1 NOT 0
   ┃ ┗ IF GET 2 NOT 0
   ┃    ┗ PRN GET 0
   ┗ TXTPRN 10

Development Kit


Difference between Runtime and Interpreter

Runtime executes compiled code (.fc files), but interpreter executes code directly. Interpreter is meant to test the code faster and Compiler + Runtime is meant to share your program.


Version 1.2.1

  • Fixed bugs
  • The entire development kit is just one single JAR file

Version 1.2

  • Added DELAY command

Version 1.1

  • Added SETACTIVESLOT command
  • Added FUNCTION command
  • Added CALLFUNC command
  • Added LOOPAMOUNT value command
  • Added GETACTIVESLOT value command
  • Added RANDOM value command
  • Added ACTIVESLOT variable for storage slots
  • Released publicly for

Version 1.0

Initial release
Intended for an esolang YouTuber Truttle1

See also