diff options
Diffstat (limited to 'c_parser')
-rw-r--r-- | c_parser/src/#parser_main.cpp# | 13 | ||||
-rw-r--r-- | c_parser/src/c_lexer.flex | 4 | ||||
-rw-r--r-- | c_parser/src/parser_main.cpp | 2 |
3 files changed, 15 insertions, 4 deletions
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 <iostream> + +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; } |