summaryrefslogtreecommitdiff
path: root/node/ExprNode.hh
diff options
context:
space:
mode:
Diffstat (limited to 'node/ExprNode.hh')
-rw-r--r--node/ExprNode.hh43
1 files changed, 43 insertions, 0 deletions
diff --git a/node/ExprNode.hh b/node/ExprNode.hh
new file mode 100644
index 0000000..ac62975
--- /dev/null
+++ b/node/ExprNode.hh
@@ -0,0 +1,43 @@
+#ifndef PCC_EXPRNODE_H
+#define PCC_EXPRNODE_H
+
+#include "BaseNode.hh"
+#include "Type.hh"
+
+namespace pcc {
+class ExprNode : public BaseNode {
+ public:
+ ExprNode(Context* context);
+ virtual Value CodeGen() = 0;
+ std::shared_ptr<Type> GetType();
+
+ protected:
+ std::shared_ptr<Type> type_;
+};
+
+class BinaryExprNode : public ExprNode {
+ public:
+ BinaryExprNode(Context* context, BinaryOperator op,
+ std::shared_ptr<ExprNode> left,
+ std::shared_ptr<ExprNode> right);
+ virtual Value CodeGen();
+
+ protected:
+ BinaryOperator op_;
+ std::shared_ptr<ExprNode> left_, right_;
+};
+
+class UnaryExprNode : public ExprNode {
+ public:
+ UnaryExprNode(Context* context, UnaryOperator op,
+ std::shared_ptr<ExprNode> value);
+ virtual Value CodeGen();
+
+ protected:
+ UnaryOperator op_;
+ std::shared_ptr<ExprNode> value_;
+};
+
+} // namespace pcc
+
+#endif // !PCC_EXPRNODE_H