Added modulus, comparators and relational ops

This commit is contained in:
2026-02-05 01:49:18 +03:00
parent 405e3f29ae
commit dbf1d5b261
7 changed files with 239 additions and 2 deletions

View File

@@ -39,6 +39,20 @@ struct RuntimeVar {
RuntimeVar operator*(const RuntimeVar& other) const;
RuntimeVar operator/(const RuntimeVar& other) const;
RuntimeVar operator%(const RuntimeVar& other) const;
RuntimeVar operator==(const RuntimeVar& other) const;
RuntimeVar operator!=(const RuntimeVar& other) const;
RuntimeVar operator>(const RuntimeVar& other) const;
RuntimeVar operator>=(const RuntimeVar& other) const;
RuntimeVar operator<(const RuntimeVar& other) const;
RuntimeVar operator<=(const RuntimeVar& other) const;
};
#endif // RUNTIME_H

View File

@@ -16,6 +16,18 @@ enum class TokenType {
TOK_SUB_OP,
TOK_DIV_OP,
TOK_MULT_OP,
TOK_MOD_OP,
TOK_OR, // ||
TOK_AND, // &&
TOK_EQ, // ==
TOK_NEQ, // !=
TOK_LT, // <
TOK_LT_EQ, // <=
TOK_GT, // >
TOK_GT_EQ, // >=
TOK_OPEN_PAREN, // (
TOK_CLOSE_PAREN, // )

View File

@@ -20,6 +20,14 @@ public:
private:
std::unique_ptr<Node> parseExpr();
std::unique_ptr<Node> parseOr(); // ||
std::unique_ptr<Node> parseAnd(); // &&
std::unique_ptr<Node> parseEquality(); // == !=
std::unique_ptr<Node> parseRelational(); // < > <= >=
std::unique_ptr<Node> parseAdditives();
std::unique_ptr<Node> parseFactors();