<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-76391632187362788</id><updated>2024-09-10T18:51:21.536-07:00</updated><title type='text'>IT Lessons &amp;amp; Modules</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-5225975508239792081</id><published>2010-04-23T06:56:00.001-07:00</published><updated>2010-04-23T06:56:22.656-07:00</updated><title type='text'>Simple PHP Calendar - Finishing the Calendar</title><content type='html'>&lt;pre&gt;&lt;code&gt; //Finaly we finish out the table with some blank details if needed
 while ( $day_count &amp;gt;1 &amp;amp;&amp;amp; $day_count &amp;lt;=7 ) 
 { 
 echo &quot; &quot;; 
 $day_count++; 
 } 
 
 echo &quot;&quot;; &lt;/code&gt;&lt;/pre&gt;To finish our calendar we use one last &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_loops.htm&quot;&gt;while loop&lt;/a&gt;. This one fills in the rest of our calendar with blank table details if needed. Then we close our table and our script is done.</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/5225975508239792081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/5225975508239792081' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5225975508239792081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5225975508239792081'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/simple-php-calendar-finishing-calendar.html' title='Simple PHP Calendar - Finishing the Calendar'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-2807639364714867145</id><published>2010-04-23T06:55:00.002-07:00</published><updated>2010-04-23T06:55:45.189-07:00</updated><title type='text'>Simple PHP Calendar - Days of the Month</title><content type='html'>&lt;pre&gt;&lt;code&gt; //sets the first day of the month to 1 
 $day_num = 1;

 //count up the days, untill we&#39;ve done all of them in the month
 while ( $day_num &amp;lt;= $days_in_month ) 
 { 
 echo &quot; $day_num &quot;; 
 $day_num++; 
 $day_count++;

 //Make sure we start a new row every week
 if ($day_count &amp;gt; 7)
 {
 echo &quot;&quot;;
 $day_count = 1;
 }
 } &lt;/code&gt;&lt;/pre&gt;Now we need to fill in the days of the month. We do this with another &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_loops.htm&quot;&gt;while loop&lt;/a&gt;, but this time we are counting up to the last day of the month. Each cycle &lt;a href=&quot;http://php.about.com/od/phpfunctions/g/php_echo.htm&quot;&gt;echos&lt;/a&gt; a table detail with the day of the month, and it repeats until we reach the last day of the month.  Our loop also contains a &lt;a href=&quot;http://php.about.com/od/learnphp/ss/phpbasics_8.htm&quot;&gt;conditional statement&lt;/a&gt;. This checks if the days of the week have reached 7, the end of the week. If it has, it starts a new row, and resets the counter back to 1 (the first day of the week).</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/2807639364714867145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/2807639364714867145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2807639364714867145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2807639364714867145'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/simple-php-calendar-days-of-month.html' title='Simple PHP Calendar - Days of the Month'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-3074285142206090161</id><published>2010-04-23T06:55:00.000-07:00</published><updated>2010-04-23T06:55:13.605-07:00</updated><title type='text'>Simple PHP Calendar - Headings and Blank Calendar Days</title><content type='html'>&lt;pre&gt;&lt;code&gt; //Here we start building the table heads 
 echo &quot;&lt;/code&gt;&lt;table border=&quot;1&quot; style=&quot;width: 294px;&quot;&gt;&quot;;  echo &quot;&lt;tbody&gt;
&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt; $title $year &lt;/th&gt;&lt;/tr&gt;
&quot;;  echo &quot;
&lt;tr&gt;&lt;td width=&quot;42&quot;&gt;S&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;M&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;T&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;W&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;T&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;F&lt;/td&gt;&lt;td width=&quot;42&quot;&gt;S&lt;/td&gt;&lt;/tr&gt;
&quot;;   //This counts the days in the week, up to 7  $day_count = 1;   echo &quot;
&lt;tr&gt;&quot;;  //first we take care of those blank days  while ( $blank &amp;gt; 0 )   {   echo &quot;&lt;td&gt;&lt;/td&gt;&quot;;   $blank = $blank-1;   $day_count++;  }  The first part of this code very simply &lt;a href=&quot;http://php.about.com/od/phpfunctions/g/php_echo.htm&quot;&gt;echos&lt;/a&gt; the table tags, the month name, and the headings for the days of the week. Then we start a &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_loops.htm&quot;&gt;while loop&lt;/a&gt;. What we are doing is echoing empty table details, one for each blank day we count down. Once the blank days are done it stops. At the same time, our $day_count is going up by 1 each time through the loop. This is to keep count so that we do not try to put more than seven days in a week.&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/3074285142206090161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/3074285142206090161' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/3074285142206090161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/3074285142206090161'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/simple-php-calendar-headings-and-blank.html' title='Simple PHP Calendar - Headings and Blank Calendar Days'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-1653108230422290176</id><published>2010-04-23T06:54:00.001-07:00</published><updated>2010-04-23T06:54:40.835-07:00</updated><title type='text'>Simple PHP Calendar - Days of the Week</title><content type='html'>&lt;pre&gt;&lt;code&gt;&lt;iframe align=&quot;left&quot; frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm.amazon.com/e/cm?t=galicrew-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=0393072231&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr&quot; style=&quot;height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;&quot;&gt;&lt;/iframe&gt; //Here we find out what day of the week the first day of the month falls on 
 $day_of_week = date(&#39;D&#39;, $first_day) ; 

 //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero
 switch($day_of_week){ 
 case &quot;Sun&quot;: $blank = 0; break; 
 case &quot;Mon&quot;: $blank = 1; break; 
 case &quot;Tue&quot;: $blank = 2; break; 
 case &quot;Wed&quot;: $blank = 3; break; 
 case &quot;Thu&quot;: $blank = 4; break; 
 case &quot;Fri&quot;: $blank = 5; break; 
 case &quot;Sat&quot;: $blank = 6; break; 
 }

 //We then determine how many days are in the current month
 $days_in_month = cal_days_in_month(0, $month, $year) ; 

 &lt;/code&gt;&lt;/pre&gt;Here we take a closer look at the days of the month and prepare to make our calendar table. The first thing we do is determine what day of the week the first of the month falls. Once we know that, we use the &lt;a href=&quot;http://php.about.com/od/phpfunctions/g/php_switch_if.htm&quot;&gt;switch () function&lt;/a&gt; to determine how many blank days we need in our calendar before the first day.  Next we count the total days of the month. Now that we know how many &#39;blank&#39; days we need, and how many total days are in the month we can start to generate our calendar.</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/1653108230422290176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/1653108230422290176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/1653108230422290176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/1653108230422290176'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/simple-php-calendar-days-of-week.html' title='Simple PHP Calendar - Days of the Week'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-4473667958044207596</id><published>2010-04-23T06:53:00.000-07:00</published><updated>2010-04-23T06:53:51.420-07:00</updated><title type='text'>Simple PHP Calendar - Getting Calendar Variables</title><content type='html'>&lt;iframe align=&quot;left&quot; frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm.amazon.com/e/cm?t=galicrew-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=B002Y27P6O&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr&quot; style=&quot;height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;&quot;&gt;&lt;/iframe&gt;PHP calendars can be very useful. You can do things as simple as showing the date, and as complex as an online booking system. In this tutorial we will show you how to generate a very simple PHP calendar. Once you understand how to do this, you will be able to apply the same concepts to more complex calendars you may need.  &lt;br /&gt;
&lt;pre&gt;&lt;code&gt; &lt;/code&gt; //This gets today&#39;s date 
 $date =time () ; 
//This puts the day, month, and year in seperate variables 
 $day = date(&#39;d&#39;, $date) ; 
 $month = date(&#39;m&#39;, $date) ; 
 $year = date(&#39;Y&#39;, $date) ;

 //Here we generate the first day of the month 
 $first_day = mktime(0,0,0,$month, 1, $year) ; 

 //This gets us the month name 
 $title = date(&#39;F&#39;, $first_day) ; 

 &lt;/pre&gt;In the first part of our code we are setting some variables we will need later in the script. First we find out what today&#39;s date is using the &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_functions_2.htm&quot;&gt;time () function&lt;/a&gt;. We then use the &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_functions_3.htm&quot;&gt;date () function&lt;/a&gt; to format our date appropriately for the $day, $month, and $year variables. Finally we use it to generate the name of the month, which will be the title of our calendar.</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/4473667958044207596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/4473667958044207596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/4473667958044207596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/4473667958044207596'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/simple-php-calendar-getting-calendar.html' title='Simple PHP Calendar - Getting Calendar Variables'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-5821477690583636961</id><published>2010-04-23T06:49:00.000-07:00</published><updated>2010-04-23T06:49:24.240-07:00</updated><title type='text'>Learn PHP Part 1</title><content type='html'>&lt;h3&gt;The essentials for learning PHP: &lt;/h3&gt;Learning a new language (programming or otherwise) can be a bit overwhelming. Many people just don&#39;t know where to start and give up before they even begin. Learning PHP is &lt;b&gt;NOT&lt;/b&gt; as overwhelming as it might seem, I promise you. Just take it one step at a time, and before you know it you&#39;ll be off and running. &lt;h3&gt;1.) Basic Knowledge: &lt;/h3&gt;The first thing you need, before you start learning PHP, is a basic understanding of &lt;a href=&quot;http://webdesign.about.com/od/beginningtutorials/a/bl_htmltutorial.htm&quot;&gt;HTML&lt;/a&gt;.  You can switch between PHP and HTML right in the same document.  You can even run PHP &lt;a href=&quot;http://php.about.com/od/advancedphp/p/html_php.htm&quot;&gt;from an HTML&lt;/a&gt; file.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;2.) Tools: &lt;/h3&gt;When creating PHP pages, you can use the same program you use to create your HTML pages.  Any &lt;a href=&quot;http://php.about.com/od/phpbasics/p/text_editor.htm&quot;&gt;plain text editor&lt;/a&gt; will do.  You will also need an &lt;a href=&quot;http://php.about.com/od/phpbasics/p/ftp.htm&quot;&gt;FTP client&lt;/a&gt; to transfer files from your computer to your web hosting. If you already have an HTML website you most likely already use an FTP program. &lt;h3&gt;3.) The Basics: &lt;/h3&gt;Now you can finally get started learning PHP!  The first thing you should read is our &lt;a href=&quot;http://php.about.com/od/learnphp/ss/phpbasics.htm&quot;&gt;PHP Basics&lt;/a&gt; tutorial. This will take you through creating your first file, using variables, basic math, and basic IF statements (a form of logic). &lt;h3&gt;4.) Learning Loops : &lt;/h3&gt;Once you have mastered these skills, it is time to learn about loops. Loops repeat the same actions over and over again until a condition is met. There are several different types of loops which are explained in our &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_loops.htm&quot;&gt;Learning Loops&lt;/a&gt; tutorial.  &lt;h3&gt;5.) PHP Functions: &lt;/h3&gt;Finally, you can learn to &lt;a href=&quot;http://php.about.com/od/learnphp/ss/php_functions.htm&quot;&gt;write your own custom functions&lt;/a&gt;.  From here the sky is the limit...  With a solid knowledge of these PHP basics, adding &lt;a href=&quot;http://php.about.com/od/phpfunctions/&quot;&gt;PHP functions&lt;/a&gt; to your arsenal when you need them will be easy.</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/5821477690583636961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/5821477690583636961' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5821477690583636961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5821477690583636961'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2010/04/learn-php-part-1.html' title='Learn PHP Part 1'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-2983836492807736185</id><published>2009-09-27T19:23:00.000-07:00</published><updated>2009-09-27T19:23:09.487-07:00</updated><title type='text'>Principles of Programming Languages - Module 5</title><content type='html'>&lt;span style=&quot;font-size: x-large;&quot;&gt;Module 5&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;Elementary Data Type&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
A data type is a class of data objects together with a set of operations for creating and manipulating them.&lt;br /&gt;
&lt;br /&gt;
An elementary data object contains a single data value.&amp;nbsp; A class of such data objects over which various operations are defined is termed an elementary data type.&lt;br /&gt;
&lt;br /&gt;
The basic elements of a specification of an elementary data type are as follows:&lt;br /&gt;
1. Attributes that distinguish data objects of that type.&amp;nbsp; &lt;br /&gt;
2. Values&amp;nbsp; that data objects of that type may have.&amp;nbsp; The type of a data object determines the set of possible(maximum) values that it may contain.&amp;nbsp; The set of values defined by an elementary data type is usually an ordered set with a least value and a greatest value; for any pair of distinct values, one is greater than the other.&lt;br /&gt;
3. Operations that define the possible manipulations of data objects of that type.&amp;nbsp; They may be&amp;nbsp; primitive which means that they are specified as part of the language definition, or they may be programmer-defined operations, in the form of subprograms or method declarations as part of class definitions.&amp;nbsp; Examples: integer addition, the use of the equal symbol to test equality, square-root operation&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Implementation of Elementary Data Types&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The implementation of an elementary data type consists of a storage representation for data objects and values of that type, and a set of&amp;nbsp; algorithms&amp;nbsp; or&amp;nbsp; procedures that define the operations of the type in terms of manipulations of the storage representation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Storage Representation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Storage for elementary data types is strongly influenced by the under lying computer that will execute the program.&amp;nbsp; For example, the storage representation for integer or real values is almost always the integer or floating-point binary representation for numbers used in the underlying hardware.&lt;br /&gt;
&lt;br /&gt;
The representation of a data object is ordinarily independent of its location in memory.&amp;nbsp; The storage representation is usually described in terms of the size of the block of the memory required(the number of memory words, bytes, or bits needed) and the layout of the attributes and data values within its block.&amp;nbsp; Usually the address of the first word or byte of such a block of memory is taken to represent the location of the data object.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Implementation of operations&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Each operation defined for data objects of a given type may be implemented in one of three main ways:&lt;br /&gt;
1. Directly as hardware operation.&amp;nbsp; For example, if integers are stored using hardware representation for integers, then addition and subtraction are implemented using the arithmetic operations built into the hardware.&lt;br /&gt;
2.&amp;nbsp; As a procedure or function subprogram.&amp;nbsp; For example, a square-root operation is usually not provided directly as hardware operation.&amp;nbsp; It might be implemented as a square-root subprogram that calculates the square root of its argument.&lt;br /&gt;
3. As an inline code sequence.&amp;nbsp; An inline code sequence is also a software implementation of the operation.&amp;nbsp; However, instead of using a subprogram, the operations in the subprogram are copied into the program at the point where the subprogram would otherwise have been invoked.&amp;nbsp; For example, the absolute-value function&amp;nbsp; on numbers,&amp;nbsp; defined by&amp;nbsp; abs(x) = if x &amp;lt; 0 then -x else x is usually implemented as an inline code sequence:&lt;br /&gt;
a.&amp;nbsp; Fetch value of x from memory.&lt;br /&gt;
b.&amp;nbsp; If x &amp;gt; 0, skip the next instruction.&lt;br /&gt;
c.&amp;nbsp; Set x = -x.&lt;br /&gt;
d. Store new value of x in memory.&lt;br /&gt;
Each line is implemented by a single-hardware operation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Declaration&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A declaration&amp;nbsp; is a program statement that serves to communicate to the language translator information about the name and type of data objects needed during program execution.&amp;nbsp; By its placement in the program (e.g. within a particular subprogram or class definition), a declaration may also serve to indicate the desired lifetimes of the data objects.&lt;br /&gt;
&lt;br /&gt;
Sample declarations of some programming languages:&lt;br /&gt;
&lt;br /&gt;
• The C declaration float A, B; at the start of a subprogram indicates that two data objects of type float are needed during execution of the subprogram.&amp;nbsp; This is an example of an explicit declaration.&lt;br /&gt;
• FORTRAN is a programming language that provides implicit or default declarations, which are declarations that hold when no explicit declaration is given.&amp;nbsp; The variable INDEX may be used without explicit declaration; it is assumed by the compiler to be an integer variable because its name begins with one of&amp;nbsp; the letters I-N.&amp;nbsp; &lt;br /&gt;
• In Perl, simply assigning a value to a variable declares&amp;nbsp; the type of the variable&lt;br /&gt;
Examples:&amp;nbsp; $MyVar = &#39;This is a string&#39;&amp;nbsp;&amp;nbsp;&amp;nbsp; # $MyVar is now a string variable&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; $MyVar = 890&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # $MyVar is now an integer variable&lt;br /&gt;
&lt;br /&gt;
The most important purpose for declarations, from the programmer&#39;s viewpoint, is that they allow for static rather than dynamic type checking.&lt;br /&gt;
&lt;br /&gt;
Data storage representations that are built into the computer hardware usually include no type information, and the primitive operations on the data do no type checking.&amp;nbsp; For example, a particular word in the computer memory during execution of a program may contain the bit sequence 101010010100…1001 may represent an integer, a real&amp;nbsp; number, a sequence of characters, or an instruction.&amp;nbsp; The hardware primitive operation for integer addition cannot check whether its two arguments represents integers; they are simply bit sequences.&amp;nbsp; At the hardware level, conventional computers are particularly unreliable in detecting data type errors.&lt;br /&gt;
&lt;br /&gt;
Type checking means the checking that each operation executed by a program receives the proper number of arguments of the proper data types.&amp;nbsp; For example given the expression X = A + B * C, the compiler must determine for each operation(addition, multiplication, and assignment) that each receives two arguments of the proper data type.&lt;br /&gt;
&lt;br /&gt;
Type checking may be done at run time (dynamic type checking) or at compile time (static type checking).&lt;br /&gt;
&lt;br /&gt;
Dynamic type checking&amp;nbsp; is run-time type checking usually performed immediately before the execution of a particular operation.&amp;nbsp; It is usually implemented by storing&amp;nbsp; a type tag in each data object that indicates the data type of the object.&amp;nbsp; For example, an integer data object would contain both the integer value and an integer type tag.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Scalar Data Types&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Scalar data objects have a single attribute for its data object.&amp;nbsp; For example, an integer object has an integral value (ex. 130, -90, 12), and no other information can be obtained from that object.&amp;nbsp; They also follow the hardware architecture of a computer (e.g. integers, floating-points, characters).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Integers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The set of integer values defined for the type forms an ordered subset, within some finite bounds, of the infinite set of integers studied in mathematics.&amp;nbsp; The maximum integer value is sometimes represented as a defined costant.&lt;br /&gt;
&lt;br /&gt;
Operations on these data objects include:&lt;br /&gt;
• Arithmetic&lt;br /&gt;
• Relational &lt;br /&gt;
• Assignment&lt;br /&gt;
• Bit &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Floating-Point Real Numbers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A floating-point real number data type is often specified with only the single data type&amp;nbsp; attribute real, as in ForTran, or float, as in C.&amp;nbsp; The values form an ordered sequence from some hardware-determined minimum negative value to a maximum value, but the values are not distributed evenly across this range.&amp;nbsp; The precision required for floating-point numbers, in terms of the number of digits used in the decimal representation, may be specified by the programmer.&lt;br /&gt;
&lt;br /&gt;
Operations on these data objects include:&lt;br /&gt;
• Arithmetic&lt;br /&gt;
• Relational &lt;br /&gt;
• Assignment&lt;br /&gt;
• Bit &lt;br /&gt;
&lt;br /&gt;
Boolean operations on these objects are sometimes restricted.&amp;nbsp; Due to roundoff issues, equality between two real numbers is rarely achieved.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Fixed-Point Real Numbers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Data objects like money which contains pesos and cents, and other values which are rational that requires two or specific number of decimal places, should not be written as integers or floating-point values to avoid roundoff errors.&amp;nbsp; Thus, a form of fixed-point data should be used to represent these values.&lt;br /&gt;
&lt;br /&gt;
A fixed number is represented as a digit sequence of fixed length, with the decimal point positioned at a given point between two digits.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Complex numbers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This numeric data type consists of a pair of numbers representing the number&#39;s real and imaginary parts.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Rational Numbers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A rational number is the quotient of two integers.&amp;nbsp; It is included in a programming language to avoid the problems of roundoff and truncation encountered in floating and fixed point representations of reals.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Enumerations&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
An ordered list of distinct values is called an enumeration.&amp;nbsp; Languages such as C, and C++ include an enumeration data type that allows the programmer to define and manipulate such variables more directly.&lt;br /&gt;
&lt;br /&gt;
Below is sample program that uses the enum data type:&lt;br /&gt;
&lt;br /&gt;
#include &lt;iostream.h&gt;&lt;br /&gt;
#include &lt;conio.h&gt;&lt;br /&gt;
#include &lt;stdio.h&gt;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
enum x {One, Two, Three};&lt;br /&gt;
x y = Three;&lt;br /&gt;
clrscr();&lt;br /&gt;
if (y == 2)&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Three&quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Booleans&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Most languages provide a data type for representing true or false, usually called a Boolean or logical data type.&lt;br /&gt;
&lt;br /&gt;
The most common operations on Boolean types include assignment as well as the following logical operations:&lt;br /&gt;
• And - Conjunction&lt;br /&gt;
• Or - Inclusive disjunction&lt;br /&gt;
• Not - Negation or complement&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Characters&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A character data type provides data objects that have a single character as their value.&amp;nbsp;&amp;nbsp; The set of possible character values is usually taken to be a language-defined enumeration corresponding to the standard character sets supported by the underlying hardware and operating system, such as the ASCII character set.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The ordering of the characters in this character set is called the collating sequence for the character set. Collating sequence is important because it determines the alphabetical ordering given to character strings by the relational operations.&amp;nbsp; Spaces, digits, and special characters may be alphabetized as well.&lt;br /&gt;
&lt;br /&gt;
Operations include:&lt;br /&gt;
&lt;br /&gt;
• Relational &lt;br /&gt;
• Assignment&lt;br /&gt;
• Testing whether a character value is one of the special classes letter, digit, or special character&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Composite Data Types&lt;/b&gt;&lt;br /&gt;
Elementary data types may involve a complex data structure organization by the compiler.&amp;nbsp; Thus, multiple attributes&amp;nbsp; are often given for each such data type.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Character Strings&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
These are objects that composed of a sequence of characters.&lt;br /&gt;
&lt;br /&gt;
There are at least three different treatments of character-string data types :&lt;br /&gt;
&lt;br /&gt;
• Fixed declared length.&amp;nbsp; A character-string data object may have a fixed length that is declared in the program.&lt;br /&gt;
• Variable length to a declared bound.&amp;nbsp; A character-string data object may have a maximum length that is declared in the prior program, but the actual value stored in the data object may be a string&amp;nbsp; of shorter length-possibly even the empty string of no characters.&lt;br /&gt;
• Unbounded length.&amp;nbsp; A character-string data object may have a string value of any length, and the length may vary dynamically during execution&amp;nbsp; with no bound (beyond available memory).&lt;br /&gt;
&lt;br /&gt;
Operations on Strings:&lt;br /&gt;
• Concatenation - an operation of joining two character strings to make one long string&lt;br /&gt;
• Relational operations on strings - use of logical operators like the less than, greater than symbols, etc.&lt;br /&gt;
• Substring selection using positioning subscripts - extracting substrings through positioning subscripts&lt;br /&gt;
• Input-output formatting - formatting of strings when read or displayed&lt;br /&gt;
• Substring selection using pattern matching - - extracting substrings through pattern matching&lt;br /&gt;
• Dynamic strings - The language Perl supports static and dynamic strings.&amp;nbsp; The string &#39;$ABC&#39; is static, and the statement print &#39;$ABC&#39;; will print the value $ABC.&amp;nbsp; The string &quot;$ABC&quot; is dynamic and the statement print &quot;$ABC&quot;; will cause the string to be evaluated, and the value of the Perl variable $ABC is printed instead.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Pointers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A pointer is also called a reference or access type.&amp;nbsp; It contains the location of another data object or may contain the null pointer, nil or null.&amp;nbsp; Pointers are ordinary data objects that may be simple variables or components of arrays and records.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Files and Input-Output&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A file&amp;nbsp; is a data structure with two special properties:&lt;br /&gt;
1. It ordinarily is represented on a secondary storage device such as a disk or tape and thus may be much larger than the most data structures of other types.&lt;br /&gt;
2. Its lifetime may encompass a greater span of time than that of the program creating it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sequential Files&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
These are the most common type of file.&amp;nbsp; It is a data structure composed of a linear sequence of components of the same type.&lt;br /&gt;
Operations&lt;br /&gt;
&lt;br /&gt;
• Open - this operation ordinarily requests information from the operating system about the location and properties of the file, allocates the required internal storage for buffers and other information, and sets the file-position pointer to the first component of the file.&lt;br /&gt;
• Read - this operation transfers the contents of the current file component to a designated variable in the program&lt;br /&gt;
• Write - this operation creates a new component at the current position in the file(always at the end) and transfers the contents of a designated program variable to the new component.&lt;br /&gt;
• End-of-file test - A read operation fails if the file position pointer designates the end of the file.&amp;nbsp; Because the file is of variable length, an explicit test for the end-of-file position is needed so that the program may take special action.&lt;br /&gt;
• Close - this operation involves notification to the operating system that the file can be detached from the program (and potentially made available to other programs) and possibly also deallocation of internal storage used for the file (such as buffers and buffer variables) (Pratt, and Zelkowitz, 2001)&lt;br /&gt;
&lt;/stdio.h&gt;&lt;/conio.h&gt;&lt;/iostream.h&gt;</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/2983836492807736185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/2983836492807736185' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2983836492807736185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2983836492807736185'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2009/09/principles-of-programming-languages_940.html' title='Principles of Programming Languages - Module 5'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-2850178336907644219</id><published>2009-09-27T19:20:00.000-07:00</published><updated>2009-09-27T19:20:36.176-07:00</updated><title type='text'>Principles of Programming Languages - Module 4</title><content type='html'>&lt;span style=&quot;font-size: x-large;&quot;&gt;Module 4&amp;nbsp; Names, Bindings, Type Checking and Scopes&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Names&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the fundamental attributes of variables is names, which have broader use than simply for variables.&amp;nbsp; They are also associated with labels, subprograms, formal parameters, and other program constructs.&amp;nbsp; The term identifier is often used interchangeably with name.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Name forms&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A name is a string of characters used to identify some entity in a program.&amp;nbsp; The earliest programming languages used single-character names.&amp;nbsp; This was natural because early programming was primarily mathematical, and mathematicians have long used single-character names for unknowns in their formal notations.&lt;br /&gt;
&lt;br /&gt;
A programming language has a maximum length of a name. For example, FORTRAN 90 and C allow up to 31 characters. Ada names have no length limit.&amp;nbsp; Some languages like C++, do not specify a length limit on names.&lt;br /&gt;
&lt;br /&gt;
The commonly acceptable name form is a string with a reasonably long length limit, if any, with some connector character such as the underscore(_) included.&amp;nbsp; The underscore serves the same purpose as a space in English text but without terminating the name string in which it is placed.&lt;br /&gt;
&lt;br /&gt;
In some languages, like C, C++, and Java, uppercase and lowercase letters in names are distinct; that is, names in these languages are case sensitive.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Special Words&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Special words in programming languages are used to make programs more readable by naming actions to be performed.&amp;nbsp; They are&amp;nbsp; used to separate the syntactic entities of programs.&amp;nbsp; In most languages, these words are classified as reserved words, but in some they are only keywords.&lt;br /&gt;
&lt;br /&gt;
A keyword is a word of a programming language that is special only in certain contexts.&amp;nbsp; A reserved word is a special word&amp;nbsp; of a programming language that cannot be used as a name.&amp;nbsp; As a language design choice, reserved words are better than keywords because the ability to redefine keywords can lead to readability problems.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Variables&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A program variable is an abstraction of a computer memory cell or collection of cells.&amp;nbsp; Programmers often think of variables as names for memory locations, but there is much more to a variable than just a name.&amp;nbsp; A variable can be characterized as a sextuple of attributes: (name, address, value, type, lifetime, scope).&lt;br /&gt;
&lt;b&gt;Address&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The address of a variable is the memory address with which it is associated.&amp;nbsp; It is sometimes called its l-value, because that is what is required when a variable appears in the left side of an assignment statement.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Aliases&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to have multiple identifiers reference the same address.&amp;nbsp; When more than one variable name can be used to access a single memory location, the names are called aliases.&amp;nbsp; Aliasing is a hindrance to readability because it allows&amp;nbsp; a variable to have its value changed by an assignment to a different variable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Type&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The type of a variable determines the range of values the variable can have and the set of operations that are defined for values of the type.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Value&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The value of a variable is the contents of the memory cell or cells associated with the variable.&amp;nbsp; It is convenient to think of computer memory in terms of abstract cells, rather than physical cells.&amp;nbsp; It is sometimes called the variable&#39;s r-value because it is what is required when the variable is used on the right side of an assignment statement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Bindings&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Binding is an association such as between an attribute and an entity or between an operation and a symbol.&amp;nbsp; The time at which a binding takes place is called binding time. Bindings can take place at language design time, language implementation time, compile time, link time, load time, or load time.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
• The asterisk symbol(*) is usually bound to the multiplication operation at language design time.&lt;br /&gt;
• A variable in C or C++ program is bound to as particular data type at compile time.&lt;br /&gt;
• A variable may be bound to a storage cell when the program is loaded to the memory&lt;br /&gt;
• A call to a library subprogram is bound to the subprogram code at link time.&lt;br /&gt;
&lt;br /&gt;
Given some lines of a C++ program:&lt;br /&gt;
&lt;br /&gt;
int iCt;&lt;br /&gt;
…&lt;br /&gt;
iCt = iCt + 1;&lt;br /&gt;
&lt;br /&gt;
Some of the bindings and their binding times for the parts of this assignment statement are as follows:&lt;br /&gt;
• Set of possible types for iCt:&amp;nbsp; bound at language design time.&lt;br /&gt;
• Type of count:&amp;nbsp; bound at compile time.&lt;br /&gt;
• Set of possible values of iCt: bound at compiler design time.&lt;br /&gt;
• Value of iCt: bound at execution time with this statement.&lt;br /&gt;
• Set of possible meanings for the operator symbol +:&amp;nbsp; bound at language definition time.&lt;br /&gt;
• Meaning of the operator symbol + in this statement:&amp;nbsp; bound at compile time.&lt;br /&gt;
• Internal representation of the literal 1:&amp;nbsp; bound at compiler design time.&lt;br /&gt;
&lt;br /&gt;
A binding is static if it occurs before run time and remains unchanged throughout program execution.&amp;nbsp; If it occurs during run time or can change in the program execution, it is called dynamic.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Type Bindings&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before a variable can be referenced in a program, it must be bound to a data type.&amp;nbsp; The two important aspects of this binding are (1) how the type is specified and (2) when the binding takes place.&lt;br /&gt;
&lt;br /&gt;
Forms of Variable Declaration&lt;br /&gt;
1. Explicit declaration - a statement in a program that lists variable names and specifies that they are a particular type.&lt;br /&gt;
2. Implicit declaration - a means of associating variables with types&amp;nbsp; through default conventions instead of declaration statements.&lt;br /&gt;
&lt;br /&gt;
The first appearance of a variable name in a program constitutes its implicit declaration.&amp;nbsp; Both explicit and implicit declarations create static binding to types.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dynamic Type Binding&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
With dynamic type binding, the type is not specified by a declaration statement.&amp;nbsp; Instead, the variable is bound to a type when it is assigned a value in an assignment statement. When the assignment statement is executed, the variable being assigned is bound to the type of the value, variable, or expression on the right side of the assignment.&lt;br /&gt;
&lt;br /&gt;
One of its advantages is that it provides a great deal of programming flexibility.&amp;nbsp; With dynamic type binding, one can deal with data of any type.&lt;br /&gt;
&lt;br /&gt;
Dynamic type binding has also disadvantages. One of these is the error detection capability of the compiler is diminished relative to a compiler for a language with&amp;nbsp; static type bindings, because any two types can appear on opposite sides of the assignment operator.&amp;nbsp; Incorrect types of right sides of assignments are not detected as errors; rather, the type of the left side is simply changed to the incorrect type.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Type Inference&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For programming languages like ML, Miranda, and Haskell, with type inference, the types of most expressions can be determined without requiring the programmer to specify the types of the variables&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Type Checking&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When dealing with type checking, one has to consider the following:&lt;br /&gt;
1. Subprograms will be taken as operators whose operands are their parameters;&lt;br /&gt;
2. The assignment symbol will be thought of&amp;nbsp; as a binary operator, with its target variable and its expression being the operands.&lt;br /&gt;
&lt;br /&gt;
Type checking is the activity of ensuring that the operands of an operator are of compatible types.&amp;nbsp; A compatible type is one that is either legal for the operator or is allowed under language rules to be implicitly converted by compiler-generated code to a legal type which is known as coercion.&amp;nbsp; A type error is the application of an operator to an operand of an inappropriate type.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Strong Typing&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the new ideas in language design that became prominent in the so-called structured programming revolution of the 1970s. A strongly typed language is one in which each name in a program in the language has a single type associated with it, and that type is known at compile time.&amp;nbsp; A programming language is considered strongly typed if type errors are always detected.&amp;nbsp; The importance of strong typing lies in its ability to detect all misuses of variables that result in type errors.&amp;nbsp; Languages like FORTRAN, C and C++ are not strongly typed.&amp;nbsp; Examples of programming languages that are nearly strongly typed are Pascal and Ada.&amp;nbsp; Languages like ML and Java are strongly typed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Type Compatibility&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The design of the type compatibility rules of a language is important, because it influences the design of the data types and operations provided for values&amp;nbsp; of those types.&lt;br /&gt;
&lt;br /&gt;
Two different type compatibility methods:&lt;br /&gt;
1. Name compatibility -&amp;nbsp; this means that two variables have compatible types only if they are&amp;nbsp; in either the same declaration or in declarations that use the same type name.&lt;br /&gt;
2. Structure compatibility - this means that two variables have compatible types if their types have identical structures.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Scope&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most important factors having an effect on the understanding of variables is scope.&amp;nbsp; The scope of a program variable is defined as the range of statements in which the variable is visible.&amp;nbsp; A variable is visible in a statement if it can be referenced in that statement&amp;nbsp; A variable is local in a program unit or block if it is declared there.&amp;nbsp; The nonlocal variables of a program unit or block are those that are visible within the program unit or block but are not declared there. (Sebesta)</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/2850178336907644219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/2850178336907644219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2850178336907644219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/2850178336907644219'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2009/09/principles-of-programming-languages_7626.html' title='Principles of Programming Languages - Module 4'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-6558016532641913599</id><published>2009-09-27T19:18:00.000-07:00</published><updated>2009-09-27T19:18:10.901-07:00</updated><title type='text'>Principles of Programming Languages - Module 3</title><content type='html'>&lt;span style=&quot;font-size: x-large;&quot;&gt;Module 3 Describing Syntax&amp;nbsp; and Semantics&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The study of programming languages, like the study of natural languages, can be divided into examinations of syntax and semantics.&amp;nbsp; The syntax of a programming language is the form of its expressions, statements, and program units.&amp;nbsp; Its semantics is the meaning of those expressions, statements, and program units.&amp;nbsp; For example, the syntax of a C if&amp;nbsp; statement is if (&lt;expr&gt;) &lt;statement s=&quot;&quot;&gt;.&amp;nbsp; The semantics of this statement form is that if the current value of the expression is true, the embedded statement is selected for execution.&lt;br /&gt;
&lt;br /&gt;
Syntax and semantics are closely related.&amp;nbsp; In a well-designed programming language, semantics, should follow directly from syntax; that is, the form of statement should strongly suggest what the statement is meant to accomplish.&lt;br /&gt;
&lt;br /&gt;
Languages, whether natural (such as English) or artificial (such as Java), are sets of strings of characters from some alphabet.&amp;nbsp; The strings of a language are called sentences or statements.&amp;nbsp; The syntax rules of a language specify which strings of characters from the language&#39;s alphabet are in the language.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Formal descriptions of the syntax of programming languages, often do not include descriptions of the lowest level syntactic units.&amp;nbsp; These small units are called lexemes.&amp;nbsp; The lexemes of a programming language include its identifiers, literals, operators, and special words.&lt;br /&gt;
&lt;br /&gt;
A&amp;nbsp; token&amp;nbsp; of a language is a category of its lexemes.&amp;nbsp; An identifier is a token that can have lexemes, or instances.&amp;nbsp; In some cases, a token has only a single possible lexeme.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
Given&amp;nbsp; the C statement:&amp;nbsp; index = 2 * count + 20;&lt;br /&gt;
&lt;br /&gt;
The lexemes and tokens of this statement &lt;br /&gt;
&lt;br /&gt;
Lexemes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tokens&lt;br /&gt;
index&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; identifier&lt;br /&gt;
=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; equal_sign&lt;br /&gt;
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int_literal&lt;br /&gt;
*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mult_op&lt;br /&gt;
count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; identifier&lt;br /&gt;
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus_op&lt;br /&gt;
20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int_literal&lt;br /&gt;
;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; semicolon&lt;br /&gt;
&lt;br /&gt;
A Grammar for Simple Assignment Statements&lt;br /&gt;
&lt;br /&gt;
Given:&amp;nbsp;&amp;nbsp; a = b * ( a + c )&lt;br /&gt;
&lt;br /&gt;
&lt;assign&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;id&gt; = &lt;expr&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; a = &lt;expr&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = &lt;id&gt; * &lt;expr&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b * &lt;expr&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b * ( &lt;expr&gt; )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b * ( &lt;id&gt; + &lt;expr&gt; )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b&amp;nbsp; * ( a + &lt;expr&gt;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b * ( a + &lt;id&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b *&amp;nbsp; ( a + c)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Parse Trees&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most attractive features of grammars is that they naturally describe the hierarchical syntactic structure of the sentences of the languages they define.&amp;nbsp; These structures are called parse trees.&lt;br /&gt;
&lt;br /&gt;
Given: a = b * ( a + c )&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ambiguity&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A grammar that generates a sentence for which there are two or more distinct parse trees is said to be ambiguous.&lt;br /&gt;
&lt;br /&gt;
Given: a = b *&amp;nbsp; a + c &lt;br /&gt;
Note:&amp;nbsp; The parse tree will be supplied by the teacher in class.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Operator Precedence&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A parse tree of a sentence with multiple operators, regardless of the particular operators involved, has the rightmost operator in the expression at the lowest point in the parse tree, with the other operators in the tree moving progressively higher as one moves to the left in the expression.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Static Semantics&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The static semantics of a language is only indirectly related to the meaning of programs during execution; rather, it has to do with the legal forms of programs (syntax rather than semantics).&amp;nbsp; In many cases, the static semantic rules of a language state its type constraints.&amp;nbsp; Static semantics is so named because the analysis required to check these specifications can be done at compile time.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Denotational Semantics&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is the most rigorous widely know method for describing the meaning of programs.&amp;nbsp; The fundamental concept of denotational semantics is to define for each language entity both a mathematical object and a function that maps instances of that entity onto instances of the&amp;nbsp;&amp;nbsp; mathematical object.&lt;br /&gt;
&lt;br /&gt;
&lt;/id&gt;&lt;/expr&gt;&lt;/expr&gt;&lt;/id&gt;&lt;/expr&gt;&lt;/expr&gt;&lt;/expr&gt;&lt;/id&gt;&lt;/expr&gt;&lt;/expr&gt;&lt;/id&gt;&lt;/assign&gt;&lt;/statement&gt;&lt;/expr&gt;</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/6558016532641913599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/6558016532641913599' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/6558016532641913599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/6558016532641913599'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2009/09/principles-of-programming-languages_4315.html' title='Principles of Programming Languages - Module 3'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-1722414494455019308</id><published>2009-09-27T17:01:00.000-07:00</published><updated>2009-09-27T17:03:21.441-07:00</updated><title type='text'>Principles of Programming Languages - Module 2</title><content type='html'>&lt;span style=&quot;font-size: x-large;&quot;&gt;Module 2 &lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;Levels of Programming Languages, Programming Domains, Language Evaluation Criteria&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Levels of Programming Languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Programming languages were invented to make machines easier to use.&amp;nbsp; They thrive because they make problems easier to solve.&lt;br /&gt;
&lt;br /&gt;
The informal term level&amp;nbsp; is useful for gross distinctions between languages.&amp;nbsp; Levels of readability for programs are analogous to levels of readability for English text.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Machine Language&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Machine computations are low level, full of details that have more to do&amp;nbsp; with the inner workings of the machine than with what the computation is for.&amp;nbsp; A typical machine-level operation might add numbers or compare characters.&lt;br /&gt;
&lt;br /&gt;
Machine language is the native language of a computer; it is the notation to which&amp;nbsp; the computer responds directly. The term code originally referred to machine language, although code is now used more broadly to refer to any program text.&lt;br /&gt;
&lt;br /&gt;
Programs in machine language are usually unintelligible at the lowest level, the most detailed level, since they consist only of 0s and 1s.&lt;br /&gt;
&lt;br /&gt;
Assembly language is a variant of machine language in which names and symbols take the place of the actual codes for machine operations, values, and storage locations, making individual instructions more readable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;High-level Language&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A language is a high-level language if it is independent of the underlying machine.&amp;nbsp; They have replaced machine and assembly language in virtually all areas of programming, because they provide benefits like the following:&lt;br /&gt;
&lt;br /&gt;
a. Readable familiar notations&lt;br /&gt;
b. Machine independence&lt;br /&gt;
c. Availability of program libraries&lt;br /&gt;
d. Consistency checks during implementation that can detect errors&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Portability&lt;/i&gt; is another term for machine independence; a language is portable if programs in the language can be run on different machines with little or no change. (Sethi, R.)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Programming Domains&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Computers have been applied to a myriad of different areas, from controlling nuclear power plants to storing the records of personal checkbooks.&amp;nbsp; Because of this great diversity in computer use, programming languages with very different goals have been developed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Scientific Applications&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Typically, scientific applications have simple data structures but require large numbers of floating-point arithmetic computations.&amp;nbsp; The most common data structures are arrays and matrices; the most common control structures are counting loops and selections.&amp;nbsp; Examples of these languages are FORTRAN and ALGOL 60.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Business Applications&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Business languages are characterized by facilities for producing elaborate reports, precise ways of describing and storing decimal numbers and character data, and the ability to specify decimal arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
With the advent of microcomputers came new ways for businesses, especially small businesses, to use computers.&amp;nbsp; Two specific tools that can be used on small computers, spreadsheet systems and database systems, were developed for business and now are widely used.&amp;nbsp; The COBOL language belongs to this category.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Artificial Intelligence&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is a broad area of computer applications characterized by the use of symbolic rather than numeric computations. Symbolic computation means that symbols, consisting of names rather than numbers, are manipulated.&amp;nbsp; Also, symbolic computation is more conveniently done with linked lists of data rather than arrays.&amp;nbsp; This kind of programming sometimes requires more flexibility&amp;nbsp; than other programming domains.&amp;nbsp; The functional language LISP and the ProLog which supports logic programming belong to this group.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Systems Programming&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The OS and all of the programming support tools of a computer system are collectively known as its systems software.&amp;nbsp; Systems s/w is used almost continuously and therefore must have execution efficiency.&amp;nbsp; A language for this domain must provide fast execution.&amp;nbsp; It should have low-level features that allow the s/w interfaces to external devices to be written.&amp;nbsp; Examples of this softwares are PL/1, BLISS, Extended ALGOL, and UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Scripting Languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A scripting language is used by putting a list of commands, called a script, in a file to be executed.&amp;nbsp; sh (for shell) was the first of these languages.&amp;nbsp; It began as a small collection of commands that were interpreted as calls to system subprograms that performed utility functions, such as file management and simple file filtering.&amp;nbsp;&amp;nbsp;&amp;nbsp; To these basis were added variables, control flow statements, functions, and various other capabilities, and the result is a complete programming language.&amp;nbsp; As a result, ksh was developed by David Korn at Bell Laboratories.&lt;br /&gt;
&lt;br /&gt;
awk is another scripting language, developed by Al Aho, Brian Kernighan, and Peter Wienberger at Bell Laboratories.&amp;nbsp; It began as a report-generation language but later became a more general purpose language.&lt;br /&gt;
&lt;br /&gt;
tcl is an extensible scripting language developed by John Outsterhout at the University of California at Berkeley.&amp;nbsp; Today, tcl is combined with tk,&amp;nbsp; a language that provides a method of building X Window application.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The Perl&amp;nbsp; language, developed by Larry Wall, was originally a combination of sh and awk.&amp;nbsp; Since the advent of the WWW, the popularity of Perl has risen dramatically, primarily because it is a nearly&amp;nbsp; ideal language for CGI(Common Gateway Interface) programming.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Special-Purpose Languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
They range from RPG, which is used to produce business reports, to APT, which is used for instructing programmable machine tools, to GPSS, which is used for systems simulation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Language Evaluation Criteria&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;A.&amp;nbsp; Readability&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most important criteria for judging a programming language is the ease with which the programs can be read and understood. Readability must be considered in the context of the problem domain. For example, if a program that describe a computation was written in a language not desired for use, the program may be unnatural and convoluted, making it unusually difficult to read.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;B.&amp;nbsp; Writability.&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
Is a measure of how easily a langaueg can be used to create programs for a chosen problem domain.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;C.&amp;nbsp; Reliability.&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
A program is said to be reliable if it performs to its specifications under all conditions.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;i&gt;&lt;b&gt;D.&amp;nbsp; Cost .&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
The ultimate total cost of a programming language is a function of many of this characteristics.&amp;nbsp; First, there is the cost of training programmers to use the language.&amp;nbsp; Second is the cost of writing programs in language. Third is the cost of compiling programs in the language. Fourth, the cost of executing programs written in language is greatly influenced by that language&#39;s design.</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/1722414494455019308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/1722414494455019308' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/1722414494455019308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/1722414494455019308'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2009/09/principles-of-programming-languages_27.html' title='Principles of Programming Languages - Module 2'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-5363267009987221364</id><published>2009-09-27T16:57:00.000-07:00</published><updated>2009-09-27T16:58:27.135-07:00</updated><title type='text'>Principles of Programming Languages - Module 1</title><content type='html'>&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;Module 1&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Defining Programming Languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
• A tool for instructing machines&lt;br /&gt;
• A means for communicating between programmers&lt;br /&gt;
• A vehicle for expressing high-level designs&lt;br /&gt;
• A notation for algorithms  - they are used for specifying, organizing and reasoning about computations&lt;br /&gt;
• A way of expressing relationships between concepts&lt;br /&gt;
• A tool for experimentation&lt;br /&gt;
• A means of controlling computerized devices (Sethi, R.)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reasons for Studying Concepts of Programming Languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
• Increased capacity to express ideas - it is widely believe that the depth at which we can think is influenced by the expressive power of language in which we communicate our thoughts. Awareness of a wider variety of programming language features can reduce such limitations in software development. Programming can increase  the range of their software-development process by learning new language constructs.&lt;br /&gt;
• Improved background for choosing appropriate languages - Many professional programmers have had little education in computer science; rather they have learned programming on their own thought in-house training programs. Such training programs often teach one or two languages that are directly relevant to the current work of the organization. Many other programmers received their formal training in the distant past.&lt;br /&gt;
•  Increased ability to learn new languages - Computer programming is a young discipline, and design methodologies, software development tools, and programming languages are still in the state of continuous evolution.  This makes systems development exciting  profession, but it also means that continuous learning is essential.&lt;br /&gt;
• Better understanding of the significance of implementation - In learning the concepts of programming languages, it is both interesting and necessary to touch on the implementation issues that affect those concepts.  In some cases, understanding of implementation issues leads to understanding of why languages are designed the way they are. This in turn leads to the ability to use a language more intelligently, as it was designed to be used. We can become better programmers by understanding the choices among programming languages construct and the consequences of those choice.&lt;br /&gt;
• Increased ability to design new languages -  to a student, the possibility of being required at some future time to design a new programming language may seem remote. However, most professional programmers occasionally do design languages of one sort or another.&lt;br /&gt;
• Overall advancement of computing - Finally, there is a global view of computing that can justify the study of programming language concept. Although it is usually possible to determine why a particular programming language become popular, it is not always clear, at least in retrospect that the most popular programming languages are the best available.  (Sebesta, R.)</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/5363267009987221364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/5363267009987221364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5363267009987221364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/5363267009987221364'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2009/09/principles-of-programming-languages.html' title='Principles of Programming Languages - Module 1'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-76391632187362788.post-7312354949583359901</id><published>2008-07-12T18:54:00.000-07:00</published><updated>2008-07-12T18:59:00.189-07:00</updated><title type='text'>IT Lessons and Modules</title><content type='html'>IT&lt;br /&gt;Lessons&lt;br /&gt;Modules</content><link rel='replies' type='application/atom+xml' href='http://itlessonsandmodules.blogspot.com/feeds/7312354949583359901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/76391632187362788/7312354949583359901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/7312354949583359901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/76391632187362788/posts/default/7312354949583359901'/><link rel='alternate' type='text/html' href='http://itlessonsandmodules.blogspot.com/2008/07/it-lessons-and-modules.html' title='IT Lessons and Modules'/><author><name>kingbruce</name><uri>http://www.blogger.com/profile/13953727207536304705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_8fkUKo-L_DQ/SHoQ5taqn2I/AAAAAAAAAC0/gB1A75AFnYo/S220/kingbruce+passport+size.jpg'/></author><thr:total>0</thr:total></entry></feed>