Table of Contents

Class Interpreter

Namespace
flx.SILQ.Core
Assembly
flx.SILQ.dll

Provides core evaluation logic for the SILQ interpreter, including arithmetic operations, type checking, and expression evaluation.

public class Interpreter : IVisitor<object>, IVisitor
Inheritance
Interpreter
Implements
Inherited Members

Constructors

Interpreter(object)

Initializes a new instance of the Interpreter class with the specified context.

public Interpreter(object context)

Parameters

context object

The context in which the interpreter operates.

Methods

Interpret(List<Statement>)

Interprets a list of statements by executing each statement in order. Throws a RuntimeError if an error occurs during execution.

public void Interpret(List<Statement> statements)

Parameters

statements List<Statement>

The list of statements to interpret.

Interpret(Expression)

Interprets the given expression by evaluating it and converting the result to a string.

public string Interpret(Expression expression)

Parameters

expression Expression

The expression to interpret.

Returns

string

The string representation of the evaluated expression.

Visit(Binary)

Visits a Binary expression and evaluates it according to its operator and operands.

public object Visit(Binary binary)

Parameters

binary Binary

The binary expression to evaluate.

Returns

object

The result of the binary operation.

Visit(Function)

Visits a Function expression and processes its behavior.

public object Visit(Function function)

Parameters

function Function

The function expression to evaluate.

Returns

object

The result of the function evaluation.

Visit(Grouping)

Visits a Grouping expression and evaluates its contained expression.

public object Visit(Grouping grouping)

Parameters

grouping Grouping

The grouping expression to evaluate.

Returns

object

The result of the evaluated grouping expression.

Visit(Literal)

Visits a Literal expression and returns its value, converting to double if possible.

public object Visit(Literal literal)

Parameters

literal Literal

The literal expression to evaluate.

Returns

object

The value of the literal, possibly as a double.

Visit(Unary)

Visits a Unary expression and evaluates it according to its operator.

public object Visit(Unary unary)

Parameters

unary Unary

The unary expression to evaluate.

Returns

object

The result of the unary operation.

Visit(Variable)

Visits a Variable expression and retrieves its value from the environment.

public object Visit(Variable variable)

Parameters

variable Variable

The variable expression to evaluate.

Returns

object

The value of the variable from the environment.

Visit(As)

Implements the visitor method for the As statement.

public void Visit(As statement)

Parameters

statement As

The "As" statement to process.

Visit(From)

Implements the visitor method for the From statement.

public object Visit(From from)

Parameters

from From

The "From" statement to process.

Returns

object

Visit(Function)

Implements the visitor method for the Function statement.

public void Visit(Function statement)

Parameters

statement Function

The "Function" statement to process.

Visit(Print)

Implements the visitor method for the Print statement. Evaluates the expression and writes its string representation to the console.

public void Visit(Print print)

Parameters

print Print

The print statement to execute.

Visit(Select)

Implements the visitor method for the Select statement.

public void Visit(Select select)

Parameters

select Select

The "Select" statement to process.

Visit(Where)

Implements the visitor method for the Where statement.

public void Visit(Where where)

Parameters

where Where

The "Where" statement to process.