interp

package
v0.0.0-...-f7e72b4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Repl

func Repl(mach Mach, r io.Reader) error

func Run

func Run(mach Mach, name string, src []byte) error

Types

type ForStack

type ForStack struct {
	Block int
	Var   string
	To    int64
}

type Interpreter

type Interpreter struct {
	Mach Mach
	Halt bool
	PC   int

	Vars  map[string]int64
	Subs  []int
	Fors  []ForStack
	Locs  map[int64]int
	Lines []ast.Stmt
}

func NewInterpreter

func NewInterpreter(mach Mach) *Interpreter

func (*Interpreter) Eval

func (p *Interpreter) Eval(s ast.Stmt) (err error)

func (*Interpreter) Reset

func (p *Interpreter) Reset()

func (*Interpreter) Step

func (p *Interpreter) Step() error

type Mach

type Mach interface {
	io.Writer
	Peek(addr int64) int64
	Poke(addr, value int64)
}

type Stdio

type Stdio struct {
	Values map[int64]int64
}

func NewStdio

func NewStdio() *Stdio

func (*Stdio) Peek

func (s *Stdio) Peek(addr int64) int64

func (*Stdio) Poke

func (s *Stdio) Poke(addr, value int64)

func (Stdio) Write

func (Stdio) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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