The University of Lahore Compiler Construction: Term Project (Phase-1)
The University of Lahore Compiler Construction: Term Project (Phase-1)
Compiler Construction
Term Project (Phase-1)
UOL-Compiler:
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:
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
GOOD LUCK ☺