From c973e90a64529e279f6fb41acc5d095111e494af Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 18 Jan 2024 21:12:56 +0100 Subject: [PATCH] Read file passed through argv[] --- CMakeLists.txt | 3 ++- src/main.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba8fbc2..c06b514 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,8 @@ set(CMAKE_CXX_STANDARD 20) include_directories(include) add_executable(bfuck - src/main.cpp + src/main.cpp + src/lex.cpp ) # target_link_libraries(lasm Boost::program_options) diff --git a/src/main.cpp b/src/main.cpp index 8df2028..befb7aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,15 @@ +#include "lex.hpp" + #include -int main() { - std::cout << "Hello, World!" << std::endl; +int main(int argc, char **argv) { + if (argc != 2) { + std::cout << "Usage: bfuck " << std::endl; + } + std::cout << "Running " << argv[1] << "...\n" << std::endl; + + std::string tokens; + lex_brainfuck_file(argv[1], tokens); + + return 0; } \ No newline at end of file