From Esolang
Jump to navigation Jump to search
Paradigm(s) Procedural
Designed by Harald Sorenson
Appeared in 2017
Dimensions One-Dimensional
Computational class Unknown
Major implementations Interpreter
Influenced by C, Lua
File extension(s) .df

Drift is a procedural, "stack-based" programming language created by Harald Sorenson in 2017. The main premise of the language is where every variable is a stack (filo) or queue (fifo) of positive integers.

Language Syntax

Declaration Keywords

  • filo will declare a first-in-last-out stack.
  • fifo will declare a first-in-first-out stack, also known as a queue.

Destruction Keywords

  • del will destroy a variable, and will allow it to be redeclared.

Variable Operators

  • Pushing: . will push onto the stack.
  • Popping: ~ will return and remove the top/bottom of the stack.
  • Peeking: ^ will return the top/bottom of the stack.
  • Get Size: ? will return the size of the stack.

Logic Keywords

  • if and else statements, along with else if statements.
  • loop with break for looping.
  • lbl and goto operators with ret token to return to goto call.

I/O Keywords

  • print will print to stdout.
  • println will print to stdout with an appended newline.
  • char and int keywords to define how to print.
  • cin will get the first character of user input.
  • sin will get a line of user input.
  • nin will get a number from user input.


  • All arithmetic must be placed within arithmetic blocks ()
  • Operators currently functional include: +, -, /, *, and %.


  • "..." to create a string literal, only supported when pushing to a variable.
  • '... to create a character literal, only supports one character.


  • One-line comments are declared with a \ token.


Hello, World!

fifo str."Hello World!\n"

loop {
  if ?str > 0 {
    print char ~str
  }else {

Reverse Cat

Note: filo could be replaced with fifo to make this a normal cat program.

filo input.sin

loop {
  if ?input = 0 {
    print char '\n
  print char ~input

Fibonacci Sequence

filo fib.0
loop {
  println int ^fib
  filo tmp.(~fib)
  filo sum.(^tmp + ~fib)
  del tmp
  del sum
  if ^fib > 100000 {break}


filo arg
lbl pstr
  loop {
    if ?arg = 0 {break}
    print char ~arg
  print char '\n

goto pstr

Conditional Loop

filo num.nin
if ^num = 0 {
}else loop if ^num > 0 {
  if ^num = 0 {
  println int ^num
}else {
  println int ^num

Deadfish Interpreter

See here or here.

External Links