Question
input_sourcecode.txt int main ( ) { for ( int i = 22; i Write a lexer from scratch by designing and implementing FSA that returns
input_sourcecode.txt
int main ( ) { for ( int i = 22; i Write a lexer from scratch by designing and implementing FSA that returns the tokens from the simple source code in C++ in the given file "input_soucecode.txt". In your final build, at least you need design and implement FSA for tokens identifier and integer, the rest can be written ad-hoc. Otherwise, there will be a deduction of 5 points! - Requirement of design part: you need to provide lexical specification using REs and draw state-transition diagrams using FSA that is implemented in the Lexer for the above required tokens (at least): identifier and integer and wrap them into a document named as "myDesign.doc". - Requirement of implementation part: the implementation of your design is an executable program, and it is expected to write in C/C++ or Python. In your program, name a function as lexer 0 to read and return the next token. - Requirement of output part: you need to print out the result in the form of Two (2) columns, one column for tokens and the other for lexemes, and save it into a document named as "output" (see an example I/O as below). - Requirement of user manual part: you need write a "readme" file to briefly specify how to setup/run your program. - Requirement of submission part: your final submission to Canvas must have Five (5) files: the given "input_soucecode.txt", design file, your program, output file, and a readme file. Example: Lexer splits the source text into a sequence of tokens, skipping blanks, newlines, and comments. See the I/O as below. Note: you can customize your token classes and names, and then attach with the corresponding lexemes. Sample Input (source code text): while (x>1)y=23.00 Sample Output in the form of table
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started