Compiler Construction: University of Central Punjab
Compiler Construction: University of Central Punjab
Compiler Construction
Project Phase # 2
TINY-C++:
This is a subset of C++ language. Description of the language as follow:
Detail Example
1 Identifiers (_|L)(L|_|D)*(D|_) _rate2, _rate_,
rat1e2 …etc
2 Numbers [+-]?(D+)(\.D+)?, and exponent numbers. 3.43433E+13,
3 Operators <,>,!=, <>, :=, ==, *, +, /,-, >>,<<, ++, +=, &&, ||, =>, =< , %,
4 Punctuations [,{,(,),},]
5 Keyword C-Compiler UCP-Compiler
While Loop
do-while do-loop
For round
If Iff
If-else iif-else
cin >> , cout << input -> , output <-
Minimal Grammar
Assignment Description:
For this assignment,
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 an ‘0’ 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 should know about the data
structure.
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. A text file will show the productions in separate lines used in building the parse tree.
4. A text file show the errors generated from both scanner and parser.