Brachylog is a declarative logic programming language much like Prolog. Brachylog is designed to be much terser than Prolog, while retaining some readability.
Currently in development.
Brachylog uses SWI-Prolog as Prolog engine.
Check out Brachylog's Wiki if you want to learn how to write programs in this language.
You may want to watch this short video introduction to Brachylog.
You can try out Brachylog on Try it online!, thanks to @DennisMitchell.
You can find here the Brachylog language bar which gives you access to all symbols used in Brachylog on any webpage (by clicking on the symbols or by inputing shortcuts), thanks to @abrudz.
Brachylog's interpreter is entirely written in Prolog. Therefore, installing SWI-Prolog (version 7 and up) is mandatory to use Brachylog (We do not guarantee that Brachylog's interpreter will be compatible with any other Prolog implementation).
To run Brachylog's interpreter, start SWI-Prolog's interpreter inside the src
directory available in this repository, and consult the file brachylog.pl
(consult(brachylog).
). Alternatively, you can run the interpreter with:
$ swipl src/brachylog.pl
You can then run Brachylog programs using different predicates:
-
run_from_file(FileName, Input, Output)
:FileName
is an atom (i.e. between single quotes'
) representing the file containing your Brachylog code. For example:run_from_file('code.brachylog',"Test Input",Z)
. -
run_from_atom(Code, Input, Output)
:Code
is an atom (i.e. between single quotes'
) containing your Brachylog code. For example:run_from_atom('∧"Hello, World!"w',_,_)
. Note that you will have to escape certain characters inCode
. -
run(Input, Output)
: This will run a Brachylog program that has already been transpiled to Prolog using either of the two previous predicates. More precisely, this will querybrachylog_main/2
in the filecompiled_brachylog.pl
.
The first two predicates will transpile your Brachylog program into Prolog, subsequently generating a file called compiled_brachylog.pl
in the same directory that contains brachylog.pl
. The three run predicates will then consult it and query brachylog_main/3
.
Note that the first two run predicates also exist with either no Output
argument, or with no Input
nor Output
argument, if necessary. For example, run_from_file('code.brachylog')
is equivalent to run_from_file('code.brachylog', _, _)
.