22 lines
412 B
C++
22 lines
412 B
C++
#ifndef INTERPRETER_H
|
|
#define INTERPRETER_H
|
|
|
|
#include <variant>
|
|
#include <string>
|
|
#include <stdexcept>
|
|
using namespace std;
|
|
|
|
using EvalResult = variant<int, monostate>;
|
|
|
|
class RuntimeError : public runtime_error {
|
|
public:
|
|
explicit RuntimeError(const string& message)
|
|
: runtime_error(message) {}
|
|
};
|
|
|
|
/*
|
|
Evaluates the AST, returning the latest calulated value
|
|
*/
|
|
EvalResult eval(Node &ast);
|
|
|
|
#endif |