From da008507b6e0409b7a06984194a5eb9b149caac9 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 12 Feb 2017 20:58:29 +0000 Subject: Kind of working --- c_parser/src/#parser_main.cpp# | 13 +++++++++++++ c_parser/src/c_lexer.flex | 4 ---- c_parser/src/parser_main.cpp | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 c_parser/src/#parser_main.cpp# (limited to 'c_parser/src') diff --git a/c_parser/src/#parser_main.cpp# b/c_parser/src/#parser_main.cpp# new file mode 100644 index 0000000..3dff644 --- /dev/null +++ b/c_parser/src/#parser_main.cpp# @@ -0,0 +1,13 @@ +#include "ast.hpp" + +#include + +int main(int argc, char *argv[]) { + + const Expression *ast = parseAST(); + ast->print(); + + std::cout << std::endl; + + return 0; +} diff --git a/c_parser/src/c_lexer.flex b/c_parser/src/c_lexer.flex index 49997ed..96f6f26 100644 --- a/c_parser/src/c_lexer.flex +++ b/c_parser/src/c_lexer.flex @@ -42,10 +42,6 @@ ALL . ; { return T_SC; } -{OPERATOR} { yylval.string = new std::string(yytext); return T_OPERATOR; } - -({HEXCONSTANT}|{OCTALCONSTANT}|{DECIMALCONSTANT})|{INTEGERSUFFIX}? { yylval.number=strtod(yytext, 0); return T_CONSTANT; } - {WHITESPACE} { ; } . { fprintf(stderr, "Invalid token\n"); exit(1); } diff --git a/c_parser/src/parser_main.cpp b/c_parser/src/parser_main.cpp index fe80cb7..3dff644 100644 --- a/c_parser/src/parser_main.cpp +++ b/c_parser/src/parser_main.cpp @@ -6,6 +6,8 @@ int main(int argc, char *argv[]) { const Expression *ast = parseAST(); ast->print(); + + std::cout << std::endl; return 0; } -- cgit