From 560a585091f1948efb47d58c82dede281ebef54d Mon Sep 17 00:00:00 2001 From: martin dobrev Date: Fri, 7 Sep 2018 19:00:01 +0300 Subject: Introduce Parser and Expression hierarchy. --- JSImpl/src/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'JSImpl/src/main.cpp') diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp index 1b345c3..43c063d 100644 --- a/JSImpl/src/main.cpp +++ b/JSImpl/src/main.cpp @@ -1,7 +1,10 @@ #include "Lexer.h" +#include "Parser.h" #include #define LOG(msg) std::cout << msg << std::endl #define EXECUTE_TEST(test) std::cout << #test << " "; test(); + +// Lexer Tests void TestLess() { auto tokens = Tokenize("<"); @@ -70,6 +73,13 @@ void TestVariableDeclaration() LOG("FAIL"); } } +// Parser Tests +void TestParseUnaryExpr() +{ + // TODO make actual test :D + auto expr = Parse(Tokenize("-10")); + expr->Print(std::cout); +} int main() { @@ -78,6 +88,7 @@ int main() EXECUTE_TEST(TestString); EXECUTE_TEST(TestKeyWord); EXECUTE_TEST(TestVariableDeclaration); + EXECUTE_TEST(TestParseUnaryExpr); std::system("pause"); return 0; } \ No newline at end of file -- cgit v1.3.1-23-gd82d