Print the AST out

This commit is contained in:
2026-08-01 09:16:32 +10:00
parent 80649d77ae
commit 7df9f25119
5 changed files with 128 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <ostream>
#include <vector>
#include <optional>
@@ -42,8 +43,13 @@ namespace Solstice {
Node(NodeType type, const std::vector<Node>& children) : type(type), children(children) {}
Node(const Literal& literal) : type(NodeType::Literal), data(literal) {}
Node(const std::string& id) : type(NodeType::Identifier), data(id) {}
std::optional<Literal> getLiteral() const;
std::optional<std::string> getIdentifier() const;
};
std::ostream& operator<<(std::ostream& stream, const Node& node);
class Parser {
std::vector<Token> input;