mirror of
https://github.com/allankoechke/cpp-expr-eval.git
synced 2026-11-30 17:11:34 +00:00
26 lines
461 B
C++
26 lines
461 B
C++
#ifndef INTERPRETER_H
|
|
#define INTERPRETER_H
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#include "runtime.h"
|
|
#include "../frontend/parser.h"
|
|
|
|
class Interpreter {
|
|
public:
|
|
Interpreter();
|
|
|
|
RuntimeVar eval(const std::string& input);
|
|
|
|
void addVar(const std::string& ident, RuntimeVar val);
|
|
|
|
RuntimeVar getVar(const std::string& ident);
|
|
|
|
private:
|
|
Parser parser;
|
|
std::unordered_map<std::string, RuntimeVar> m_vars;
|
|
};
|
|
|
|
#endif // INTERPRETER_H
|