Spring 2024_CS606_1
Spring 2024_CS606_1
Assignment # 01 Deadline
th
29 of April 2024
Name : Asjad Subhan BC200203447
You are required to find the tokens produced by lexical analyzer and write them along with their types (types
are given below) in the following sample table.
Solution:
table with the tokens produced by the lexical analyzer along with their types:
Token Type
for Keyword
( Parenthesis
int Keyword
i Identifier
= Operator
0 Integer
; Semicolon
i Identifier
< Operator
10 Integer
; Semicolon
i++ Identifier
) Parenthesis
{ Brace
if Keyword
( Parenthesis
i Identifier
% Operator
2 Integer
== Operator
0 Integer
) Parenthesis
{ Brace
cout Identifier
Token Type
<< Operator
"Even number: " String Literal
<< Operator
i Identifier
<< Operator
endl Identifier
; Semicolon
} Brace
else Keyword
{ Brace
cout Identifier
<< Operator
<< Operator
i Identifier
<< Operator
endl Identifier
; Semicolon
} Brace
} Brace