commit | 923bd53c571fdb9671a2eac3e18f6ef49b3e1229 | [log] [tgz] |
---|---|---|
author | swissChili <swisschili@fastmail.com> | Wed Dec 08 22:48:58 2021 -0800 |
committer | swissChili <swisschili@fastmail.com> | Wed Dec 08 22:48:58 2021 -0800 |
tree | c50c09362a82b03bafc9106f38dfeb018659f02a | |
parent | 07d325f9bf886bb9626ecb1d45b77d8149e014c7 [diff] [blame] |
Add REPL
diff --git a/Repl.h b/Repl.h new file mode 100644 index 0000000..a4939d3 --- /dev/null +++ b/Repl.h
@@ -0,0 +1,25 @@ +#pragma once + +#include <QString> +#include <QList> + +#include "Evaluator.h" +#include "AstNode.h" + +class Repl +{ +public: + Repl(); + + void start(); + char *prompt(); + +protected: + QString readLine(); + bool trySpecialCase(QString line); + bool tryEvaluate(QString line, QList<AstNode> *expr); + + Evaluator _eval; + + bool _running = true; +};