Formin
| Designed by | User:CapinolDev |
|---|---|
| Appeared in | 2025 |
| Computational class | Turing-complete |
| Reference implementation | https://github.com/CapinolDev/Formin |
| File extension(s) | .fmn, .fbc |

Formin is an esoteric programming language and flow-based virtual machine created by User:CapinolDev in 2025. It features a symbolic, label-driven execution model and uses a bytecode compiler–interpreter toolchain written in modern Fortran.
Overview
Formin programs consist of commands enclosed between #/ and /# markers.
Each command may include one or more tokens separated by |, and an optional suffix (! for fatal errors, ? for run-once behavior).
command#/token1|token2|token3/#[suffix]
Example:
create#/greeting|'Hello, World!'/# spew#/greeting/# bye
The language is line-oriented and whitespace-insensitive. Comments begin with !.
Execution model
Formin programs are compiled into a binary bytecode format (.fbc) by the **Formin Compiler** (`forminc`), then executed by the **Formin Virtual Machine** (`forminv`).
The virtual machine supports flow control using labels and jumps:
mark#/label/#— defines a label.go#/label/#— unconditional jump.ifgo#/lhs|op|rhs|trueLabel|falseLabel/#— conditional branching.
Bytecode
Compiled programs are stored in binary `.fbc` files containing a header (instruction count) followed by serialized `Instr` structures:
- Opcode integer
- Token count
- Up to 10 tokens (each 256 chars)
- Optional suffix character
Computational class
Formin is Turing-complete: it supports mutable variables, arithmetic, and conditional and unconditional jumps (`mark`, `go`, `ifgo`), sufficient to emulate a register machine.
Example
create#/n|0/int/# mark#/loop/# add#/n|n|1/# ifgo#/n|<|10|loop|end/# spew#/'Done!'/# mark#/end/#
Commands
| Command | Description |
|---|---|
create# |
Create a variable (optionally with initial value and type). |
set# |
Modify an existing variable. |
add#, sub#, mult#, div#, mod# |
Arithmetic operations. |
spew# |
Print tokens separated by spaces. |
spewmult# |
Print tokens without spaces. |
color# |
Change terminal color (e.g. green, red, reset).
|
mark#, go#, ifgo# |
Flow control. |
ask# |
Prompt user input into a variable. |
clear# |
Clear the terminal. |
open#, read#, close# |
File operations. |
list# |
Built-in list subsystem: create, push, get, set, pop, len, clear, reserve.
|
str# |
String operations: cat, rev, low, up, len.
|
type# |
Retrieve a variable’s type. |
sys# |
Execute a system command. |
getos# |
Detect current operating system. |
randi# |
Generate a random integer. |
sqrt# |
Compute square root of a value. |
cputime# |
Store current CPU time in a variable. |
goback# |
Return to previous go location.
|
bye |
End program. |
Implementation
The Formin ecosystem consists of two executables:
- **`forminc`** — Compiler that translates `.fmn` source into `.fbc` bytecode.
- **`forminv`** — Virtual machine that executes `.fbc` programs.
Both are implemented in **Fortran 95** and make extensive use of dynamic memory, hashing, and string interning for fast symbol resolution. The VM supports random access lists, numeric caching, and suffix-based error handling.
Licensing
- Source code — MIT License
- Logo — CC BY-SA 4.0
- Documentation — CC BY-SA 4.0