36 lines
724 B
C++
36 lines
724 B
C++
#ifndef INTERPRETER_H
|
|
#define INTERPRETER_H
|
|
|
|
#include <string>
|
|
#include <stdexcept>
|
|
#include "types.h"
|
|
#include "memory.h"
|
|
#include "errors.h"
|
|
using namespace std;
|
|
|
|
/*
|
|
Evaluates the AST, returning the latest calulated value
|
|
*/
|
|
EvalResult eval(Node &ast, Memory& memory);
|
|
|
|
class BreakException : public InternalError {
|
|
public:
|
|
explicit BreakException(CodePosition pos)
|
|
: InternalError(pos) {}
|
|
};
|
|
|
|
class ContinueException : public InternalError {
|
|
public:
|
|
explicit ContinueException(CodePosition pos)
|
|
: InternalError(pos) {}
|
|
};
|
|
|
|
class ReturnException : public InternalError {
|
|
public:
|
|
EvalResult val;
|
|
|
|
explicit ReturnException(EvalResult val)
|
|
: InternalError(), val(val) {}
|
|
};
|
|
|
|
#endif |