User:DockedChutoy/Sandbox
Fin (temporary name), short for "File In", is an esolang created by Docked in 2026. It was designed with to purpose to push the paradigm of metaprogramming to its limits, including using only the source code itself as memory. This source code can also be simply modified. A major design goal of Fin is to be easily readable, unlike most other languages with a similiar idea.
| Paradigm(s) | imperative |
|---|---|
| Designed by | Docked |
| Appeared in | 2026 |
| Memory system | Other |
| Dimensions | one-dimensional |
| Computational class | Turing complete |
| Reference implementation | Unimplemented |
| Influenced by | BASIC |
| File extension(s) | .fin |
Command Specification
Comments
Comments are marked as follows:
/* Comment here */
Types
Fin has 4 different usable types, with one of them being mostly specific to this language:
| Name | Usage | Description |
|---|---|---|
| String | "text" | Returns simple text. Enclosed in quotes. |
| Number | #number | Returns a simple number. May be written as a integer or float. |
| Boolean | True/False | Returns a simple boolean number, either True or False. In arithmetics, act like 1 and 0, respectively. |
| Line Reference | line number or +/-line offset | Returns whatever is contained in the referenced line. |
The line reference (lineref) is the most interesting type. Take the following program as an example:
print 2 "Hello World!"
The print function refers to line number 2, which contains a "Hello World!" string, which it then prints. In longer code, however, it can be impractical to use exact lines. To deal with that, one can also use line offsets, as the following example shows:
#42 print +1 "Hello World!"
Here, the +1 tells the print function to use whatever is on the next line. If we wanted to print 42, we would use -1 instead. There are, of course, other ways to refer to lines, but these are the basic ones. It is, of course, possible to print strings directly. Also, empty or nonexistent lines simply return nothing when referenced. Also: Line refs referencing statements are valid too. Consider the following piece of code:
2 print "Hello World!"
Hello World! is printed twice in the example. It should be noted that attempting to print a statement using line references or otherwise interacting with them in odd ways should throw an error. Treat line references as if the line they're referencing are literally there. You wouldn't write "print print print #9", no?
Aliases
Since all of Fin's memory relies entirely on code, Fin does not have variables in the traditional sense. Instead, it uses "aliases", so that instead of referring to a line using numbers, one can refer to it using its own alias. Here it is in action:
alias +2 = x print x "Hello World!"
The first line makes an alias for line 3, here called x, and the second line prints it. Note how it technically does not matter where the aliased line is located, what matters is that the alias is put before the print statement.
Line Manipulation
Fin has several commands that allow to manipulate lines, and thus modify code. Note that most commands could be considered syntactic sugar and represented only using the write command:
| Command | Description |
|---|---|
| write line value | Rewrites the line line with value, which is either a string or another line. |
| copy a b | Copies the line a to line b. |
| delete line | Deletes the given line. |
| append line value | Adds value to line. Note that it adds only, and only the given value. |
An example with the first three:
print 4 write +2 "World!" copy 0 +2 "Hello " /* Gets turned into "World!" */ "another useless string" /* Gets turned into print and then deleted */ delete -1
Gotos
Gotos are very simple, they simply go to the given line. Here's an example:
"Hello World!" print 1 goto 2
The above example will run forever. Passing non-linerefs results in an error.
Control Flow
While all that stuff is cool and all, we're still missing some ways to do control flow. Those can be done using if statements. Here's how they look:
if *condition* /* some code... */ endif
The condition can be a comparison (==, !=, <, > and the likes), an operator (not, or, and) and such. Any types (save for line refs to statements) can be checked for and compared against each other. Elses also exist, like so:
else /* more code... */ endelse
Export Statement
Fin also has a special statement to export itself as a file upon completion. The statement looks as follows:
export filepath
If the filepath is only a name or a path to one without any extension, it automatically assumes the ".fin" extension. If an file extension is included, then it is the one used. Only the first export statement is considered. Any other exports that are ran after are ignored and don't do anything.