Bolic

From Esolang
Jump to navigation Jump to search

Bolic, designed by Yutaka Hara in 2008 for his book, Rubyで作る奇妙なプログラミング言語, is a procedural esoteric programming language. The book discusses the implementation of esolangs in Ruby; Bolic is used as an example language.

Overview

Abstract syntax

Spaces are the only token separators.

NUMBER = ⓪ | ① | ② | ③ | ④ | ⑤ | ⑥ | ⑦ | ⑧ | ⑨ | ⑩ ;
VARIABLE = ✪ | ✩ | ✷ | ✲;

statements = { | statement }; 
statement = output;
output = ♪ expr | ✍ expr | while;
while = ♺ expr ☞ statements ♘ | expr;
expr = if;
if = ✈ expr ☺ statements [ | ☹ statements ] ☻ | additive;
additive = multiple [ | [ + | - ] expr ];
multiple = variable [ | [ × | ÷ ] multiple ];
variable = VARIABLE [ | ☜ expr ] | number;
number = NUMBER;

Semantics

Output statements

Bolic supports output only. Two emojis ♪ and ✍ stands fot printf("%d",expr) and putchar(expr), respectively.

Control flow

While while-loop is a statement while if-branching is an expression. The following code is thus syntaxically valid:

✪ ☜ ✈ ✩ ☺ ✩ ☻

Conditional expression evaluating to non-zero stands for true; otherwise false.

Assigning to a variable

It is an expression. It is done by VARIABLE ☜ expr.

Reading value on a variable

The variable whose value is read has to be initialized with any valid value before.

Others

A block of statements evaluate to that of its last statement. It is not documented what the bound for value is, if the value must be integers only, or if the value may evaluate to floating value.

Examples

Hello, world!

♪⑦×⑩+②  ♪⑩×⑩+①  ♪⑩×⑩+⑧  ♪⑩×⑩+⑧ 
♪⑩×⑩+⑩+① ♪④×⑩+④  ♪③×⑩+②  ♪⑩×⑩+⑩+⑨ 
♪⑩×⑩+⑩+①  ♪⑩×⑩+⑩+④ ♪⑩×⑩+⑧  ♪⑩×⑩ 
♪③×⑩+③

10 fibonacci numbers

✪☜⑩
✷☜ ⓪ ✲☜①
♺ ✪ ☞
  ✩☜ ✷+ ✲ 
  ✍ ✩♪⑩
  ✷☜ ✲ ✲☜ ✩
  ✪☜ ✪−①
♘

External links

This article is not detailed enough and needs to be expanded. Please help us by adding some more information.