Question: Update Lexer.flex and generate Lexer.java that returns tokens for mini - C compiler to Parser.java. You can print comments, white spaces, and new lines on
Update Lexer.flex and generate Lexer.java that returns tokens for miniC compiler to Parser.java. You can print comments, white spaces, and new lines on the console in Lexer.java; Update Parser.java that prints tokens returned by Lexer on the console in a form explained in the next page; You can add extra java programs if you need them. During the lexical analyzing process, your lexer should handle the compiler directive properly: your lexer should replace all lexemes defined by #define into their corresponding other lexemes and then should return their corresponding tokens Followings list a part or modified of keywords and symbols of the miniC language, which will be used in this project:
keywords: "print", "func", "var", "void", "bool", "int", "float", "struct", "size",
"new", if "else", "while", "return", "break", "continue", "true", "false",
"begin", "end", "addr", "value", "then"
symbols: ;:::
operator keywordssymbols: "and", or "not"
relativeoperator symbols:
The followings describe patterns of integer, real number, identifier, comment, newline, and whitespace:
int positive integers.
float positive real numbers except for integers, which have fractional parts but not exponential parts.
It can be etc., but not or or E
identifier C language identifier. It can start with a lowercase letter or a capital letter but not with
comment a string that starts with and ends at the end of line
block comment a string including newlines that starts with and ends with
newline
whitespace tr
Output:
hello
;
c : a b; hello
d : b
Success!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
