diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-12 20:58:29 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-12 20:58:29 +0000 |
commit | da008507b6e0409b7a06984194a5eb9b149caac9 (patch) | |
tree | 082fa90b2c5979a300f2c9354973dd44cf09f606 /c_parser | |
parent | 3b0a7ae09d2f9770bfae9f5eed6a6667c9a3c1ca (diff) | |
download | Compiler-da008507b6e0409b7a06984194a5eb9b149caac9.tar.gz Compiler-da008507b6e0409b7a06984194a5eb9b149caac9.zip |
Kind of working
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; } |