Need Parser code only Lexical Analyzer: For the first task of the frontend, you will use flex to create a

Need Parser code only Lexical Analyzer: For the first task of the frontend, you will use flex to create a

Question:

Need Parser code only  

Transcribed Image Text:

Lexical Analyzer: For the first task of the frontend, you will use flex to create a scanner for the Structured Query Language (SQL-MySQL). Figure out all the tokens your query language allows and write them out in a Lex file. Submit the Lex file alongwith example source files. Make sure examples cover most of the queries supported by SQL. At least following features are expected. 1. Data Definition Language (DDL) Statements a. CREATE b. ALTER C. DROP 2. Data Manipulation Language (DML) Statements a. SELECT b. DELETE C. INSERT UPDATE d. 3. Builtin Functions. 4. WHERE Clause Your scanner will identify all tokens from a source input file and store in an output file including, token_id, token, line number. CC CS424 (TERM PROJECT) PAGE 2 Parser: In this phase you will extend your compiler (at this point it’s nothing more than a lexer) to handle the syntax analysis phase, the second task of the frontend, by using bison to create a parser. The parser will read SQL source queries and construct a parse tree. If no syntax errors are encountered, your code will print the completed parse tree as flat text. At this stage, you aren’t responsible for verifying meaning, just structure. You can create a parser using either top-down or bottom-up parsing methods. Bottom-up parsers can be built using Bison.

Expert Answer: