0% found this document useful (0 votes)
78 views4 pages

Compiler Construction: Project (Phase-1) (Section A, B, C, D) Fall (2015)

This document provides instructions for a compiler construction project involving implementation of a lexical analyzer or scanner. It is divided into four parts worth a total of 105 marks. Part 1 involves defining regular expressions for all token types and is worth 15 marks. Part 2 involves generating NFAs or DFAs for each regular expression and is worth 10 marks. Part 4 involves coding the scanner in C++ and is worth 80 marks. Rules specify this is an individual assignment and plagiarism will result in zero marks. Tools specified are C++ and custom data structures can be used if shown to the instructor first. The criteria for evaluation include correctness of code, handling of valid and invalid input, and reflecting concepts discussed in class.

Uploaded by

stace001
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)
78 views4 pages

Compiler Construction: Project (Phase-1) (Section A, B, C, D) Fall (2015)

This document provides instructions for a compiler construction project involving implementation of a lexical analyzer or scanner. It is divided into four parts worth a total of 105 marks. Part 1 involves defining regular expressions for all token types and is worth 15 marks. Part 2 involves generating NFAs or DFAs for each regular expression and is worth 10 marks. Part 4 involves coding the scanner in C++ and is worth 80 marks. Rules specify this is an individual assignment and plagiarism will result in zero marks. Tools specified are C++ and custom data structures can be used if shown to the instructor first. The criteria for evaluation include correctness of code, handling of valid and invalid input, and reflecting concepts discussed in class.

Uploaded by

stace001
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/ 4

Compiler Construction

Project (Phase-1)
Fall (2015)

(Section A, B, C, D)

Submission Before: 6:00 PM - 07-10-2015


(Late will be penalty of deduction of 2 absolute marks per day)
UCP-Compiler:
This is a subset of C++ language. Description of the language as follow:
Detail
1

Reserve words

CONST , FLOAT , INT , BREAK ,


CONTINUE , ELSE , FOR , SWITCH
, VOID , CASE , ENUM ,
SIZEOF , TYPEDEF ,CHAR ,DO ,
IF , RETURN , UNION , WHILE,
UCP, DEAN, HOD, and, or

Identifiers

examples (val1u__e, r2a_te,


C1o_unter, _test123, etc)

Numbers

Operators

User
input/output

example (123,223, 23.5, 0.45


etc)
<,>,!=, <>, :=, ==, *, +, /,-,
>>>,<<<, ++, +=, -=, --, &&,
||, |& as XOR , &| as NOR ;
Input>>>, output<<<

Note
#DEFINE // define is
keyword
DEFINE
// id
#INCLUDE // include is
keyword
INCLUDE // id
__ cannot be an
identifier.
_ always with some
letter.
Id contain at least one
_.
_ cannot be last symbol
of id.
Must have one or more
digit.
Not start with Digit.

>>> use instead of


>>
<<< use instead of
<<

7
8

Punctuations
Comments

[,{,(,),},],,
//this is comment
/*-----*/

Assignment Description:
For this assignment, you have to implement a lexical analyzer, also called a scanner.
This assignment includes following parts:
PARTS

Output

Marks

Define Lexical Specification (Regular Expressions)


for all token types.

Document

15

Generate NFA for each regular expression or


complete DFA

Document

10

Code

Source Code
Files

80

Total

105

Absolute

10

Rules:
1. This is an individual assignment. Each student has to submit his/her
assignment work.
2. Group discussion is allowed but dont share code and other part of
assignment with other student.
3. Plagiarism is not tolerable in any of its form. Minimum penalty would be
ZERO marks in the project module.

Tools:
Language (For Development):

C++

Note: Student cannot use built-in data structure. Student can use his own data
structure Hash Table, Linked List which he/she developed in data structure
course. In this case student has to show me the code before using it.

Evaluating Criteria:
1. Source code should reflect the detail given in documents (other parts).
2. A text file with valid source code will be input of the scanner and Token file
will be output of the scanner tool.
3. All points discussed in the class related to scanner implementation should
reflect in the assignment.

4. Application should not do which is not supposed to do.

5. In case of invalid source code tool must generate error list.

GOOD LUCK

You might also like