esolang

Bolic

Four variables, a loop and a branch, all spelled in dingbats.

Yutaka Hara, 2008 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello, world!

The idea

Yutaka Hara designed Bolic in 2008 as an example for his book on building strange languages in Ruby, Rubyで作る奇妙なプログラミング言語. Underneath it is an ordinary small language with four variables, arithmetic, an if and a while. Only the spelling is odd. The numbers are the circled ⓪ to ⑩, the variables are four stars, and the keywords are a musical note, a writing hand, a recycling sign, two pointing hands, a chess knight, a plane and three faces.

Read the story

The if is an expression, so it can stand on the right of an assignment, and a block has the value of its last statement. There is output but no input.

The machine

SymbolDoes
⓪ to ⑩The numbers 0 to 10
✪ ✩ ✷ ✲The four variables
V ☜ eAssign e, and give its value
+ - × ÷Arithmetic
♪ ePrint e as a character
✍ ePrint e as a number
♺ e ☞ ... ♘Loop while e is not 0
✈ e ☺ ... ☹ ... ☻If, with an optional else

The grammar puts a whole expression to the right of + and -, so they group from the right. The specification's prose says ♪ prints a number and ✍ a character, but both of its programs use them the other way round, and so does this implementation.

Example

The Hello, world! program builds every letter from ⑩ at most.

The Hello, world! program builds every letter from ⑩ at most. H is ⑦×⑩+②, 72.

The ten Fibonacci numbers count ✪ down from 10 and print each number and a line feed, ♪⑩.

Expected: 1 2 3 5 8 13 21 34 55 89

Grouping from the right makes 7 - 2 - 1 come out as 7 - (2 - 1), and an if gives the value of its branch.

Expected: 6
Expected: 2

Further

Also in Jokes

Write your own in Run Convert a program from Bolic

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bolic -e '✪☜⑩
✷☜ ⓪ ✲☜①
♺ ✪ ☞
  ✩☜ ✷+ ✲ 
  ✍ ✩♪⑩
  ✷☜ ✲ ✲☜ ✩
  ✪☜ ✪−①
♘'
shib manual bolic

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/bolic.js

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

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