esolang

Burlesque

A concatenative language whose commands are two characters each, used as a calculator and for golf.

Feuermonster, 2012 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 6 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Burlesque is the successor of Stlang, made by Feuermonster in 2012. It is concatenative; values and commands are written one after another, and every command works on a stack. Nearly every command is a pair of characters, so .+ adds, r@ makes a range and m[ maps a block over a list.

Read the story

The whole of standard input is pushed as one string before the program starts. When it ends, the stack is printed from the top down, one value per line. Strings print in quotes unless Q has made them pretty first.

The machine

CodeDoes
5 2.5 "text" 'c {1 2 3}Push an integer, a double, a string, a character, a block
,Drop the input when it is the only thing on the stack
.+ .- .* ./ .%Arithmetic; .+ also joins strings and blocks
r@The range from a to b
++ pdSum, product of a block
ln ri wdSplit into lines, read an integer, split into words
m[ f[ r[Map, filter, reduce with a block
^^ vv \/Duplicate, drop, swap
QShow the next value as plain text
if ie w! e!If, if else, while, run a block

Example

The second program drops the input, builds the block 1 to 10 and adds it up.
Expected: 55
Expected: 13
Expected: "cba"

The second program drops the input, builds the block 1 to 10 and adds it up. The third splits the input into lines, reads each as an integer and sums them. The last reverses the input; without Q the string prints in quotes.

This implementation is a subset, after the Haskell interpreter in the FMNSSun/Burlesque repository, which TIO runs. It has the literals, the commands in the table and about thirty more. Lazy infinite lists, variables, maps, the quoting forms and the hundreds of rarer commands stop the run with the reason.

Patterns it teaches

  • Code golf: two characters per command leave room for many commands.
  • Concatenative: Underload translates into it one command at a time.
  • Stack machines: the input starts on the stack and the stack is the output.

Try this

  1. Print the squares of 1 to 10.
  2. Read lines of numbers and print the largest.
  3. Hard: count the vowels in the input.

Further

Golfing languages

Stack-based

Write your own in Run Convert a program from Burlesque

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: burlesque.

Command line

shib run burlesque -e '<-' --input 'abc'
shib manual burlesque

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/burlesque.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org