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.

EchoLang (CamHack2026)

From Esolang
Jump to navigation Jump to search

EchoLang is a queue based, concurrent programming language created by Sirius and Marcell as a submission for CamHack2026.

Gimmick

Each program is only allowed one 64-bit register of memory. To remember more data, send a ping request with a payload (the data) to a server with high latency and wait for it to repeat the payload back to you.

  • This is inspired by suckerpinch's Harder Drive video
  • The theme of CamHack2026 was "out of sync"

Language overview

A program is a set of procedures, the procedure on_start is ran once, on_message is ran for every message the program receives.

# this is a comment
on_message {
    reg = reg + recv
    print reg
}

Each program uses a message queue to hold incoming messages. Evaluating expressions with recv removes one message from the queue.

  • An expression containing multiple recv are evaluated from left to right.
  • If recv is evaluated when the message queue is empty, it will stall until a message arrives. The consumed message will not trigger an on_message.

Expressions

Numerical expressions evaluates to a 64 bit integer, you can use brackets for precedence, in order of tightness:

  • Unary + - ~ !
  • Mul-like * / % << >> >>>
  • Add-like + -
  • Bitwise and &
  • Bitwise xor ^
  • Bitwise or |
  • Logical comparisons == != < > <= >=

String expressions:

  • All numerical expressions are valid string expressions
  • String literals are double quoted
  • Concat string literals together with the .. operator

Constants can be declared at the top level, and can be a string or a numerical expression.

const NAME = [any expr]

Statements

Statements can appear inside a procedure block.

Statement Description
reg = [num expr] Assign the value of [num expr] to the register
print [str expr] Print out [str expr]
debug [str expr] Print out [str expr] as debug message
send [str expr] Sends a message to the URL [str expr]
invoke [procedure name] Runs [procedure name]

Sending messages / multi-node projects

Each file, e.g. node-0.echo is ran as a separate program.

Examples

Inputs are sent to the program as messages.

Sleep sort

on_message {
    reg = recv
    if reg >= 1000 {
        print reg - 1000
    } else {
        send "https://"
            .. reg * 10
            .. ".echo-server.siri.ws/" 
            .. reg + 1000
    }
}

Example input:

[3,1,2]

Try it on web

See echo-lang.siri.ws for a LeetCode-style problem set + judge, and also a project playground.