22 lines
564 B
C++
22 lines
564 B
C++
#ifndef AST_INTERPRETER_HH
|
|
#define AST_INTERPRETER_HH
|
|
|
|
#include "expr.hh"
|
|
#include "../tokenizer.hh"
|
|
#include <string>
|
|
|
|
struct AstInterpreter {
|
|
void interpret(const Expr &expression);
|
|
|
|
private:
|
|
Object evaluate(const Expr &expr);
|
|
Object evaluate_binary_expression(const Expr &expr);
|
|
Object evaluate_grouping_expression(const Expr &expr);
|
|
Object evaluate_literal_expression(const Expr &expr);
|
|
Object evaluate_unary_expression(const Expr &expr);
|
|
bool is_truthy(const Object &object);
|
|
bool is_equal(const Object &left, const Object &right);
|
|
};
|
|
|
|
#endif
|