Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 771 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 771 Bytes

brainfucked

Build Coverage

A stack based, streaming brainfuck interpreter written in golang ;)

Running

cd brainfuck && go run . ../programs/helloworld.bf

Testing

cd interpret && go test -v -cover

Adding as a package

Add the interpret package => go get github.com/swd543/brainfucked/interpret

Initialize the interpreter state

state := interpret.NewState[int](programReader, programOutputWriter, inputReader)

Adding custom commands (for squaring)

state.AddOrReplaceCommand('*', func(state *interpret.State[int]) {
  state.Data[state.Dp] *= state.Data[state.Dp]
  state.Pc++
})