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.

It combines traditional linear byte-manipulation mechanics with an architectural constraint where the data pointer controls code execution jumps, effectively treating memory offsets as physical execution vectors.

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 ($[-128, 127]$). 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 flows linearly unless a call jump (`fa`) is triggered. When a jump occurs, the current data pointer and next instruction positions are saved, and the data pointer shifts by the relative offset currently stored in the active cell. A return command (`fel`) restores both pointers to their previous state.

Syntax

Basic Guidelines

  • The language is tokenized into multi-character keywords (`fa`, `la`, `al`, `fel`) and single-character operations (`.`, `?`, `!`).
  • Whitespace is completely ignored and can be used for formatting.
  • Any character not matching a valid token acts as a no-op / comment.

Commands

Data and Control Flow

Token Description
fa Call: Pushes the current data pointer position and the subsequent 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, snapping execution back to the caller frame. If the call stack is empty, this acts as a no-op.
la Increment: Adds 1 to the current cell value. Standard signed 8-bit wrapping applies.
al Decrement: Subtracts 1 from the current cell value. Standard signed 8-bit wrapping applies.

I/O and Termination

Token Description
. Output: Emits the standard ASCII value 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: Immediately terminates the program.

Computational Class

Falafel is Turing-complete.

Proof Sketch

To establish Falafel's Turing-completeness, we can map its semantics directly to a 2-counter Minsky Machine or a bounded Brainfuck variant with an infinite tape mechanism:

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 achieves conditional jumping through dynamic 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 iteration loops can be deterministically mapped.

Interpreter

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