Documentation ¶
Index ¶
- Constants
- Variables
- func Hash(v string) int
- func PrintRepresentation(v any) string
- func Representation(v any) string
- type Clock
- type ControlType
- type Environment
- type Filter
- type HasKey
- type Interpreter
- func (i *Interpreter) Interpret(statements []ast.Statement) (value any, ok bool)
- func (i *Interpreter) Resolve(expression ast.Expression, depth int)
- func (i *Interpreter) VisitArrayExpression(e *ast.ArrayExpression) any
- func (i *Interpreter) VisitAssignmentExpression(e *ast.AssignmentExpression) any
- func (i *Interpreter) VisitBinaryExpression(be *ast.BinaryExpression) any
- func (i *Interpreter) VisitBlockStatement(s *ast.BlockStatement)
- func (i *Interpreter) VisitBreakStatement(s *ast.BreakStatement)
- func (i *Interpreter) VisitCallExpression(e *ast.CallExpression) any
- func (i *Interpreter) VisitClassStatement(s *ast.ClassStatement)
- func (i *Interpreter) VisitContinueStatement(s *ast.ContinueStatement)
- func (i *Interpreter) VisitExpressionStatement(s *ast.ExpressionStatement)
- func (i *Interpreter) VisitForEachStatement(s *ast.ForEachStatement)
- func (i *Interpreter) VisitFunctionStatement(s *ast.FunctionStatement)
- func (i *Interpreter) VisitGetExpression(e *ast.GetExpression) any
- func (i *Interpreter) VisitGroupedExpression(ge *ast.GroupingExpression) any
- func (i *Interpreter) VisitIfStatement(s *ast.IfStatement)
- func (i *Interpreter) VisitIndexExpression(e *ast.IndexExpression) any
- func (i *Interpreter) VisitIndexedAssignmentExpression(e *ast.IndexedAssignmentExpression) any
- func (i *Interpreter) VisitLambdaExpression(e *ast.LambdaExpression) any
- func (*Interpreter) VisitLiteralExpression(le *ast.LiteralExpression) any
- func (i *Interpreter) VisitLogicalExpression(le *ast.LogicalExpression) any
- func (i *Interpreter) VisitLoopStatement(s *ast.LoopStatement)
- func (i *Interpreter) VisitMapExpression(e *ast.MapExpression) any
- func (i *Interpreter) VisitReturnStatement(s *ast.ReturnStatement)
- func (i *Interpreter) VisitSequenceExpression(e *ast.SequenceExpression) any
- func (i *Interpreter) VisitSetExpression(e *ast.SetExpression) any
- func (i *Interpreter) VisitSuperGetExpression(e *ast.SuperGetExpression) any
- func (i *Interpreter) VisitSuperSetExpression(e *ast.SuperSetExpression) any
- func (i *Interpreter) VisitTernaryExpression(e *ast.TernaryExpression) any
- func (i *Interpreter) VisitThisExpression(e *ast.ThisExpression) any
- func (i *Interpreter) VisitUnaryExpression(ue *ast.UnaryExpression) any
- func (i *Interpreter) VisitVarStatement(s *ast.VarStatement)
- func (i *Interpreter) VisitVariableExpression(e *ast.VariableExpression) any
- type Keys
- type Length
- type LoxArray
- type LoxCallable
- type LoxClass
- type LoxControl
- type LoxFunction
- type LoxInstance
- type LoxMap
- type LoxNative
- type LoxObject
- type Map
- type MapPair
- type Print
- type Reduce
- type Size
- type String
- type Values
Constants ¶
View Source
const ( RETURN ControlType = "RETURN" BREAK = "BREAK" CONTINUE = "CONTINUE" )
Variables ¶
View Source
var LoxBreak = &LoxControl{controlType: BREAK}
View Source
var LoxContinue = &LoxControl{controlType: CONTINUE}
Functions ¶
func PrintRepresentation ¶
func Representation ¶
Types ¶
type ControlType ¶
type ControlType string
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnclosingEnvironment ¶
func NewEnclosingEnvironment(enclosing *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
func NewInterpreter ¶
func NewInterpreter(errors *lox_error.LoxErrors) *Interpreter
func (*Interpreter) Interpret ¶
func (i *Interpreter) Interpret(statements []ast.Statement) (value any, ok bool)
func (*Interpreter) Resolve ¶
func (i *Interpreter) Resolve(expression ast.Expression, depth int)
func (*Interpreter) VisitArrayExpression ¶
func (i *Interpreter) VisitArrayExpression(e *ast.ArrayExpression) any
func (*Interpreter) VisitAssignmentExpression ¶
func (i *Interpreter) VisitAssignmentExpression(e *ast.AssignmentExpression) any
func (*Interpreter) VisitBinaryExpression ¶
func (i *Interpreter) VisitBinaryExpression(be *ast.BinaryExpression) any
func (*Interpreter) VisitBlockStatement ¶
func (i *Interpreter) VisitBlockStatement(s *ast.BlockStatement)
func (*Interpreter) VisitBreakStatement ¶
func (i *Interpreter) VisitBreakStatement(s *ast.BreakStatement)
func (*Interpreter) VisitCallExpression ¶
func (i *Interpreter) VisitCallExpression(e *ast.CallExpression) any
func (*Interpreter) VisitClassStatement ¶
func (i *Interpreter) VisitClassStatement(s *ast.ClassStatement)
func (*Interpreter) VisitContinueStatement ¶
func (i *Interpreter) VisitContinueStatement(s *ast.ContinueStatement)
func (*Interpreter) VisitExpressionStatement ¶
func (i *Interpreter) VisitExpressionStatement(s *ast.ExpressionStatement)
func (*Interpreter) VisitForEachStatement ¶
func (i *Interpreter) VisitForEachStatement(s *ast.ForEachStatement)
func (*Interpreter) VisitFunctionStatement ¶
func (i *Interpreter) VisitFunctionStatement(s *ast.FunctionStatement)
func (*Interpreter) VisitGetExpression ¶
func (i *Interpreter) VisitGetExpression(e *ast.GetExpression) any
func (*Interpreter) VisitGroupedExpression ¶
func (i *Interpreter) VisitGroupedExpression(ge *ast.GroupingExpression) any
func (*Interpreter) VisitIfStatement ¶
func (i *Interpreter) VisitIfStatement(s *ast.IfStatement)
func (*Interpreter) VisitIndexExpression ¶
func (i *Interpreter) VisitIndexExpression(e *ast.IndexExpression) any
func (*Interpreter) VisitIndexedAssignmentExpression ¶
func (i *Interpreter) VisitIndexedAssignmentExpression(e *ast.IndexedAssignmentExpression) any
func (*Interpreter) VisitLambdaExpression ¶
func (i *Interpreter) VisitLambdaExpression(e *ast.LambdaExpression) any
func (*Interpreter) VisitLiteralExpression ¶
func (*Interpreter) VisitLiteralExpression(le *ast.LiteralExpression) any
func (*Interpreter) VisitLogicalExpression ¶
func (i *Interpreter) VisitLogicalExpression(le *ast.LogicalExpression) any
func (*Interpreter) VisitLoopStatement ¶
func (i *Interpreter) VisitLoopStatement(s *ast.LoopStatement)
func (*Interpreter) VisitMapExpression ¶
func (i *Interpreter) VisitMapExpression(e *ast.MapExpression) any
func (*Interpreter) VisitReturnStatement ¶
func (i *Interpreter) VisitReturnStatement(s *ast.ReturnStatement)
func (*Interpreter) VisitSequenceExpression ¶
func (i *Interpreter) VisitSequenceExpression(e *ast.SequenceExpression) any
func (*Interpreter) VisitSetExpression ¶
func (i *Interpreter) VisitSetExpression(e *ast.SetExpression) any
func (*Interpreter) VisitSuperGetExpression ¶
func (i *Interpreter) VisitSuperGetExpression(e *ast.SuperGetExpression) any
func (*Interpreter) VisitSuperSetExpression ¶
func (i *Interpreter) VisitSuperSetExpression(e *ast.SuperSetExpression) any
func (*Interpreter) VisitTernaryExpression ¶
func (i *Interpreter) VisitTernaryExpression(e *ast.TernaryExpression) any
func (*Interpreter) VisitThisExpression ¶
func (i *Interpreter) VisitThisExpression(e *ast.ThisExpression) any
func (*Interpreter) VisitUnaryExpression ¶
func (i *Interpreter) VisitUnaryExpression(ue *ast.UnaryExpression) any
func (*Interpreter) VisitVarStatement ¶
func (i *Interpreter) VisitVarStatement(s *ast.VarStatement)
func (*Interpreter) VisitVariableExpression ¶
func (i *Interpreter) VisitVariableExpression(e *ast.VariableExpression) any
type LoxCallable ¶
type LoxCallable interface { Arity() int Call(interpreter *Interpreter, arguments []any) (any, error) }
type LoxClass ¶
type LoxClass struct { Name string Methods map[string]*LoxFunction Super *LoxClass }
type LoxControl ¶
type LoxControl struct {
// contains filtered or unexported fields
}
func LoxReturn ¶
func LoxReturn(value any) *LoxControl
type LoxFunction ¶
type LoxFunction struct {
// contains filtered or unexported fields
}
func (LoxFunction) Arity ¶
func (f LoxFunction) Arity() int
func (*LoxFunction) Call ¶
func (f *LoxFunction) Call(interpreter *Interpreter, arguments []any) (returnValue any, err error)
type LoxInstance ¶
func NewLoxInstance ¶
func NewLoxInstance(class *LoxClass) *LoxInstance
type LoxNative ¶
type LoxNative interface { LoxCallable Name() string }
Click to show internal directories.
Click to hide internal directories.