0% found this document useful (0 votes)
19 views2 pages

Spring 2024 - CS606 - 1

The document provides instructions for an assignment on compiler construction. It details rules for marking including submission format and deadline. It also lists the topic covered and provides contact information for queries. The assignment requires students to identify tokens and their types from C++ code sample given as input to a lexical analyzer.

Uploaded by

alishhid6
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)
19 views2 pages

Spring 2024 - CS606 - 1

The document provides instructions for an assignment on compiler construction. It details rules for marking including submission format and deadline. It also lists the topic covered and provides contact information for queries. The assignment requires students to identify tokens and their types from C++ code sample given as input to a lexical analyzer.

Uploaded by

alishhid6
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

CS606 – Compiler Construction Total marks = 20

Assignment # 01 Deadline
th
29 of April 2024
Spring 2024

Please carefully read the following instructions before attempting the assignment.

RULES FOR MARKING


It should be clear that your assignment would not get any credit if:
 The assignment is submitted after the due date.
 The submitted assignment does not open or the file is corrupt.
 Strict action will be taken if the submitted solution is copied from any other student or the
internet.

You should consult the recommended books to clarify your concepts as handouts are not sufficient.
You are supposed to submit your assignment in Doc or Docx format.
Any other formats like scan images, PDF, ZIP, RAR, PPT, BMP, etc. will not be accepted.

Topic Covered
Lecture 01 to Lecture 10

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding
or internet malfunctioning etc.). Hence refrain from uploading assignments in the last hour of the deadline. It is
recommended to upload the solution at least two days before its closing date.

If you people find any mistake or confusion in the assignment (Question statement), please consult with your
instructor before the deadline. After the deadline, no queries will be entertained in this regard.

For any query, feel free to email me at:


[email protected]
Question No 01 Marks (20)
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

1 for Keyword

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

Token Types: Some typical token types with examples are as follows;

Token Type Examples

Identifier Variable Names (x, size and number etc.)

Keyword if, else and return etc.

Integer 10, 101 and 313 etc.

Float 12.26 and 0.0012 etc.

Symbol ( ) + { } - , and ; etc.

String Words between double quotes ""

You might also like