can now parse prefix expressions!

This commit is contained in:
Karma Riuk
2025-07-09 12:02:01 +02:00
parent c7a30a0028
commit 7f1cc6f45e
6 changed files with 118 additions and 52 deletions

View File

@@ -0,0 +1,19 @@
#include "prefix.hpp"
#include "token/token.hpp"
namespace ast {
prefix_expr::prefix_expr(token::token token, std::string op)
: token(std::move(token)),
op(op),
right(nullptr) {}
std::string prefix_expr::token_literal() const {
return token.literal;
}
std::string prefix_expr::str() const {
return token.literal + right->str();
}
} // namespace ast