add tree builder, fix multiple bugs

This commit is contained in:
2026-10-07 16:15:42 +03:00
parent b365e1d05c
commit afb4b5de20
4 changed files with 168 additions and 25 deletions
+11 -13
View File
@@ -7,18 +7,6 @@
namespace Expression {
#if 0
namespace TokenType {
enum TokenType {
VAR,
CONST,
OPERATOR
};
}
#endif
class Token {
public:
enum TokenType {
@@ -310,7 +298,17 @@ class TreeNode {
public:
TreeNode *l; // left hand
TreeNode *r; // right hand
Token o; // operator
Token o; // if operator, left and right hands are valid
// if value, left and right hands should be null
explicit TreeNode(void)
{
}
explicit TreeNode(const Token t)
: o(t)
{
}
~TreeNode()
{