Skip to content

Nick-Triller/bfk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfk

Test Go Report Card License

bfk is an interpreter for the esoteric programming language "Brainfuck" implemented in Go.

The interpreter uses this specification as a guideline.

Usage

bfk is a brainfuck interpreter written in go.

Usage:
  bfk [command]

Available Commands:
  help        Help about any command
  minify      Minifies a program.
  run         Run a program.

Flags:
  -h, --help      help for bfk
      --version   version for bfk

Use "bfk [command] --help" for more information about a command.

Run a program:

bfk run programs/helloworld.bfk

Memory layout

The VM simulates an infinite number of cells for positive and negative adresses via a paging mechanism. Each cell consists of an unsigned 8 bit integer.

Instructions

Instruction Description
< Moves the memory pointer one cell to the left.
> Moves the memory pointer one cell to the right.
+ Increments the current cell by one.
- Decrements the current cell by one.
, Reads one byte of data from stdin.
. Writes the value of the current cell to stdout as ASCII.
[ Jumps forward to the instruction after the matching ] if the current cell is 0.
] Jumps backwards to the instruction after the matchin [ if the current cell is not 0.

Build

set GO111MODULE=on
go build

Test

go test ./...

Dependencies

bfk uses cobra for CLI parsing.

About

A "Brainfuck" interpreter written in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages