ࡱ> prtuq)&( H/ 0|DTimes New Roman0:A 0DComic Sans MSn0:A 0?B DTahomaans MSn0:A 00DWingdings MSn0:A 0@DSymbolgs MSn0:A 0  A.  @n?" dd@  @@`` f^?5       ,***:Y PX\  F9N  &,+$ 0e0e     A@  A5% 8c8c     ?1 d0u0@Ty2 NP'p<'pA)BCD|ES" @8\FlO ʚ;ʚ; g4hdhd :A 0ppp@ <4!d!dL$ 0<4ddddL$ 0g4CdCd :A 0p@ pp<4BdBdL$ 0j0___PPT10 *___PPT9 z? %O 5_) BL Program'Math Model for ProgramWhat pieces of information do we need to keep track of for a BL program? name (IDENTIFIER) new instructions (CONTEXT) body (BLOCK STATEMENT)&IDID The Math Modelmath subtype PROGRAM is ( name: IDENTIFIER context: CONTEXT body: STATEMENT ) exemplar p constraint root (p.body).kind = BLOCKd  W  *New Instruction(*Math Model Continued& zWhat pieces of information do we need to keep track of for a new BL instruction? name (IDENTIFIER) body (BLOCK STATEMENT) 8Q)Q) *Math Model Continued& math subtype CONTEXT is finite set of ( name: IDENTIFIER body: STATEMENT ) exemplar c constraint . . .d   >  Program ComponenttType Program_Kernel is modeled by PROGRAM Initial Value IS_INITIAL_PROGRAM (self) self.name = empty_string and self.context = empty_set and IS_INITIAL_STATEMENT (self.body)%    PE  + Program SteerClear dDraw a picture of this BL program s abstract view:336Program SteerClear (cont d)  3$6Program SteerClear (cont d)  4%6Program SteerClear (cont d)  5&6Program SteerClear (cont d)  6'6Program SteerClear (cont d)  7(6Program SteerClear (cont d)  2#6Program SteerClear (cont d)   $Program Continued& ?Operations p.Swap_Name (name) p.Swap_Body (statement) p.Add_To_Context (name, statement) p.Remove_From_Context (name, name_copy, statement) p.Remove_Any_From_Context (name, statement) p.Is_In_Context (name) p.Size_Of_Context (), Z5Z 50! Swap_Name 1" Swap_Body "Context Operations#6Context Operations (cont d)$6Context Operations (cont d) An Operation on Program-What would it mean to demobilize a program?,.$$ $ Statements in BL Program+State the Problemglobal_procedure Demobilize ( alters Program& p ); /*! ensures p.name = #p.name and p.context = CONTEXT_DEMOBILIZE (#p.context) and p.body = DEMOBILIZE (#p.body) !*/ H&td (  ,8State the Problem Continued& math definition CONTEXT_DEMOBILIZE ( c: CONTEXT ): CONTEXT satisfies if c = empty_set then CONTEXT_DEMOBILIZE (c) = c else there exists n: IDENTIFIER, s: STATEMENT, rest_of_context: CONTEXT (c = {(n, s)} union rest_of_context and CONTEXT_DEMOBILIZE(c) = {(n, DEMOBILIZE(s))} union CONTEXT_DEMOBILIZE (rest_of_context))8 '  nL8t\ * 0-Implementation>procedure_body Demobilize ( alters Program& p ) {8?.2Implementation Continued& }/ Implementationprocedure_body Demobilize ( alters Program& p ) { object Program tmp; object Text name; object Statement body; p.Swap_Body (body); Demobilize (body); tmp.Swap_Body (body);1Z_HD< $  B ` 33PP` 3333` ___MMM` 13` 333fpKNāvI` j@v۩ῑ΂H` Q_{>?" dd@(?n<d@ `7 `2@`7``2 n?" ddH@ f @`PR    @ ` ` p>>  z   (     <o" .  T8d" .  <lE"U_ .  TJd">& .  NtM"P .  <P"{ .  C x8T?d?"mU .  6W "`  T Click to edit Master title style! !$  0 " "  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6p "@  B*  6  "@`   D*  6  "`  D*B  s *޽h ? 13 321%     k (  T +  "+bb P@ # "Dwoh  s *"PP  Bd" P@bb P 0  # "Nyh  s *"P    Bd"P 0 z   <" a*h   s *"    f?d?"+)   < ?"pP  T Click to edit Master title style! !   0 " `    W#Click to edit Master subtitle style$ $  6l% "`p   F*  6o% "`p  % H*  6r% "` % H*B  s *޽h ? 13* 0 :(    0 P   % \*   0     % ^* d  c $ ?  w  0l"  @ w RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6z `P   \*   6( `   ^* H  0޽h ? ̙3380___PPT10.gX( dH(  d d 0l P    B*  d 0     D*  d 6 `P   B*  d 6̗ `   D* H d 0޽h ? ̙3380___PPT10.gZ   0 (  ~  s * `       f8c?"h T  f2PROGRAM identifier IS BEGIN END identifier33  T8c?"Jk  Z8c?" J*   Z1?"* l z P     P  ,$D 0   `x ??@   Hsequence of statementsB   fD8c??P @ @ z P @    P@,$D 0    `b ??@ @ Nsequence of new instructionsB   fD8c??PP@ H  0޽h ? ̙33 ___PPT10+ zD' = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* %(D' =-o6Bdissolve*<3<* D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*+  @\(  x  c $( `     c $(  "<$  0  H  0޽h ? 13___PPT10r.+D' = @B D' = @BA?%,( < +O%,( < +D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*I%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*ID' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*ID{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*I[%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*I[D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*I[D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*[v%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*[vD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*[vD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*v%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*vD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*v+8+0+ +  P($(  (r ( S  `   r ( S h  "  H ( 0޽h ? 13   ld`(  x  c $<% `  %    f%8c?"h  `,INSTRUCTION identifier IS END identifier--  Z8c?"Jk  Z1?"* z P @   P@,$D 0   `̅% ?? @ Hsequence of statementsB   fD8c??PP H  0޽h ? 135-___PPT10 + D' = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*+;  p\(  x  c $% `  %   c $%  "<$  0 % H  0޽h ? 13___PPT10.+D' = @B DJ' = @BA?%,( < +O%,( < +D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*Q%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*QD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*QD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*Qc%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*QcD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*QcD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*cz%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*czD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*cz+8+0+% +T  z4(  4x 4 c $% `  % x 4 c $%  " %  4  `% ?? p$D 0<4___PPT9 c is a (partial) function for each (name, body) pair in c, name is not one of primitives nor the empty string, and body is a BLOCK @`H 4 0޽h ? 13zr___PPT10R+AكD' = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4+8+0+4% +  8P(  8r 8 S % `  %  8 S % @ "<$  0 % H 8 0޽h ? 13___PPT10r.+D' = @B D' = @BA?%,( < +O%,( < +D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*8%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*8D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*8D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*8*%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*8*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*8*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*8*8%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*8*8D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*8*8D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*88%(D' =+4 8?dCB1+#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*88D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*88+8+0+8% +  xD(  xr x S L% `  % r x S  %   P % \ x H@ % ?"  PROGRAM SteerClear IS INSTRUCTION StepAside IS IF random THEN turnright ELSE turnleft END IF move END StepAside INSTRUCTION TurnAround IS turnright turnright END TurnAround00n<Z         x H0"% ?"  . 2 x T*% ?"p f; fBEGIN WHILE true DO IF next-is-empty THEN skip ELSE IF next-is-wall THEN TurnAround ELSE StepAside END IF END IF END WHILE END SteerClear00n<Z>r  - H x 0޽h ? 13    ~0  (  x  c $/% `  % e  Ns% ?"`,$D 0 sp = ( , ,tt ` Np% ?"s ,$D 0 5) 2 r T 8c?"   s N 8c?"  t N 8c?"Ppz  | ,$D 0 v  f`t% ??  Rp.nameB wB # lD8c?? l 0 `  }0 ` ,$D 0 x  `d% ??@ `  U p.context   B y  fD8c??0  l ` @ ~ ` @,$D 0 z  `$% ?? @ Rp.bodyB {B  fD8c??` H  0޽h ? 13  ___PPT10 +UͤD ' = @B D ' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*|%(D' =-o6Bdissolve*<3<*|D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*}%(D' =-o6Bdissolve*<3<*}D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*~%(D' =-o6Bdissolve*<3<*~+   r j  (  x  c $% `  %   HH% ?"`,$D 0 *p = (  SteerClear , ,ll [  H% ?"s ,$D 0 5) 2  T 8c?"    N 8c?" z   ,$D 0    `L% ??  Rp.nameB  B  fD8c?? z 0 `    0 ` ,$D 0    `% ??@ `  U p.context   B   fD8c??0  z ` @   ` @,$D 0   `ػ% ?? @ Rp.bodyB B  fD8c??` H  0޽h ? 13   r j % (  x  c $% `  %   H% ?"`,$D 0 *p = (  SteerClear , { },ll [  H% ?"s ,$D 0 5) 2  T 8c?"    N 8c?"`z   ,$D 0   `% ??  Rp.nameB B  fD8c?? z 0 `    0 ` ,$D 0 !  `% ??@ `  U p.context   B "  fD8c??0  z ` @ #  ` @,$D 0 $  `% ?? @ Rp.bodyB %B  fD8c??` H  0޽h ? 13N     + (  x  c $% `  %   HM% ?"`,$D 0 *p = (  SteerClear , { , },ll [  HQ% ?"s ,$D 0 5) 2  T 8c?"  z   ,$D 0   `X% ??  Rp.nameB B  fD8c?? z ` @ !  ` @,$D 0 "  `% ?? @ Rp.bodyB #B  fD8c??`  ' N 8c?"`  ( N 8c?" z 0 `  ) 0 ` ,$D 0 *  `B% ??@ `  U p.context   B +  fD8c??0  H  0޽h ? 13^     * (  x  c $E% `  %   H,g+ ?"`,$D 0 (p = (  SteerClear , { ( , ), ( , ) },kk Z  Hf+ ?"s ,$D 0 5) 2  N 8c?"p z   ,$D 0   `Ll+ ??  Rp.nameB B  fD8c?? z ` @   ` @,$D 0   `p+ ?? @ Rp.bodyB  B  fD8c??`  $ N 8c?"` % N 8c?" ` & N 8c?"& f @ ' N 8c?"5M@z 0 `  ( 0 ` ,$D 0 )  `+ ??@ `  U p.context   B *  fD8c??0  H  0޽h ? 13  ##N(  x  c $+ `  +   H+ ?"`,$D 0 (p = (  SteerClear , { (  TurnAround , ), (  StepAside , ) },YY>     H+ ?"s ,$D 0 5) 2  N 8c?"p  L    #   N         Th+ ?":f 9BLOCK    Hا+ ?" DIF_ELSE RANDOM    T\+ ?"SA  9BLOCK    T+ ?"S  9BLOCK    T+ ?" s   |& CALL  turnright      T + ?"s   z$ CALL  turnleft     T` + ?" L CALL  move    B B HD?":sB  HD?"]sB B BD?"xSB  HD?":SB B HD?"% s B  HD?" ,s qL  ) #  )  H+ ?"'  f ;BLOCK   N+ ?" ) |& CALL  turnright     N(+ ?"z  ) |& CALL  turnright   B B HD?"s B  HD?"J s z   ,$D 0   `+ ??  Rp.nameB B  fD8c?? z ` @   ` @,$D 0   `+ ?? @ Rp.bodyB  B  fD8c??` F  `  !  `  "  `\+ ??@ `  U p.context   B #  fD8c??  H  0޽h ? 13+  \+T+:M *(  x  c $p+ `  +   N+ ?"`,$D 0 (p = (  SteerClear , { (  TurnAround , ), (  StepAside , ) },YY>    L    #   N         TH+ ?":f 9BLOCK   H+ ?" DIF_ELSE RANDOM    T+ ?"SA  9BLOCK    T+ ?"S  9BLOCK    T+ ?" s   |& CALL  turnright      T+ ?"s   z$ CALL  turnleft      Td+ ?" L CALL  move    B B HD?":sB  HD?"]sB B BD?"xSB  HD?":SB B HD?"% s B  HD?" ,s qL  ) #  )  H+ ?"'  f ;BLOCK   Na+ ?" ) |& CALL  turnright     NY+ ?"z  ) |& CALL  turnright   B B HD?"s B  HD?"J s  . N$]+ ?"s ,$D 0 5) 2z  > ,$D 0 ?  `Xv+ ??  Rp.nameB @B  fD8c?? F  `  G  `  B  fz+ ??@ `  U p.context   B C # lD8c??  z ` @ D  ` @,$D 0 E  `+ ?? @ Rp.bodyB FB  fD8c??` l no g Mno g,$D 0  Z+ ?"o-  ;BLOCK  Z}+ ?"S` :  A WHILE TRUE    N+ ?"`   GBLOCK&   N0+ ?"@ p  M IF_ELSE NEXT_IS_EMPTY   N + ?"`   ;BLOCK   Nв+ ?"` `  9BLOCK ! TQ+ ?"nP P ^ CALL  skip $  " NU+ ?"P * JIF_ELSE NEXT_IS_WALL: #  `*+(k ?"0og 2 CALL  TurnAround $  0 $ Z0(+(k ?"` o g . CALL  StepAside $  B % ND?"0 ` B & ND?"  B ' ND?" @ B (B ND?"`< ` B ) ND?"0 h` B * ND?"0 0P B + ND?" P B ,B HD?"@8B - HD?"0 @P  I H45+ ?"  - 9BLOCK J H8+ ?"- 9BLOCKB K HD?"P0PB L HD?" 0 H  0޽h ? 13   <0(  <x < c $?+ `  + x < c $@+  " + H < 0޽h ? 13(  J(B( 1E'(  x  c $I+ `  + <#8  g E g no g -  g,$D 0 . T\V+ ?"o-  ;BLOCK / T+ ?"S` :  A WHILE TRUE   0 HL+ ?"`   GBLOCK&  1 HxL+ ?"@ p  M IF_ELSE NEXT_IS_EMPTY  2 H+ ?"`   ;BLOCK 3 H+ ?"` `  9BLOCK 4 N` ?"nP P ^ CALL  skip $  5 H ?"P * JIF_ELSE NEXT_IS_WALL4 6 Z!(k ?"0og 2 CALL  TurnAround $  * 7 T&(k ?"` o g . CALL  StepAside $  B 8 HD?"0 ` B 9 HD?"  B : HD?" @ B ;B HD?"`< ` B < HD?"0 h` B = HD?"0 0P B > HD?" P B ?B BD?"@8B @ BD?"0 @P  A H ?"  - 9BLOCK B HP ?"- 9BLOCKB C HD?"P0PB D HD?" 0   N ?" ,$D 0 P= (  Timid , { (  TurnAround , ), ( StepAside , ) },4MA,    Zpl ?"&l] 9BLOCK  ZD ?"~ ? IF RANDOM    Z0q ?"@& 9BLOCK  Z ?"`@ 9BLOCK   Z ?"0   |& CALL  turnright     Z ?"`0   z$ CALL  turnleft     Zx ?" L CALL  move   B  B ND?"`PB   ND?"rpB B HD?"`@B  ND?" @B B ND?"@0 B  ND?"P0   N ?" 0] 9BLOCK  Np ?"` @ |& CALL  turnright    Nh ?"  |& CALL  turnright  B B ND?" r@B  ND?"`0 * N ?"@t,$D 0 7) 2 + TX ?" ,$D 0 ,What effect will the following statements have on p, the program object for program SteerClear? object Text name; name =  Timid ; p.Swap_Name (name);BT 0,T %  F , THF ?" P,$D 0 &name =  SteerClear  H  0޽h ? 13.  \.T.078-(  x  c $K `     H4M ?"`   What effect will the following statements have on object p from the previous slide? object Statement b, i, c; object Text m =  move ; object Integer test = RANDOM; c.Compose_Call (m); b.Add_To_Block (0, c); i.Compose_If (test, b); b.Add_to_Block (0, i); p.Swap_Body (b);ZVb   )8   8   NX ?" ,$D 0 P= (  Timid , { (  TurnAround , ), ( StepAside , ) },4MA,    Z ?"> ;BLOCK  Z` ?"c  DIF_ELSE RANDOM  Z ?"p ;BLOCK   Zd ?"2px ;BLOCK   Z ?"` h:  x CALL  turnright     Z ?"F` :  vCALL  turnleft    Z| ?"f  N CALL  move   B  B ND?"6B  ND?"VB B HD?"FpB  ND?"vpB B ND?"& ` B  ND?" 6`   N ?"  ;BLOCK   N ?"F P&* x CALL  turnright     N8^ ?"Pf* x CALL  turnright  B B ND?"&2B  ND?"   N@ ?"P,$D 0 7) 2  N ?" P  ?BLOCK   Z`  ?"   C IF RANDOM     N ?" P ?BLOCK   N\ ?"  PCALL  move    B  HD?" @ B  TD?" B  TD?" @    Z, ?"F   ;b = ! Z. ?" e  ?BLOCK " Z,- ?"@ {  E WHILE TRUE   # T<3 ?" f  ?BLOCK $ T4 ?" :  R IF_ELSE NEXT_IS_EMPTY % T ?"   ?BLOCK & T ?"   ?BLOCK ' T< ?"p@ X CALL  skip  ( NE ?"@u NIF_ELSE NEXT_IS_WALL ) NL ?"@ &CALL  TurnAround   * ND ?"p &CALL  StepAside  B + TD?" @ B , TD?"   B -B TD?"`  B . TD?"  B /B TD?" 0@B 0 TD?" @B 1B TD?"0B 2 TD?"0B 3 TD?" `   4 Ndb ?"6 ?BLOCK 5 NPe ?"6 ?BLOCKB 6 ND?"B 7 ND?"  H  0޽h ? 13/  a(Y(@2O$ '(  x  c $@ `    0 H$ ?"  ,$D 0 bp.Size_Of_Context () ?b 1 T@$ ?"  ,$D 0 >p.Is_In_Context ( StepAside ) ?  $ : 4 N$ ?" P ,$D 0 zHWhat result is produced by these statements if p has its original value?II=#8   O  - N<$ ? "p,$D 0 9)(2  N     Zh>$ ? ">~ ;BLOCK  Z0;$ ? "c DIF_ELSE RANDOM  Z T$ ? "  ;BLOCK   ZĚ$ ? "2x  ;BLOCK   Z$ ? "|hV  x CALL  turnright     Z $ ? "F|V  vCALL  turnleft    Z<$ ? "f N CALL  move   B  B ND? "6B  ND? "VB B HD? "FB  ND? "vB B ND? "&|B  ND? "6|  N$ ? " ~ ;BLOCK   N0$ ? "F R&+ x CALL  turnright     NT$ ? "Rf+ x CALL  turnright  B B ND? "&2B  ND? " no g 7 ) *,$D 0 8 TDx$ ?"o-  ;BLOCK 9 T@V$ ?"S` :  A WHILE TRUE   : HZ$ ?"`   GBLOCK&  ; H^$ ?"@ p  M IF_ELSE NEXT_IS_EMPTY  < Hb$ ?"`   ;BLOCK = Hlf$ ?"` `  9BLOCK > Ni$ ?"nP P ^ CALL  skip $  ? H\$ ?"P * JIF_ELSE NEXT_IS_WALL4 @ Z0$(k ?"0og 2 CALL  TurnAround $  * A T$(k ?"` o g . CALL  StepAside $  B B HD?"0 ` B C HD?"  B D HD?" @ B EB HD?"`< ` B F HD?"0 h` B G HD?"0 0P B H HD?" P B IB BD?"@8B J BD?"0 @P  K H$ ?"  - 9BLOCK L H$ ?"- 9BLOCKB M HD?"P0PB N HD?" 0 H  0޽h ? 13LD___PPT10$+s~D' = @B DS' = @BA?%,( < +O%,( < +DA' =%(D' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*0%(DA' =%(D' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*1%(+p+0+0$ ++0+1$ ++  ;+3+P7W`*(    c $k `<$D 0   8 ` r  8` r U . NP$ ?"P o,$D 0 [What result is produced by these statements if p has the value shown on the previous slide?\\ / N$ ?"` r ,$D 0 :object Text n; object Statement b; p.Remove_From_Context ( TurnAround , n, b) ?8Z E,#  F  + >   +N ` + = ` +  Ntt$ ?" 0 }  ?BLOCK  Np$ ?"`Q@+ | CALL  turnright    N\u$ ?"Q + | CALL  turnright  B B ND?" @1B  ND?" 0  1 Z$ ?"   vn= TurnAround   2 Z$ ?"& c  ;b =08   W   N $ ?"`4,$D 0 7) 2  NT$ ?" ,$D 0 l P= (  SteerClear , { ( StepAside , ) },77,   T  u  ;#  u   Z$ ? "b ;BLOCK  ZTE$ ? " >k DIF_ELSE RANDOM   Z$ ? " b , ;BLOCK   ZD$ ? " , ;BLOCK   Z$$ ? "  u  x CALL  turnright     Z\!$ ? " Pu  vCALL  turnleft    Z$ ? "> N CALL  move   B B ND? "@ B  ND? "`B B HD? " : B  ND? " :pB B ND? " 6 B  ND? "@6 no g ?   ,$D 0 @ T $ ?"o-  ;BLOCK A T $ ?"S` :  A WHILE TRUE   B H$ ?"`   GBLOCK&  C HD" ?"@ p  M IF_ELSE NEXT_IS_EMPTY  D H\" ?"`   ;BLOCK E HH" ?"` `  9BLOCK F N(" ?"nP P ^ CALL  skip $  G HH"" ?"P * JIF_ELSE NEXT_IS_WALL4 H Z8%"(k ?"0og 2 CALL  TurnAround $  * I T+"(k ?"` o g . CALL  StepAside $  B J HD?"0 ` B K HD?"  B L HD?" @ B MB HD?"`< ` B N HD?"0 h` B O HD?"0 0P B P HD?" P B QB BD?"@8B R BD?"0 @P  S H2" ?"  - 9BLOCK T Hܤ" ?"- 9BLOCKB U HD?"P0PB V HD?" 0 H  0޽h ? 13+  y+q+`7[p*(    c $$^" `<$D 0  " O . H" ?"  h ,$D 0 cWhat result is produced by these statements if p and b have the values shown on the previous slide?ddr / H8" ?" ` ,$D 0 Rn =  TurnBack ; p.Add_To_Context (n, b) ?**, F   B    2 NH" ?" s  ?BLOCK  7 ZK" ?" (  @n=   8 Z" ?"& {  ;b =4$8  g [ g  N4N" ?"p,$D 0 7) 2  N" ?" ,$D 0 F P= (  SteerClear , { (  TurnBack , ), ( StepAside , ) },4Y!>   T V  @# V   Z " ?">~ ;BLOCK  Z" ?"d ? IF RANDOM     Z" ?"  ;BLOCK   Z" ?"2x  ;BLOCK   Z" ?"|hV  x CALL  turnright     Z" ?"F|V  vCALL  turnleft    Z" ?"f N CALL  move   B B ND?"6B  ND?"VB B HD?"FB  ND?"vB B ND?"&|B  ND?"6|T F f+ ?# F f+  N<" ? " ~ ?BLOCK  N " ? "F R&+ | CALL  turnright    N" ? "Rf+ | CALL  turnright  B B ND? "&2B  ND? " no g C 0 1g,$D 0 D Tx" ?"o-  ;BLOCK E T," ?"S` :  A WHILE TRUE   F H" ?"`   GBLOCK&  G H" ?"@ p  M IF_ELSE NEXT_IS_EMPTY  H HR" ?"`   ;BLOCK I H" ?"` `  9BLOCK J N,X" ?"nP P ^ CALL  skip $  K HY" ?"P * JIF_ELSE NEXT_IS_WALL4 L Z"(k ?"0og 2 CALL  TurnAround $  * M T"(k ?"` o g . CALL  StepAside $  B N HD?"0 ` B O HD?"  B P HD?" @ B QB HD?"`< ` B R HD?"0 h` B S HD?"0 0P B T HD?" P B UB BD?"@8B V BD?"0 @P  W H " ?"  - 9BLOCK X Hd" ?"- 9BLOCKB Y HD?"P0PB Z HD?" 0 H  0޽h ? 13  pl$(  lr l S " `  " r l S "  " " H l 0޽h ? 13  y q @ (  @x @ c $" `  " z 0P  @ P0 ,$D 0B @ ZD8c?"0P@ B @ ZD8c?"0p@   @  fXg"8c?"x   `,INSTRUCTION identifier IS END identifier-- @ Z8c?"Z *k @ Z1?":    @  fk" 8c?"   =. . .BF @ l   @ @ l   @  fi"8c?"~ T  f2PROGRAM identifier IS BEGIN END identifier33  @ T8c?"`0k  @ Z8c?"` 0*  @ Z1?"@ l H @ 0޽h ? 135-___PPT10 +hD' = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*@%(D' =-o6Bdissolve*<3<*@+  \(  x  c $Lw `  w   c $Hw <$ 0 w H  0޽h ? 3333  \(  x  c $ w `  w   c $w  <$ 0 w H  0޽h ? 3333w%  (  x  c $w `  w   c $w 0p<$ 0 w (  0w @0 ,$D 0  object Program tmp; object Text name; object Statement body; // demobilize program body p.Swap_Body (body); Demobilize (body); tmp.Swap_Body (body);~ n<10n<Zy,l $  H  0޽h ? 3333#!!___PPT10 .+6$D ' = @B DV ' = @BA?%,( < +O%,( < +D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*.%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*.D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*.D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*.I%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*.ID' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*.ID{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*Ih%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*IhD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*IhD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*h%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*hD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*hD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*+8+0+w +.8  7(  x  c $ `     <0   <$ 0    0w ,$D 0 '? // demobilize statements in program context while (p.Size_Of_Context () > 0) { p.Remove_Any_From_Context (name, body); Demobilize (body); tmp.Add_To_Context (name, body); } // restore value of p (to be preserved) p.Swap_Name (name); tmp.Swap_Name (name); p &= tmp;:@0n<Z4t;2D  H  0޽h ? 3333/3'3___PPT103.+6$D2' = @B Db2' = @BA?%,( < +O%,( < +D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*0D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*0D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*0U%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*0UD' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*0UD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*U[%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*U[D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*U[D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*[%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*[D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*[D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*2%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*2D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*2D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*2@%(D' =+4 8?dCB0-#ppt_w/2BCB#ppt_xB*Y3>B ppt_x<*2@D' =+4 8?\CB#ppt_yBCB#ppt_yB*Y3>B ppt_y<*2@+8+0+w +  =5(  x  c $< `     c $Xw  P<$ 0  i  0w P,$ 0  while (p.Size_Of_Context () > 0) { p.Remove_Any_From_Context (name, body); Demobilize (body); tmp.Add_To_Context (name, body); } p.Swap_Name (name); tmp.Swap_Name (name); p &= tmp; }@0n<Zt 2  H  0޽h ? 3333r01&{4> Ppn={D °"0+'X]z I\p-/1PW?jhJm7Oh+'0/ hp   $ 0<D BL Program Paolo Bucci8C:\WINDOWS\Application Data\Microsoft\Templates\321.pot Paolo Bucci53lMicrosoft PowerPointn D@yD}@@ZH@@cgdG.g  >  -- @ !--'-- @ !40M---'--- @ !4MW---- @ !4MX---- @ !4MZ---- @ !4M[---- @ !4M\---- @ !4M]---- @ !4M^---- @ !4M_---- @ !4M`---- @ !4Ma---- @ !4Mb---- @ !4Mc---- @ !4Md--~-- @ !4Me--{-- @ !4Mf--w-- @ !4Mg--r-- @ !4Mh--m-- @ !4Mi--i-- @ !4Mj--d-- @ !4Mk--^-- @ !4Ml--Y-- @ !4Mm--S-- @ !4Mn--M-- @ !4Mo--G-- @ !4Mp--B-- @ !4Mq--<-- @ !4Mr--6-- @ !4Ms--0-- @ !4Mt--*-- @ !4Mu--%-- @ !4Mv---- @ !4Mw---- @ !4Mx---- @ !4My---'-- @ !4.{;--'--- @ !4{c---- @ !4{d---- @ !4{e--&-- @ !4{f----- @ !4{g--4-- @ !4{h--;-- @ !4{i--B-- @ !4{j--H-- @ !4{k--O-- @ !4{l--V-- @ !4{m--]-- @ !4{n--c-- @ !4{o--j-- @ !4{p--ݱq-- @ !4{q--حx-- @ !4{r--Ҩ~-- @ !4{s--ͣ-- @ !4{t--ƞ-- @ !4{u---- @ !4{v---- @ !4{w---- @ !4{x---- @ !4{y---- @ !4{z--{-- @ !4{{--u-- @ !4{|--n-- @ !4{}--g-- @ !4{~--ya-- @ !4{--qZ-- @ !4{--hS-- @ !4{--`L-- @ !4{--WF-- @ !4{--O?-- @ !4{--G8-- @ !4{-->1-- @ !4{--6*-- @ !4{---#-- @ !4{-- -- @ !4{-- -- @ !4{---'A .=s ( %')*,--./012222#$&(*,,-./01222 "$&(*+,-./01 "#%')+,--.01!#-u!gs~Ydp{KVamx' =HS_j! / : EQ\ , 8 CNcdefgKLMNO-./01]^_`aFGHIb !"#$VWXYZAB[D\PQRST;<=>?UKLMNO-./0123456FGHIJ !"#$%&'()ABCDE;<=>?@ -./0123456789:, !"#$%&'()*+, '-- @ !sAS--'--- @ !E/---- @ !5t---- @ !'---- @ !#---- @ ! ---- @ !---- @ !+---- @ !D---- @ !Y---- @ !q---- @ !---- @ !---- @ !---- @ !---- @ !---- @ !---- @ !---- @ !---- @ !%---- @ !6---- @ !O---- @ !d---- @ !}---- @ !---- @ !#---- @ !'---- @ !8---- @ !U:---- @ !#---'@BComic Sans MS-. 2 BL Program#,."System-@BComic Sans MS-. '2 PROGRAM identifier ISs.-@BComic Sans MS-. 2 BEGIN.-@BComic Sans MS-. 2 DEND identifier .--- @ !m} ---- $ v;v; --'1- @ IZm}-B( UUUU-- @ l}-- @ IZm}--- $;;--'-- $TT--'@BComic Sans MS-. (2 sequence of statements  .---8KLLEML--'@BComic Sans MS-. 12 bsequence of new instructions    .---8WKGLDTWLIEEMALI--'՜.+,0    $ NOn-screen ShowThe Ohio State Universityem{ "Times New RomanComic Sans MSTahoma WingdingsSymbol321 BL ProgramMath Model for ProgramThe Math ModelNew InstructionMath Model ContinuedMath Model ContinuedProgram ComponentProgram SteerClearProgram SteerClear (contd)Program SteerClear (contd)Program SteerClear (contd)Program SteerClear (contd)Program SteerClear (contd)Program SteerClear (contd)Program SteerClear (contd)Program Continued Swap_Name Swap_BodyContext OperationsContext Operations (contd)Context Operations (contd)An Operation on ProgramStatements in BL ProgramState the ProblemState the Problem ContinuedImplementationImplementation ContinuedImplementation  Fonts UsedDesign Template Slide TitlesRoot EntrydO)p..o@Current User/SummaryInformation(K0PowerPoint Document(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJLMNOPQRSTUVWXYZ[\]^_`abcefghijkx_ǔbuccibucciolo Buccig ServicesRoot EntrydO)VsCurrent UserASummaryInformation(K0PowerPoint Document(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJLMNOPQRSTUVWXYZ[\]^_`abcefghijkx#_ǔ Paolo BucciPaolo Buccig Services  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJLMNOPQRSTUVWXYZ[\]^_`abcefghijkmnopqrsxRoot EntrydO)Current UserlSummaryInformation(K0PowerPoint Document(DocumentSummaryInformation8d