0% found this document useful (0 votes)
132 views3 pages

The University of Lahore Compiler Construction: Term Project (Phase-1)

This document provides details for a term project to implement a lexical analyzer or scanner for a subset of the C++ language. The project consists of 4 parts worth a total of 100 marks: 1) defining regular expressions for token types (5 marks), 2) generating NFAs or DFAs for regular expressions (10 marks), 3) coding the pre-lexical analysis and lexical analysis (85 marks), and 4) absolute marks (10 marks). Rules prohibit plagiarism and sharing code. Students can use C++, Java, Python, or C# and built-in data structures. The criteria for evaluation include reflecting document details in the code, handling valid and invalid source code input/output, and implementing concepts discussed in

Uploaded by

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

The University of Lahore Compiler Construction: Term Project (Phase-1)

This document provides details for a term project to implement a lexical analyzer or scanner for a subset of the C++ language. The project consists of 4 parts worth a total of 100 marks: 1) defining regular expressions for token types (5 marks), 2) generating NFAs or DFAs for regular expressions (10 marks), 3) coding the pre-lexical analysis and lexical analysis (85 marks), and 4) absolute marks (10 marks). Rules prohibit plagiarism and sharing code. Students can use C++, Java, Python, or C# and built-in data structures. The criteria for evaluation include reflecting document details in the code, handling valid and invalid source code input/output, and implementing concepts discussed in

Uploaded by

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

THE UNIVERSITY OF LAHORE

Compiler Construction
Term Project (Phase-1)

Submission Date: Tuesday 10th March 2020


(Late will be penalty of deduction of 2 absolute marks per day)

UOL-Compiler:

This is a subset of C++ language. Description of the language as follow:

Detail Note
1 Reserve words CONST , FLOAT , INT , BREAK , #DEFINE // define is keyword
CONTINUE , ELSE , FOR , SWITCH ,
DEFINE // Nothing
VOID , CASE , ENUM , SIZEOF ,
TYPEDEF ,CHAR ,DO , IF , RETURN ,
UNION , WHILE, UOP, DEAN, HOD, and, #INCLUDE // include is
or keyword
INCLUDE // Nothing
2 Identifiers examples (val1u__e, r2ate, C1o_unter, “_ _” cannot be an identifier.
2test123, etc “_” cannot be last symbol of id.
Must have one or more digit.
Can start with Digit.
3 Numbers example (123,223, 23.5, 0.45 etc)
4 Operators <,>,!=, <>, :=, ==, *, +, /,-, >>>,<<<, ++,
+=, -=, --, &&, ||, |& as XOR , &| as
NOR;
6 User input/output Input>>>, output<<< “>>>” use instead of >>
“<<<” use instead of <<
7 Punctuations [,{,(,),},],”,”
8 Comments //this is comment
/*-----*/
Project 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


1 Document 5
token types.

2 Generate NFA for each regular expression or complete DFA Document 10

4 Code (Pre Lex and Lexical Analysis) Source Code Files 85

Total 100

Absolute 10

Rules:
1. This is an individual assignment. Each student has to submit his/her assignment work.
2. Group discussion is allowed but don’t 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.

Tools:
Language (For Development): C++, JAVA, Python, C# (You can do in any of them in which you are
comfortable)

Note: Student can 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.
SCANNER
Sourcecode.txt Token.txt

Error.txt

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

GOOD LUCK ☺

You might also like