interpreter

package
v0.0.0-...-5957b22 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 7 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 {
	Environment *environment.Environment
	Statements  []ast.Statement
}

func New

func New(statements []ast.Statement) *Interpreter

func (*Interpreter) Eval

func (i *Interpreter) Eval(astNode ast.AstNode) object.Object

Eval has to take in an astNode and not an ast.Statement because this function will have to run recursively and deal with ast.Expression at times.

func (*Interpreter) ExecuteBlockStatements

func (i *Interpreter) ExecuteBlockStatements(
	statements []ast.Statement,
	environment *environment.Environment) object.Object

--- Utility functions This function will take in an environment as a block is scoped to it's own environment.

func (*Interpreter) IsTruthy

func (i *Interpreter) IsTruthy(obj object.Object) bool

This is where it is important to define what is truthy and what is not.

func (*Interpreter) Start

func (i *Interpreter) Start()

Jump to

Keyboard shortcuts

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