Lecture 9 Notes

Our syntax requires the two sets of parentheses here

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ion, we need to dereference it: ( (var )) " !#  ! ¡"!  " var 42¨ 53 ¤ £ %¢  ¨¦ ¥ £ %¢  Assignment works as one might expect: we look up the left-hand side in the environment, getting a location, we evaluate the right-hand side in the environment, , the value returned by a and we modify the desired location. As with expression is arbitrary. We choose to have it return 27. In the rule, we omit the constructor since it should be clear from the context. ¥ ¨¨ ¥©¥ ¨¨ £ & 6 ¤ !¡S%  ¨¥ ¤  21 "! where l is a location not in the domain of . " l] 1 to show the modified v "! £ ¤¢  £ %¢ ¨¦ ©§¥ £ ¨ §¦ ¨ ¤¥4 ¨ ¦ ¨  §§%£4 ¤ ¤ ¤ ¤4¢¥4 &  &  var exp [l v ] v] ¨ ¨¦ ©§¥ exp [var [ (var ) "! We also need to rewrite the rules for procedure call and store. For procedure call, the rule becomes 1 "!" "! 0 v # ! " ¡ #  4 %3¨ ) 2¨1 £ ¤¢   ¥ ¨¦  var exp 0  exp ©  £¥ £¥6  & 7X !47 22 ¢ S£C ¤ !S%7£ § & 6  £  7¨¥  %©  ¢ ¦ & 3 6¥ ¤ ! § X! 47£ ¥ £ ¥ 6 ¤ 8 § ©& 8& ¨ ¥©¥ $¨ § £ (¥  ¡¦) §  © ! § 8 £ ¥ !¨ § ©& 6¥ 3 7¡ 8& ¤ 8 § ¥©¥ ©&  § X! § 8£  © & P P ¥ 6  § ©&  6¥ & © ¢ ¦ ¤ !¦£  P P We modify the interpreter for LETREC. )  ©3¨ ¤ %1 ¢ & ¥ 4 ¢ ¡¢ £¢ ¤ ¤¡¡¨ §¦ 1 5¥ ¨ & 5.3.2 Implementation: 23   7   SES 7£ ¥ 6 ¥  7¨¥ 6 ¤ 78 § 63©&¥  & £ 8 &  £  7¨¥ ¥ £ 0© ¡¨ ¢ 8 § 8 ¥ ¥ © & 6 ¢© ¤ !¡ 8 § ¥©§¥ ¦£ § 8  #V  ES¨ @ ¡¥¥ §   § 63©&¥ ¤  #7£ ¥ 6 ¥  ¥ £ 8 §  & © ©6 ¥  £ ¤ ¥   E!¥ !7£ 6 £ ¥  ¥ § £ 7¨¥ 6 ¤ 78 '£  P 8& P 7£ ¥ 6 ¤ 8 & 8 ©  ©6 £ £  © !¥ ¨¥ ¤ ¤ ¥¦    !¥! £ ¥ 6 ¨¥  ¥ 7 7£ 6 ¥ &¡X7&V¨¥ £ § !757¨¥ 6  ¦ £ ¥ §   ¥   (© ¥©§ ©& ) £...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online