next up previous
Next: About this document ... Up: Quiz6 Previous: Exercise 2.

Exercise 3.

Consider the following syntax-directed definition for the point size and height of boxes containing mathematical formulas.
Production Semantic Rule
S $ \longmapsto$ B B.ps := 10
  S.ht := B.ht
B $ \longmapsto$ B1 B2 B1.ps := B.ps
  B2.ps := B.ps
  B.ht := max( B1.ht, B2.ht)
B $ \longmapsto$ B1 $ \bf sub$ B2 B1.ps := B.ps
  B2.ps := shrink(B.ps)
  B.ht := disp( B1.ht, B2.ht)
B $ \longmapsto$ $ \bf text$ B.ht := $ \bf text$.h×B.ps
Write a translation scheme for this syntax-directed definition.

Answer 3  
\fbox{
\begin{minipage}{13 cm}
See course notes, the {\em Syntax-Directed Transl...
...x{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\end{minipage}}


next up previous
Next: About this document ... Up: Quiz6 Previous: Exercise 2.
Marc Moreno Maza
2004-12-02