CFG: Empty word Home Page G = �{ S } , { a, b } , P, S � , where S − → SS | aSb | ε Title Page generates all sequences of matching nested parentheses, including the empty word ε . ◭◭ ◮◮ A leftmost derivation might look like this: ◭ ◮ S ⇒ SS ⇒ SSS ⇒ SS ⇒ aSbS ⇒ abS ⇒ abaSb . . . Page 22 of 100 A rightmost derivation might look like this: Go Back S ⇒ SS ⇒ SSS ⇒ SS ⇒ SaSb ⇒ Sab ⇒ aSbab . . . Other derivations might look like God alone knows what! Full Screen S ⇒ SS ⇒ SSS ⇒ SS ⇒ . . . Close Could be quite confusing! Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page CFG: Derivation trees 1 Title Page ◭◭ ◮◮ Derivation sequences • put an artificial order in which productions are fired. ◭ ◮ • instead look at trees of derivations in which we may think of productions as being fired in parallel . Page 23 of 100 • There is then no highlighting in red to determine which Go Back copy of a nonterminal was used to get the next member of the sequence. Full Screen • Of course, generation of the empty word ε must be shown explicitly in the tree. Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
CFG: Derivation trees 2 Home Page Title Page S ◭◭ ◮◮ S S ◭ ◮ ε S S ε Page 24 of 100 Go Back a S b a S b Derivation tree of Full Screen ε a S b abaabb Close ε Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
CFG: Derivation trees 3 Home Page Title Page S ◭◭ ◮◮ S S ◭ ◮ S S a S b Page 25 of 100 Go Back a b ε S a b S Full Screen ε ε Another Close Derivation tree of abaabb Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
CFG: Derivation trees 4 Home Page Title Page S ◭◭ ◮◮ S S ◭ ◮ S S a S b Page 26 of 100 ε Go Back a b S a S b Full Screen ε ε Yet another Derivation tree of Close abaabb Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Title Page ◭◭ ◮◮ ◭ ◮ Page 27 of 100 Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Ambiguity: 1 Home Page E → I | C | E + E | E ∗ E I → y | z Title Page C → 4 Consider the sentence y + 4 ∗ z . ◭◭ ◮◮ ◭ ◮ E E Page 28 of 100 Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Ambiguity: 2 Home Page E → I | C | E + E | E ∗ E I → y | z Title Page C → 4 Consider the sentence y + 4 ∗ z . ◭◭ ◮◮ ◭ ◮ E E Page 29 of 100 E E + * E E Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Ambiguity: 3 Home Page E → I | C | E + E | E ∗ E I → y | z Title Page C → 4 Consider the sentence y + 4 ∗ z . ◭◭ ◮◮ ◭ ◮ E E Page 30 of 100 E E + * E E Go Back E * + E E I E I Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Ambiguity: 4 Home Page E → I | C | E + E | E ∗ E I → y | z Title Page C → 4 Consider the sentence y + 4 ∗ z . ◭◭ ◮◮ ◭ ◮ E E Page 31 of 100 E E + * E E Go Back E * + E E I E I Full Screen I I C C y z Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Ambiguity: 5 Home Page E → I | C | E + E | E ∗ E I → y | z Title Page C → 4 Consider the sentence y + 4 ∗ z . ◭◭ ◮◮ ◭ ◮ E E Page 32 of 100 E E + * E E Go Back E * + E E I E I Full Screen I I C C y z Close z y 4 Quit 4 • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Title Page ◭◭ ◮◮ ◭ ◮ Page 33 of 100 Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 0 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( ) E ◭ ◮ a − a / b Page 34 of 100 Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 1 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( ) E ◭ ◮ − a / b Page 35 of 100 Principle: Go Back Reduce whenever possible. Shift only when Full Screen reduce is impossible Close a Shift Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 2 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( ) E ◭ ◮ − a / b Page 36 of 100 Go Back Full Screen Close Reduce by r5 D Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 3 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( ) E ◭ ◮ − a / b Page 37 of 100 Go Back Full Screen Close Reduce by r4 T Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 4 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( ) E ◭ ◮ − a / b Page 38 of 100 Go Back Full Screen Close Reduce by r2 E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 5 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ a / b Page 39 of 100 Go Back Full Screen Close Shift − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 6 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 40 of 100 Go Back Full Screen a Shift Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 7 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 41 of 100 Go Back Full Screen Reduce by r5 D Close − E E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 8 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 42 of 100 Go Back Full Screen Reduce by r4 T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 8a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 43 of 100 Go Back Full Screen Reduce by r4 T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 9a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 44 of 100 Go Back Full Screen Close Reduce by r1 E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 10a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ b Page 45 of 100 Go Back Full Screen Close / Shift E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 11a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 46 of 100 Go Back Full Screen Shift b Close / E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 12a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 47 of 100 Go Back Full Screen Reduce by r5 D Close / E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 13a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 48 of 100 Go Back Full Screen T Reduce by r4 Close / E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 14a Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 49 of 100 Go Back ! k c Full Screen u t S Reduce by r2 E Close / Get back! E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 14b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 50 of 100 Go Back Full Screen Reduce by r2 E Close / Get back! E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 13b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 51 of 100 Go Back Full Screen T Reduce by r4 Close / Get back! E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 12b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 52 of 100 Go Back Full Screen Reduce by r5 D Close / Get back! E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 11b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 53 of 100 Go Back Full Screen Shift b Get back! Close / E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 10b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ b Page 54 of 100 Go Back Full Screen Close / Shift Get back! E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 9b Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 55 of 100 Go Back Full Screen Get back to where you Close once belonged! Reduce by r1 E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 8b d e Home Page i f i d o m − r1. E E T Principle: r2 E T Title Page Reduce whenever possible, but r3 T / D T but depending upon ◭◭ ◮◮ r4 T D lookahead r5 D a | b | ( E ) ◭ ◮ / b Page 56 of 100 Shift instead of reduce here! Go Back Shift−reduce conflict Full Screen Reduce by r4 T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 8 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ / b Page 57 of 100 Go Back Full Screen Reduce by r4 T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 9 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ b Page 58 of 100 Go Back Full Screen Shift / T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 10 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 59 of 100 Go Back b Shift Full Screen / T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 11 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 60 of 100 Go Back Reduce by r5 D Full Screen / T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 12 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 61 of 100 Go Back Full Screen Reduce by r3 T Close − E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parsing: 13 Home Page − r1. E E T r2 E T Title Page r3 T / D T ◭◭ ◮◮ r4 T D r5 D a | b | ( E ) ◭ ◮ Page 62 of 100 Go Back Full Screen Close Reduce by r1 E Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 0 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 63 of 100 Go Back Full Screen Close a − a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 1 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 64 of 100 Go Back Full Screen D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 2 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 65 of 100 Go Back T Full Screen D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 3 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 66 of 100 E Go Back T Full Screen D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 3a Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 67 of 100 E Go Back T Full Screen D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 3b Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 68 of 100 E Go Back T Full Screen D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 4 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 69 of 100 E Go Back T Full Screen D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 5 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 70 of 100 E Go Back T T Full Screen D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 5a Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 71 of 100 E Go Back T T Full Screen D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 5b Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 72 of 100 E Go Back T T Full Screen D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 6 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 73 of 100 E Go Back T T Full Screen D D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 7 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ Page 74 of 100 E T Go Back T T Full Screen D D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Parse Trees: 8 Home Page − Title Page r1. E E T r4 T D r2 E T r5 D a | b | ( ) E r3 T / D T ◭◭ ◮◮ ◭ ◮ E Page 75 of 100 E T Go Back T T Full Screen D D D Close − a a / b Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Parsing: Summary: 1 Title Page • All high-level languages are designed so that they may ◭◭ ◮◮ be parsed in this fashion with only a single token look- ahead. ◭ ◮ • Parsers for a language can be automatically con- structed by parger-generators such as Yacc, Bison, ML- Page 76 of 100 Yacc. • Shift-reduce conflicts if any, are automatically detected Go Back and reported by the parser-generator. Full Screen • Shift-reduce conflicts may be avoided by suitably redesigning the context-free grammar. Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Parsing: Summary: 2 Title Page • Very often shift-reduce conflicts may occur because of the prefix problem. In such cases many parser- ◭◭ ◮◮ generators resolve the conflict in favour of shifting. ◭ ◮ • There is also a possiblility of reduce-reduce conflicts. This usually happens when there is more than one non- Page 77 of 100 terminal symbol to which the contents of the stack may reduce. Go Back • A minor reworking of the grammar to avoid redundant non-terminal symbols will get rid of reduce-reduce con- Full Screen flicts. The Big Picture Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Semantic Analysis: 1 Home Page • Every Programming langauge can be used to program Title Page any computable function, assuming of course, it has – unbounded memory, and ◭◭ ◮◮ – unbounded time ◭ ◮ • The parser of a programming language provides the framework within which the target code is to be gener- ated. Page 78 of 100 • The parser also provides a structuring mechanism that Go Back divides the task of code generation into bits and pieces determined by the individual nonterminals and produc- Full Screen tion rules. • However, contex-free grammars are not powerful Close enough to represent all computable functions. Exam- ple, the language { a n b n c n | n > 0 } . Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Semantic Analysis: 2 Title Page ◭◭ ◮◮ • There are context-sensitive aspects of a program that cannot be represented/enforced by a context-free gram- ◭ ◮ mar definition. Examples include – correspondence between formal and actual param- Page 79 of 100 eters – type consistency between declaration and use. Go Back – scope and visibility issues with respect to identifiers Full Screen in a program. Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Home Page Title Page ◭◭ ◮◮ ◭ ◮ Page 80 of 100 Go Back Full Screen Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 0 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 81 of 100 n F Go Back ( ) E E T Full Screen − T F Close F n Quit n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 1 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 82 of 100 n F Go Back ( ) E E T Full Screen Synthesized Attributes − 4 3 2 1 T F Close F n Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 2 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 83 of 100 n F Go Back ( ) E E T Full Screen Synthesized Attributes − 4 3 2 1 T F Close F 4 n Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 3 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 84 of 100 n F Go Back ( ) E E T Full Screen Synthesized Attributes − 4 3 2 1 T 4 F Close F 4 n Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 4 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 85 of 100 n F Go Back ( ) E E 4 T Full Screen Synthesized Attributes − 4 3 2 1 T 4 F Close F 4 n Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 5 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 86 of 100 n F Go Back ( ) E E 4 T Full Screen Synthesized Attributes − 4 3 2 1 T 4 F Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 6 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 87 of 100 n F Go Back ( ) E E 4 T Full Screen Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 7 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 88 of 100 n F Go Back ( ) E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 8 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 89 of 100 n F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 9 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T F / Page 90 of 100 n 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 10 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T 3 F / Page 91 of 100 n 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 11 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T 3 F / Page 92 of 100 n 2 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 12 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T − ◭ ◮ T 3 F 2 / Page 93 of 100 n 2 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 13 Home Page Title Page T F E E ◭◭ ◮◮ ) ( / n T 1 − ◭ ◮ T 3 F 2 / Page 94 of 100 n 2 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Synthesized Attributes: 14 Home Page Title Page T F E E 1 ◭◭ ◮◮ ) ( / n T 1 − ◭ ◮ T 3 F 2 / Page 95 of 100 n 2 3 F Go Back ( ) 3 E E 4 T Full Screen 1 Synthesized Attributes − 4 3 2 1 T 4 F 1 Close F 4 n 1 Quit 4 n • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
An Attribute Grammar Home Page Title Page E 0 → E 1 − T ⊲ E 0 .val := sub ( E 1 .val, T.val ) E 1 ◭◭ ◮◮ T 1 E → T ⊲ E.val := T.val T 3 F 2 ◭ ◮ / T 0 → T 1 /F ⊲ T 0 .val := div ( T 1 .val, F.val ) n 2 3 F Page 96 of 100 ( ) 3 E T → F ⊲ T.val := F.val E 4 T 1 − Go Back T 4 F 1 F → ( E ) ⊲ F.val := E.val Full Screen F 4 n 1 F → n ⊲ F.val := n .val 4 n Close Quit • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Inherited Attributes: 0 C -style declarations generating int x , y , z . Home Page D → T L T → int | float L → L,I | I I → x | y | z Title Page D ◭◭ ◮◮ T L ◭ ◮ I , L int Page 97 of 100 z I Go Back L , y Full Screen I D L T I Close x y z int x Quit , • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Inherited Attributes: 1 C -style declarations generating int x , y , z . Home Page D → T L T → int | float L → L,I | I I → x | y | z Title Page D ◭◭ ◮◮ T L ◭ ◮ I , L int int Page 98 of 100 z I Go Back L , y Full Screen I D L T I Close x y z int x Quit , int • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Inherited Attributes: 2 C -style declarations generating int x , y , z . Home Page D → T L T → int | float L → L,I | I I → x | y | z Title Page D ◭◭ ◮◮ T L int ◭ ◮ I , L int int Page 99 of 100 z I Go Back L , y Full Screen I D L T I Close x y z int x Quit , int int • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Inherited Attributes: 3 C -style declarations generating int x , y , z . Home Page D → T L T → int | float L → L,I | I I → x | y | z Title Page D ◭◭ ◮◮ T L int int ◭ ◮ I , L int int Page 100 of 100 z I Go Back L , y Full Screen I D L T I Close x y z int x Quit , int int • First • Prev • Next • Last • Go Back • Full Screen • Close • Quit
Recommend
More recommend