30 likes | 177 Views
Assign. BinaryExp. Add. Expression. Constant. Variable. 2. Composite Pattern: Expressions. Leaf and non-Leaf (part/whole) have same interface Treat whole like part How are parts added to a whole? Simple interface, control propagates through system
E N D
Assign BinaryExp Add Expression Constant Variable 2 Composite Pattern: Expressions • Leaf and non-Leaf (part/whole) have same interface • Treat whole like part • How are parts added to a whole? • Simple interface, control propagates through system • Expression and BinaryExp are abstract base classes • What makes a class abstract? • Why are abstract classes designed? • How is a BinaryExp class evaluated? • What about a Constant? Variable?
Production GrammarElement Terminal Nonterminal Definition RSG Composite • What’s in a Production? • What’s in a Definition? • What’s in a Nonterminal? * *