-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqt_interpreter.hpp
49 lines (32 loc) · 1.01 KB
/
qt_interpreter.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// File: qt_interpreter.hpp
// Author: Samuel McFalls
#ifndef QT_INTERPRETER_H
#define QT_INTERPRETER_H
#include <QObject>
#include <QGraphicsItem>
#include "interpreter.hpp"
class QtInterpreter: public QObject {
Q_OBJECT
public:
// Default construct an QtInterpreter with the default environment and an empty AST
QtInterpreter(QObject * parent = nullptr);
signals:
// a signal emitting a graphic to be drawn as a pointer
void drawGraphic(QGraphicsItem * item);
// a signal emitting an informational message
void info(QString message);
// a signal emitting an error message
void error(QString message);
public slots:
// a public slot that accepts and expression string and parses/evaluates it
void parseAndEvaluate(QString entry);
private:
Interpreter interp;
void createGraphics(std::vector<Atom> item);
QString boolString(Expression exp);
QString numberString(Expression exp);
QString pointString(Expression exp);
QString lineString(Expression exp);
QString arcString(Expression exp);
};
#endif