{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

chapter7

# chapter7 - H D D 7.1 7.1.1 E E opE | uopE |(E | id | num E...

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

H ž ( ž ( ( ª*Ð ÀD À Z ª*

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

View Full Document
7.1 º 7.1.1 . E E opE | uopE | ( E ) | id | num . E EE 0 E E E E id id num num E 1 opE 2 E 1 E 2 op uopE E uop ( E ) E
7.1 Ø (8 - 5) + 2 q 8 5 - 2 + ˜ x ª q (sμ ª* 8 5 - 2 + 8 5 - 2 + 8 5 - 2 + 3 2 + 3 2 + 5

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

View Full Document
7.1 ¼ Ø (8 - 5) + 2 q 8 5 - 2 + ˜ x ª q (sμ ª* À [email protected] 0¿
7.1 u 7.1.2 ª *ÐÀ D assign a + + b c d uminus (b) DAG assign a + + b c d c d uminus (a) a a = ( - b + c d) + c d b

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

View Full Document
7.1 `^Á ª* ÐÀ D ˜§+ ª* ¨o μ S id = E S . nptr = mkNode (‘assign’, mkLeaf (id, id. entry ), E . nptr ) E E 1 + E 2 E . nptr = mkNode ( ‘+’, E 1 . nptr , E 2 . nptr ) E E 1 E 2 E . nptr = mkNode ( ‘ ’, E 1 . nptr , E 2 . nptr ) E - E 1 E . nptr = mkUNode ( ‘uminus’, E 1 . nptr ) E ( E 1 ) E . nptr = E 1 . nptr F id E . nptr = mkLeaf (id, id. entry )
7.1 x 7.1.3 x = y op z x + y z t 1 = y z t 2 = x + t 1

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

View Full Document
7.1 A ðA DAG ª * . a = ( - b + c d ) + c d q t 1 = - b t 2 = c d t 3 = t 1 + t 2 t 4 = c d t 5 = t 3 + t 4 a = t 5 assign a + + b c d c d uminus
7.1 m xm DAG ª * . a = ( - b + c d ) + c d q DAG . t 1 = - b t 1 = - b t 2 = c d t 2 = c d t 3 = t 1 + t 2 t 3 = t 1 + t 2 t 4 = c d t 4 = t 3 + t 2 t 5 = t 3 + t 4 a = t 4 a = t 5 assign a + + b c d uminus

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

View Full Document
7.1 { À { x = y op z E x = op y E x = y < ª goto L . if x relop y goto L . param x . call p , n E return y E x = y [ i ] . x [ i ] = y < ª q x = & y E x = y EE x = y
7.1 E 7.1.4 < q q ÐÀ D •G ^ ˜ xq ¨o μ ª* ˆ < ˆ <q p = a +b p 1 = a +b q = p - c q 1 = p 1 - c p = q d p 2 = q 1 d p = e - p p 3 = e - p 2 q = p + q q 2 = p 3 + q 1

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

View Full Document
7.1 i 7.1.4 < q ]q ÐÀ D kn ˜ xq ¨o μ ª* ˜ xq ¨o μ ª* if (flag) x = - 1; else x = 1; y = x a; . if (flag) x 1 = - 1; else x 2 = 1; x 3 = φ (x 1 , x 2 ); // . flag< x 1 . x 2
7.2 è < ª p kn μ èƒ < ª * À [email protected]

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

View Full Document
7.2 8 < ª 7.2.1 è < *
7.2 ˆ ª ª*Ð À D P { offset = 0} D ; S D D ; D D id : T { enter ( id. lexeme , T . type , offset ); offset = offset + T . width } T integer { T . type = integer ; T . width = 4 } T real { T . type = real ; T . width = 8 } T array [ num ] of T 1 { T . type = array (num. val , T 1 . type );

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

View Full Document
7.2 È < ª ª*Ð À D P { offset = 0} D ; S D D ; D D id : T { enter ( id. lexeme , T . type , offset ); offset = offset + T . width } T integer { T . type = integer ; T . width = 4 } T real { T . type = real ; T . width = 8 } T array [ num ] of T 1 { T . type = array (num. val , T 1 . type ); T .width = num. val × T 1 .width} T T 1 { T . type = pointer ( T 1 . type ); T . width = 4 }
7.2 ˜ ª 7.2.2 q ª q P D ; S D D ; D | id : T | proc id ; D ; S sort var a:…; x:…; readarray var i:…; exchange quicksort var k, v:…; partition var i, j:…; a 6.14 a

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

View Full Document
7.2 H ª exchange readarray x a i a sort quicksort a readarray partition v k i quicksort readarray i i exchange i a exchange partition sort readarray exchange quicksort partition
7.2 Ø < ª X‰ < ª * ¨o ¨ xq n μ xq n μ ¨ mkTable ( previous ) enter ( table, name, type, offset ) addWidth ( table , width ) enterProc ( table , name , newtable ) sort var a:…; x:…; readarray var i:…; exchange quicksort var k, v:…; partition var i, j:…; a 6.14 a

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

View Full Document
7.2 8 ª P M D ; S { addWidth ( top ( tblptr ), top ( offset )); pop ( tblptr ); pop ( offset ) } M ε { t = mkTable ( nil ); push ( t , tblprt ); push (0, offset ) } D D 1 ; D 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}