<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Learn Postscript &#187; exch</title>
	<atom:link href="http://learnpostscript.wordpress.com/category/exch/feed/" rel="self" type="application/rss+xml" />
	<link>http://learnpostscript.wordpress.com</link>
	<description>Programming Language</description>
	<lastBuildDate>Thu, 19 Mar 2009 17:55:53 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='learnpostscript.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/864cf471b5a5a7bd36d1cdc44c9cc488?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Learn Postscript &#187; exch</title>
		<link>http://learnpostscript.wordpress.com</link>
	</image>
			<item>
		<title>Reverse Polish Notation</title>
		<link>http://learnpostscript.wordpress.com/2007/06/05/reverse-polish-notation/</link>
		<comments>http://learnpostscript.wordpress.com/2007/06/05/reverse-polish-notation/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 21:16:54 +0000</pubDate>
		<dc:creator>macenable</dc:creator>
				<category><![CDATA[exch]]></category>

		<guid isPermaLink="false">http://learnpostscript.wordpress.com/2007/06/05/reverse-polish-notation/</guid>
		<description><![CDATA[Like most programming languages, Postscript code consists of operators and operands. 
Consider the arithmatic operation 2 + 3 = 5. The operands are 2 and 3, and the operator is plus (+). In Postscript this same operation would be coded as
2 3 add
The Postscript operation appears to be the reverse of “add 2 and 3.” [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnpostscript.wordpress.com&blog=1199990&post=3&subd=learnpostscript&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Like most programming languages, Postscript code consists of operators and operands. </p>
<p>Consider the arithmatic operation 2 + 3 = 5. The operands are 2 and 3, and the operator is plus (+). In Postscript this same operation would be coded as</p>
<p><code>2 3 add</code></p>
<p>The Postscript operation appears to be the reverse of “add 2 and 3.” The reason for this is that Postscipt is a “stack” based language. The numbers 2 and 3 are “pushed” onto the stack and then subsequently “popped” off the stack by the add operator which expected to find its two operands, the integers, on the stack. The result, 5, is then pushed onto the stack waiting invisibly for the next operation.</p>
<p>Another “type” of operand is the string of characters. Where some programming languages might say</p>
<p><code>PRINT “Hello world!”</code></p>
<p>Postscript says:</p>
<p><code>(Hello world!) print</code></p>
<p>The term Polish in &#8220;reverse-polish notation&#8221; refers to the fact that operators and operands are kept to one side or another. Postscript finds the operands to the left. </p>
<p>For instance, the common notation (2 + 3) * (4 &#8211; 1) is stated in Postscript as:</p>
<p><code>2 3 add 4 1 sub mul</code></p>
<p>Notice how the results of add and sub are left waiting invisibly on the stack for the mul operator.  And the final result, 15, is also left waiting on the stack.</p>
<p>Another operator, <strong>exch</strong>, is very useful in Postscript because it <em>exchanges</em> the top two positions on the stack.</p>
<p><code>4 1 exch sub</code> </p>
<p>results in the number <em>minus three</em> being left on the stack. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learnpostscript.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learnpostscript.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnpostscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnpostscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnpostscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnpostscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnpostscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnpostscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnpostscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnpostscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnpostscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnpostscript.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnpostscript.wordpress.com&blog=1199990&post=3&subd=learnpostscript&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://learnpostscript.wordpress.com/2007/06/05/reverse-polish-notation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e84d4622239b2738f7e572c9f43d88c2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Groggy</media:title>
		</media:content>
	</item>
	</channel>
</rss>