I'm taking a Compilers class this month, and we have 1 project consisting of 3 assignments, This is assignment 1, each assignment will have a different question posted. i hope to work with one person on all 3 parts of the project. "Compiler Project.pdf" attached bellow has info about all 3 parts.
This question is to do:
- The first assignment is to write a lexical analyzer (lexer) in C++ Make sure to see "Assignemnt 1.docx" attached for more info.
- Fill the "Documentation Template.docx" attached. 2-3 pages about "How to use the program" and "the design" of it.
in the source code, please make sure to add proper comments for each procedures, sections if necessary.
The Lexer
A major component of your assignment will be to write a procedure (Function) – lexer (), 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 Rat20SU to generate tokens and write out the results to an output file.
Make sure that you print both, the tokens and lexemes.