interpreter

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2019 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interpreter

type Interpreter struct {
	Program         []byte
	ProgramPosition int
	Memory          [memorySize]int64
	MemoryPosition  int

	Output strings.Builder
	Input  string
	// contains filtered or unexported fields
}

Interpreter represents a Brainf--k interpreter containing the program and memory which may be run.

func (*Interpreter) Clock

func (ipr *Interpreter) Clock() bool

Clock runs one cycle/tick of the interpreter. It returns false when the program ends.

func (*Interpreter) Init

func (ipr *Interpreter) Init()

Init initialises an interpreter by resetting the memory position.

func (*Interpreter) LoadProgram

func (ipr *Interpreter) LoadProgram(data []byte)

LoadProgram loads a program to the interpreter and builds a bracket map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL