2023-11-10 13:42:53 +01:00
|
|
|
#ifndef INTERPRETER_H
|
|
|
|
#define INTERPRETER_H
|
|
|
|
|
2023-11-15 13:40:37 +01:00
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
2023-11-22 13:52:16 +01:00
|
|
|
#include "types.h"
|
|
|
|
#include "memory.h"
|
2023-11-10 17:35:33 +01:00
|
|
|
using namespace std;
|
2023-11-10 13:42:53 +01:00
|
|
|
|
2023-11-10 17:35:33 +01:00
|
|
|
/*
|
|
|
|
Evaluates the AST, returning the latest calulated value
|
|
|
|
*/
|
2023-12-08 15:29:30 +01:00
|
|
|
EvalResult eval(Node &ast, Memory& memory);
|
2023-11-15 16:10:36 +01:00
|
|
|
|
2023-12-15 14:11:44 +01:00
|
|
|
class BreakException : public InternalError {
|
2023-12-13 12:22:58 +01:00
|
|
|
public:
|
2023-12-15 14:11:44 +01:00
|
|
|
explicit BreakException(CodePosition pos)
|
|
|
|
: InternalError(pos) {}
|
2023-12-13 12:22:58 +01:00
|
|
|
};
|
|
|
|
|
2023-12-15 14:11:44 +01:00
|
|
|
class ContinueException : public InternalError {
|
2023-12-13 12:22:58 +01:00
|
|
|
public:
|
2023-12-15 14:11:44 +01:00
|
|
|
explicit ContinueException(CodePosition pos)
|
|
|
|
: InternalError(pos) {}
|
2023-12-13 12:22:58 +01:00
|
|
|
};
|
|
|
|
|
2023-11-10 13:42:53 +01:00
|
|
|
#endif
|