Top Banner
Compiler Construction Final presentation Manish Sinha Ankit Mandhani
14

ASU Fall 2012: Compiler Construction - Final Presentation

Jun 29, 2015

Download

Technology

Manish Sinha

The presentation for the course Compiler Construction. The language was a subset of Object Oriented Pascal
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ASU Fall 2012: Compiler Construction - Final Presentation

Compiler Construction Final presentation

Manish SinhaAnkit Mandhani

Page 2: ASU Fall 2012: Compiler Construction - Final Presentation

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

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

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

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

Collaboration

Page 7: ASU Fall 2012: Compiler Construction - Final Presentation

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

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

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

Language Features

Possible new features

Page 11: ASU Fall 2012: Compiler Construction - Final Presentation

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

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

break construct

e.g. breakGrammar changes:statement: BREAK

Page 14: ASU Fall 2012: Compiler Construction - Final Presentation

The end