CC Project Report
CC Project Report
CC Project Report
Group Members:
1. Muhammad Karrar [Leader] (CS151055)
2. Nauman Khan (CS142004)
3. Asad Ali (CS151135)
4. Maaz Hussain (CS142026)
5. Muhammad Hamza Mian (CS151146)
Table of Contents
1. PROJECT DESCRIPTION:......................................................................................................................... 3
Compilation Process: ................................................................................. Error! Bookmark not defined.
Sample of Compilation Process: ............................................................ Error! Bookmark not defined.
Language Description:................................................................................ Error! Bookmark not defined.
2. TOKENS: ................................................................................................................................................ 3
3. REGULAR EXPRESSION: ......................................................................................................................... 4
4. THOMPSON CONSTRUCTION: ............................................................................................................... 4
5. SUBSET CONSTRUCTION ....................................................................................................................... 5
6. GRAMMAR ............................................................................................................................................ 5
7. LL(1) AUTOMATION: ............................................................................................................................. 5
8. PARSING TABLE ..................................................................................................................................... 5
9. SAMPLE INPUT 1 .................................................................................................................................. 5
10. STACK FOR INPUT 1 ........................................................................................................................... 5
11. PARSE TREE FOR INPUT 1 .................................................................................................................. 5
12. SAMPLE INPUT 2 ............................................................................................................................... 6
13. STACK FOR INPUT 2 ........................................................................................................................... 6
14. PARSE TREE FOR INPUT 2 .................................................................................................................. 6
15. SAMPLE INPUT 3 ............................................................................................................................... 6
16. STACK FOR INPUT 3 ........................................................................................................................... 6
17. PARSE TREE FOR INPUT 3 ................................................................................................................. 6
18. SOURCE CODE: .................................................................................................................................. 6
i) compilerProject.y ............................................................................... Error! Bookmark not defined.
ii) compilerProject.l ................................................................................ Error! Bookmark not defined.
iii) compilerProject.h............................................................................... Error! Bookmark not defined.
iv) compilerProject.txt ............................................................................ Error! Bookmark not defined.
Page 3 of 6
1. PROJECT DESCRIPTION:
2. TOKENS:
To implement such a language, we would be creating the following tokens:
1. START
2. DECLARE
3. VARIABLE
4. PRINT
5. TERMINATE
6. * (MULT)
7. + (ADD)
8. = (ASIG)
9. INTEGER
10. NEWLINE
Page 4 of 6
3. REGULAR EXPRESSION:
i) {keywords}
ii) {operators}
iii) {identifier}
iv) ";"$
v) ^[0-9]+$
vi) [0-9]+"."[0-9]+("e"|"E")("+"|"-")?[0-9]+$
vii) '(.*)'
viii) \"(.*)\"
ix) "//"(.*)
x) "/*"(.*)"*/"
4. THOMPSON CONSTRUCTION:
i)
ii)
iii)
Page 5 of 6
5. SUBSET CONSTRUCTION
i)
ii)
iii)
6. GRAMMAR
7. LR(0) AUTOMATION:
8. PARSING TABLE
9. SAMPLE INPUT 1