Broccoli

From Esolang
Jump to navigation Jump to search

Broccoli is a stack-based, semi-concatenative programming language created by mathieucaroff. It has a JS interpreter.

  • Hello world example:
"Hello World!" output
  • All operators have the same precedence. Computations are carried left to right. The below code prints 18, not 12:
3 + 3 * 3 output
  • Factorial computer:
input number = a
1 = b

{
 a * b = b
 a - 1 = a
}
{ a > 0 }
while

b output
{ 0 output }
{ { 1 output } { true } while }
input number == 0
if
  • Copy input on output until an empty line is met or until the input ends:
input
{ output input }
{ = a a a }
while
  • Copy input on output (cat program):
stdin .read
stdout .write

External resources