We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Falafel

From Esolang
Jump to navigation Jump to search
Falafel
Paradigm(s) imperative, stack-based
Designed by User:Las-r
Appeared in 2026
Computational class Turing complete
Major implementations GitHub Gist
Influenced by Brainfuck
File extension(s) .fel

Falafel is a highly volatile, space-as-code imperative esolang created by Nayif Ehan in 2026.

How Falafel works

Falafel maintains two infinite data structures at runtime:

  1. Cell Stack: An infinite tape of cells where each cell holds a signed 8-bit integer. A single data pointer tracks the active cell.
  1. Call Stack: A hidden LIFO storage stack that simultaneously tracks historical data pointer locations and instruction pointer return addresses.

Execution is linear unless a call jump fa is triggered. When a jump occurs, the current data pointer and the current instruction pointer are pushed to the call stack, and the data pointer is incremented by the value currently stored in the active cell, a negative value means a backwards jump. A return command fel restores both pointers to their previous state by popping from the call stack.

Syntax

Guidelines

  • Whitespace is completely ignored and can be used for formatting.
  • Any character not matching a valid command is ignored and acts as a comment.

Commands

Data and Control Flow

Token Description
fa Call: Pushes the current data pointer position and the instruction pointer position onto the call stack. It then reads the signed 8-bit value of the current cell and shifts the data pointer relatively.
fel Return: Pops the saved instruction pointer and data pointer positions off the call stack and restores them. If the call stack is empty, this does nothing.
la Increment: Adds 1 to the current cell value.
al Decrement: Subtracts 1 from the current cell value.

I/O and Termination

Token Description
. Output: Emits the standard ASCII character of the integer in the current cell to the console.
? Input: Reads one character from console input and adds its ASCII value to the current value of the active cell.
! Halt: Kills the program.

Computational Class

Falafel is Turing-complete.

Proof Sketch

Falafel utilizes an infinite array of cells, satisfying the arbitrary data storage requirements of a Turing machine.

While Falafel lacks explicit conditional operators (like [ and ] in Brainfuck), it can achieve conditional jumping through pointer offsets. Because fa reads the runtime value of a cell to compute its relative destination vector, a cell value of 0 creates an localized trapping loop, while non-zero values shift execution space. By preparing data cells ahead of a fa execution, structured loops can be created.

Interpreter

A minified Falafel interpreter written in Python can be found here.