{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

This preview shows pages 1–7. Sign up to view the full content.

CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University April 3, 2007

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07 Outline Recap Syntax-directed translation (Chapter 5) Summary and homework
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07 SDD’s For synthesized attributes Perform bottom-up tree traversal for attribute evaluation An SDD is S-attributed if every attribute is synthesized For SDD’s with both inherited and synthesized attributes Dependency graphs An SDD is L-attributed if in all of its dependency graphs the edges only go from left to right but not from right to left

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07 Syntax-directed Translation Schemes Note that SDD is used for specifications SDD SDT SDT’s are implemented during parsing without building a parse tree S-attributed SDD based on LR-parsable grammar L-attributed SDD based on LL-parsable grammar
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07 S-attributed SDD’s Based on LR- parsable Grammars SDD SDT Construct an SDT where actions are placed at the end of the productions corresponding to semantic rules Postfix SDT’s SDD Production Semantic rules T T 1 * F T.val = T 1 .val * F.val T F T.val = F.val F digit F.val = digit .lexval SDT T T 1 * F { T.val = T 1 .val * F.val; } T F { T.val = F.val; } F digit { F.val = digit .lexval; } An action is executed along with the reduction of the body to the head of the associated production

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}