Question: The first assignment is to write a lexical analyzer (lexer) in C++ language You can build your entire lexer using a Finite State Machine(FSM) Or

 The first assignment is to write a lexical analyzer (lexer) in

The first assignment is to write a lexical analyzer (lexer) in C++ language You can build your entire lexer using a Finite State Machine(FSM) Or build using at least FSMs for identifier, integer and real (the rest can be written ad-hoc) but YOUHAVE TO CONSTRUCTA Finite State Machine for this assignment otherwise, there will be a deduction of 2 points!' The Lexer A major component of your assignment will be to write a procedure (Function) - lexer Q that returns a token when it is needed. Your lexer) should return a record, one field for the token and another field the actual "value" of the token (lexeme), i.e. the instance of a token. Your main program should test the lexer i.e., your program should read a file containing the source code of Rat18S to generate tokens and write out the results to an output file Make sure that you print both, the tokens and lexemes Basically, your main program should work as follows while not finished (i.e. not end of the source file) do call the lexer for a token print the token and lexeme Source code while(fah upper) a= 23.00 Output lexeme while token keyword separator identifieir identifier separator identifier operato rea upper The first assignment is to write a lexical analyzer (lexer) in C++ language You can build your entire lexer using a Finite State Machine(FSM) Or build using at least FSMs for identifier, integer and real (the rest can be written ad-hoc) but YOUHAVE TO CONSTRUCTA Finite State Machine for this assignment otherwise, there will be a deduction of 2 points!' The Lexer A major component of your assignment will be to write a procedure (Function) - lexer Q that returns a token when it is needed. Your lexer) should return a record, one field for the token and another field the actual "value" of the token (lexeme), i.e. the instance of a token. Your main program should test the lexer i.e., your program should read a file containing the source code of Rat18S to generate tokens and write out the results to an output file Make sure that you print both, the tokens and lexemes Basically, your main program should work as follows while not finished (i.e. not end of the source file) do call the lexer for a token print the token and lexeme Source code while(fah upper) a= 23.00 Output lexeme while token keyword separator identifieir identifier separator identifier operato rea upper

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!