Added parser project
This commit is contained in:
18
parser/CMakeLists.txt
Normal file
18
parser/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# Fetches all .cpp files for the binary #
|
||||
add_library(Parser STATIC
|
||||
src/Parser.cpp
|
||||
"inc/Parser.h")
|
||||
|
||||
# Adds the headers in the current directory #
|
||||
target_include_directories (
|
||||
Parser PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/inc
|
||||
)
|
||||
|
||||
# Links to the Lexer and AST so it can use their data types #
|
||||
target_link_libraries(Parser PUBLIC Lexer)
|
||||
target_link_libraries(Parser PUBLIC AST)
|
||||
|
||||
# Creates the precompiled header of the binary #
|
||||
target_include_directories(Parser PRIVATE ${CMAKE_SOURCE_DIR}/common)
|
||||
target_precompile_headers(Parser PRIVATE ${CMAKE_SOURCE_DIR}/common/LXC.h)
|
||||
19
parser/inc/Parser.h
Normal file
19
parser/inc/Parser.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <LXC.h>
|
||||
|
||||
#include <NodeTypes.h>
|
||||
#include <Lexer.h>
|
||||
|
||||
namespace LXC::Parser
|
||||
{
|
||||
struct ParserError {};
|
||||
|
||||
struct FunctionAST
|
||||
{
|
||||
std::string name;
|
||||
AST::SyntaxBranch contents;
|
||||
};
|
||||
|
||||
Util::ReturnVal<std::vector<FunctionAST>, ParserError> TurnTokensIntoAST(const Lexer::LexerOutput& input);
|
||||
}
|
||||
11
parser/src/Parser.cpp
Normal file
11
parser/src/Parser.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <LXC.h>
|
||||
|
||||
#include <Parser.h>
|
||||
|
||||
namespace LXC::Parser
|
||||
{
|
||||
Util::ReturnVal<std::vector<FunctionAST>, ParserError> TurnTokensIntoAST(const Lexer::LexerOutput& input)
|
||||
{
|
||||
return Util::FunctionFail<ParserError>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user