0% found this document useful (0 votes)
13 views

Assignment 01

Compiler construction

Uploaded by

shizamalik783
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Assignment 01

Compiler construction

Uploaded by

shizamalik783
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment – 01 (Total Marks 10)

DEPARTMENT OF COMPUTER SCIENCE (GCWUS)


Compiler Construction (CS-322) Fall 2024 (Semester 5th BS-CS)
Assignment Date: 10-01-2025 Submission Date: 15-01-2025

NOTE:
 This assignment covers Lecture slides # 1 to 5.
 Submissions after deadline will not be considered.

Question #1 Marks = 5 + 2 +3 = 10
i. Consider the following stream of characters as input to the lexical analyzer (i.e., scanner)

for (int i = 0; i < 10; i++) {

if (i % 2 == 0) {

cout << "Even number: " << i << endl;

} else {

cout << "Odd number: " << i << endl;


}
}

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.

No Token Type

Note: You can add/delete rows in this table as per your requirement.

ii. Construct a Transition Table with the help of following Transition Graph of a Typical
NFA.
iii. Draw a Transition Graph with the help of following transition table of typical NFA.
0 1 Ε
A A,B E
B C A D,E
C D B,C
D D,E C
E A D,E
Table: Transition Table of a typical NFA
Note: In transition table, ε represents epsilon (i.e., empty / null input).

_______________________________GOOD LUCK_______________________________________

You might also like