update with initial syntaxer implementation

This commit is contained in:
2026-10-04 14:13:14 +03:00
parent 79642d3fd1
commit f00ed50d32
8 changed files with 188 additions and 10 deletions
+22 -3
View File
@@ -66,6 +66,11 @@ public:
}
} v;
Token(void)
{
}
Token(std::string s)
: v(s)
{
@@ -168,9 +173,23 @@ public:
};
class TreeNode {
std::shared_ptr<Token> l; // left hand
std::shared_ptr<Token> o; // operation
std::shared_ptr<Token> r; // right hand
public:
TreeNode *l; // left hand
TreeNode *r; // right hand
Token o; // operator
~TreeNode()
{
if (l != nullptr)
{
delete l;
}
if (r != nullptr)
{
delete r;
}
}
};
}
+1 -1
View File
@@ -9,4 +9,4 @@
#define pr_debug(...) do {} while (0)
#endif
#define pr_warn(...) std::cout << "[" << __func__ << ":" << __LINE__ << "] warning: " << __VA_ARGS__ << "\n"
#define pr_warn(...) std::cout << "[" << __FILE__ << ":" << __LINE__ << " " << __func__ << "] warning: " << __VA_ARGS__ << "\n"
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <vector>
#include <memory>
#include "expression.hpp"
namespace Syntax
{
struct SyntaxIssue
{
};
std::vector<SyntaxIssue> check_syntax(std::vector<Expression::Token>& tv);
std::shared_ptr<Expression::TreeNode> build_op_tree(std::vector<Expression::Token>& tv);
}