A tool, developed with Flex/Bison, is intended for parsing C language program and output the ASTof it.
How to use the three files to generate a C language syntax analyser, let us get you started with it.
-
In command line prompt, type "flex lex.l" and then press Enter key, so you will see a new generated file with the name of lex.yy.c;
-
type "bison -d parser.y" and then press Enter key, so you will also find a new generated file whose name is parser.tab.c;
-
type "gcc -o ASTGenerator lex.yy.c parser.tab.c" and then ASTGenerator will be generated by default.