asu fall 2012: compiler construction - final presentation
DESCRIPTION
The presentation for the course Compiler Construction. The language was a subset of Object Oriented PascalTRANSCRIPT
![Page 1: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/1.jpg)
Compiler Construction Final presentation
Manish SinhaAnkit Mandhani
![Page 2: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/2.jpg)
Design: Features Supported● Parse Trees
● Semantic Checking
● Generation of three address codes and Control Flow Graph
● Code Generation– All expressions
– Multidimensional arrays
– Local, global and heap variables
– Loops and Branching
– Multiple class and objects
– Simple Method calls
– Print statements
![Page 3: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/3.jpg)
Features possible but not supported
● Complex Method Calls– Method calls with parameters
– Method calls using objects
– Recursion and nested method calls
● Optimizations– Value and extended value numbering
– Constant folding
● Control flow for Goto and Labels
![Page 4: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/4.jpg)
Not supported due to design limitations
● Code generation for local arrays
● Better heap and stack management
![Page 5: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/5.jpg)
Could have done differently
● Nested symbol table– For handling all cases of semantic checking
– For code generation
● More modular code for Project 4 to handle all cases of memory allocation and access efficiently
● More information in TAC
● Better and Quicker Design decisions for Project 2
![Page 6: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/6.jpg)
Collaboration
![Page 7: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/7.jpg)
Achieving Collaboration
● Design and Architecture
● Source code management– Using git
– Resolving merges and conflicts
– Diff and resolve tool
– Hosting code
● Bug tracking
![Page 8: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/8.jpg)
Lesson: How to improve collaboration
● Source code management– Better usage of branches
– Using rebase instead of merge
● Bug tracking: Using a real bug tracker
![Page 9: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/9.jpg)
Language: Possible Changes
● Return keywordassignment: assignment_statement
| ......
| return expression
● Last Statement not having semicolonstatement_sequences: statement_sequence SEMICOLON
statement_sequence: statement
| statement_sequence SEMICOLON statement
![Page 10: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/10.jpg)
Language Features
Possible new features
![Page 11: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/11.jpg)
for looping construct
e.g. for(i := 0; i < 4; i := i+1)Grammar changes:statement: for_statement
for_statement: FOR LPAREN for_statement_conditions RPAREN for_body
for_statement_conditions: statement SEMICOLON expression
SEMICOLON statement
for_body: PBEGIN statement_sequences END
![Page 12: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/12.jpg)
foreach looping construct
e.g. foreach(house: integer in houses)Grammar changes:statement: foreach_statement
foreach_statement: FOREACH LPAREN foreach_statement_conditions RPAREN for_body
foreach_statement_conditions: identifier COLON type_denoter in variable_access
![Page 13: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/13.jpg)
break construct
e.g. breakGrammar changes:statement: BREAK
![Page 14: ASU Fall 2012: Compiler Construction - Final Presentation](https://reader033.vdocument.in/reader033/viewer/2022060120/5591370c1a28ab14498b45a1/html5/thumbnails/14.jpg)
The end