Professional Documents
Culture Documents
Homework 1 CC
Homework 1 CC
Lexical analyzer: Lexical analyzer (LA) reads the source code as lexemes and converts
it into a sequence of tokens if a specific pattern matches. Your task is to implement a lexical
analyzer using any coding approach (LA using transition diagram, transition table, and lex/flex
tool). Your program should read the source program given below as sample input from a text
file “input.txt” and the output sequence of the token in another text file “output.txt”. Tokens
and corresponding Regular expressions from a lexical specification are given in Table 1.
1. Sample Input:
2. Sample Output:
Total Marks: 20 Submission Deadline: 19 April 2024
3. Submission Detail
Submit the transition diagram and transition table along with complete source code (any
language C/C++/Java/Python), input file, and output file.