Files
BlitzLLVM/code_compiler/source/parser.hpp
T

55 lines
1.2 KiB
C++
Raw Normal View History

2024-06-25 18:59:15 +02:00
/// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
2024-06-26 00:31:06 +02:00
#include <filesystem>
2024-06-06 13:37:13 +02:00
#include "ast/ast.hpp"
2024-06-26 00:31:06 +02:00
#include "lexer.hpp"
namespace blitz {
class parser {
std::filesystem::path _file;
public:
~parser();
parser(std::filesystem::path file);
};
} // namespace blitz
/*
2024-06-06 13:37:13 +02:00
#include <fstream>
#include <map>
#include <memory>
#include <stack>
2024-06-26 00:31:06 +02:00
#include <string>
#include "ast/value.hpp"
#include "lexer.hpp"
2024-06-06 14:04:34 +02:00
namespace blitz {
class parser {
public:
2024-06-06 14:04:34 +02:00
parser(std::string file);
~parser();
2024-06-25 18:59:15 +02:00
std::unique_ptr<ast::expression> parse();
2024-06-06 13:37:13 +02:00
protected:
2024-06-25 18:59:15 +02:00
void log(const char* msg, ...);
void log_error(const char* msg, ...);
2024-06-06 13:37:13 +02:00
private:
2024-06-25 18:59:15 +02:00
std::pair<blitz::lexer::tokentype, std::string> next();
2024-06-06 13:37:13 +02:00
private:
2024-06-25 18:59:15 +02:00
std::unique_ptr<ast::expression> parse_expression();
std::unique_ptr<ast::NumberExpression> parse_number(blitz::lexer::tokentype token, std::string value);
std::unique_ptr<ast::DecimalExpression> parse_decimal(blitz::lexer::tokentype token, std::string value);
private:
2024-06-25 18:59:15 +02:00
lexer m_lexer;
2024-06-06 13:37:13 +02:00
std::stack<std::pair<std::string, std::shared_ptr<std::istream>>> m_files;
};
2024-06-06 13:37:13 +02:00
}
2024-06-26 00:31:06 +02:00
*/