{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Apr03 - CSE302 Compiler Design Instructor Dr Liang Cheng...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full Document Right Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07 Outline Recap Syntax-directed translation (Chapter 5) Summary and homework
Background image of page 2
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
Background image of page 3

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

View Full Document Right Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full Document Right Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/03/07
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}