Skip to content

afvanwoudenberg/bf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainfuck Interpreter

This is a Prolog implementation of a Brainfuck interpreter. Brainfuck is an esoteric programming language with only eight commands, making it one of the simplest programming languages.

Getting Started

Prerequisites

To run the Brainfuck interpreter written in Prolog, you'll need to first install SWI-Prolog .

To install SWI-Prolog on Linux, open up a terminal and type:

sudo apt-get install swi-prolog

On macOS, if you have Homebrew installed you can instead run:

brew install swi-prolog

To install SWI-Prolog on Windows, download the installer from the official website and follow the instructions.

Cloning the Repository

  1. Open your terminal or command prompt and navigate to the directory where you want to clone the repository.

  2. Clone the repository:

git clone https://github.com/afvanwoudenberg/bf.git
  1. Navigate into the project folder:
cd bf

Running Brainfuck Programs

Once you have SWI-Prolog installed and have cloned this repository, you can run Brainfuck programs using the run_bf_program/1 predicate.

This repository includes some programs from the The brainfuck archive.

First, start the SWI-Prolog interpreter by opening up a terminal and typing:

swipl

This will start the Prolog interpreter. You can then load the Brainfuck interpreter by typing:

[bf].

This loads the bf.pl file into the interpreter. You can then run a Brainfuck program using the run_bf_program/1 predicate, like so:

run_bf_program('hellobf.bf').

This will run the hellobf.bf program and output the famous "Hello World!" message to the console.

Alternatively, you can execute these three steps at once by typing:

swipl -s bf.pl -g "run_bf_program('hellobf.bf'), halt."

Adding halt will make the Prolog interpreter exit after the Brainfuck run_bf_program/1 predicate has finished.

Author

Aswin van Woudenberg (afvanwoudenberg)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Brainf*ck interpreter in Prolog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published