Brachylog

From Esolang
Jump to navigation Jump to search

Brachylog is a declarative golfing language based on SWI-Prolog. It was created by Fatalize in 2015. The compiler is written in Prolog and generates SWI-Prolog code based on the input Brachylog code.

Overview

Brachylog is a declarative language designed to write SWI-Prolog code tersely. As such the philosophy of coding in Brachylog is extremely close to the philosophy of coding in Prolog, and so is the vocabulary used.

A brachylog program is always constitued of a main predicate which has two arguments called Input and Output. In general, every predicate in Brachylog (built-ins included) has one Input and one Output argument. The program is entirely written on one line, and things get processed left to right. Predicates call will use the variable immediatly to the left of the predicate as Input and the variable immediatly to the right of the predicate as Output. Implicit variables are used when chaining predicates. Logical and and Unification are mostly implicit in programs as well.

An in-depth presentation of Brachylog and all its built-in predicates can be found on the Github page of the project.

Example Code

Hello, world!

"Hello, world!"w

Alternatively, the following code:

Ḥw

will output "Hello, World!" (capital W).

External resources