CC Project Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Page 1 of 6

DHA Suffa University


CS-313–Compiler Construction
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)

Instructor: Ms. Raazia Soosan


Date of Submission: 4-December-2017
Page 2 of 6

DHA SUFFA UNIVERSITY


COMPILER CONSTRUCTION
FALL 2017
INSTRUCTOR: RAAZIA SOSAN

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

10. STACK FOR INPUT 1

11. PARSE TREE FOR INPUT 1


Page 6 of 6

12. SAMPLE INPUT 2

13. STACK FOR INPUT 2

14. PARSE TREE FOR INPUT 2

15. SAMPLE INPUT 3

16. STACK FOR INPUT 3

17. PARSE TREE FOR INPUT 3

18. SOURCE CODE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy