From ba2e99d3a3816e1e9f5c73a1826e2250c26c9716 Mon Sep 17 00:00:00 2001 From: Nathanne Isip Date: Fri, 13 Sep 2024 10:02:36 +0800 Subject: [PATCH] Updated Zhivo main source file --- src/Zhivo.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Zhivo.cpp b/src/Zhivo.cpp index a41a766..2ef03c6 100644 --- a/src/Zhivo.cpp +++ b/src/Zhivo.cpp @@ -101,7 +101,7 @@ auto interpreter() -> int { ); auto funcDecl = std::make_unique( std::move(myFunc), - std::vector{}, + std::vector>{}, std::move(funcBody) ); @@ -308,17 +308,16 @@ auto interpreter() -> int { } decltype(interpreter()) main() { - SymbolTable symbols; - - Parser parser = Parser::fromFile("test.zhv"); - parser.parse(); + try { + SymbolTable symbols; + Parser parser = Parser::fromFile("test.zhv"); + parser.parse(); - for(const auto& statement : parser.getGlobalStatements()) { - DynamicObject object = statement->visit(symbols); - std::cout << "Result: " << object.toString() << std::endl; - } + for(const auto& statement : parser.getGlobalStatements()) { + DynamicObject object = statement->visit(symbols); + std::cout << "Result: " << object.toString() << std::endl; + } - try { return interpreter(); } catch (const std::exception& exc) {