The interpreter class is responsible for evaluating the AST

Hierarchy

  • Beer

Implements

Constructors

Properties

environment: Environment = ...
globals: Environment = ...
locals: Map<Expr, number> = ...

Methods

  • Analog to this.evaluate() but for statements

    Parameters

    • stmt: Stmt

      ast.Stmt to be executed

    Returns void

  • Execute a list of statements in an given environment

    Parameters

    • statements: Stmt[]

      list of statements

    • environment: Environment

      environment to execute the statements in.

    Returns void

  • Set resolved values to the locals of the interpreter

    Parameters

    • expr: Expr

      ast.Expr to be interpreted

    • depth: number

      The depth of the expression

    Returns void

  • Converts the object to a string representation

    Parameters

    Returns string

    string representation of the object

  • Parameters

    • stmt: BlockStmt

      The block statement to be evaluated

    Returns void

  • Parameters

    • stmt: ClassStmt

      The statement to be evaluated

    Returns void

  • Evaluate the expression

    Parameters

    Returns void

    void;

  • Parameters

    • stmt: ForStmt

      The statement to be evaluated

    Returns void

    void;

  • Parameters

    Returns void

    void;

  • If statement visitor

    Parameters

    • stmt: IfStmt

      The if statement to be evaluated

    Returns void

  • Print the evaluated expression

    Parameters

    • stmt: PrintStmt

      The expression to be evaluated

    Returns void

    void;

  • Parameters

    Returns void

  • Evaluate the stmt and define in the environment

    Parameters

    • stmt: VarStmt

      The statment to be evaluated

    Returns void

    void;

  • Parameters

    • stmt: WhileStmt

      The expression to be evaluated

    Returns void

    void;

Generated using TypeDoc