<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Extension to the &#8216;Shunting Yard&#8217; algorithm to allow variable numbers of arguments to functions</title>
	<atom:link href="http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/</link>
	<description>I am not an IP address! I am a free 'blog!</description>
	<lastBuildDate>Thu, 22 Jul 2010 10:45:07 +1200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steven Hughes</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-120051</link>
		<dc:creator>Steven Hughes</dc:creator>
		<pubDate>Wed, 04 Feb 2009 15:49:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-120051</guid>
		<description>Correction:

&#039;Min(1,2) would be converted to &#039;1 2 2 Min&#039;</description>
		<content:encoded><![CDATA[<p>Correction:</p>
<p>&#8216;Min(1,2) would be converted to &#8216;1 2 2 Min&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Hughes</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-120050</link>
		<dc:creator>Steven Hughes</dc:creator>
		<pubDate>Wed, 04 Feb 2009 15:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-120050</guid>
		<description>I recently wrote a calculator app for my Mobile 6 phone because the one that came with it did not support anything other than basic arithmetic.  I performed the exact same 3 high-level steps that you used.  In addition, I also found it helpful to modify the Shunting Yard algorithm.  However, my modification was designed to validate that the correct number of parameters was passed to a function.  I counted the number of commas in the parameter list using an arg count stack just like you did.  One thing my modification did not do was to ensure that a value was in fact passed for each parameter.  My modification was not able to detect null parameters (e.g. min(,3) - first parameter missing).  It appears your &#039;were values&#039; stack is designed for just such a purpose.

I had a thought on how to handle a varialbe number of parameters and stil maintain a single postfix expression.  If the Shunting Yard algorithm is modified to put the number of arguments passed to a function as the function&#039;s last parameter, you could easily handle variable numbers of parameters when you evaluate the postfix expression.

&#039;Min(1,2,3,4,5)&#039; would be converted to postfix as &#039;1 2 3 4 5 5 Min&#039;.  The Min function would pop the last &#039;5&#039; (which would be on the top of the stack) and know it needed to pop 5 more values to get all it&#039;s parameters.  Similarly, &#039;Min(1,2)&#039; would be converted to &#039;1 2 3 Min&#039;.  

I have not, actually, implemented this but was thinking that it would probably be my approach if I were to.  Of course, I would probably want to implement the null value check to so I didn&#039;t corrupt the stack by reading parameters meant for other operations.</description>
		<content:encoded><![CDATA[<p>I recently wrote a calculator app for my Mobile 6 phone because the one that came with it did not support anything other than basic arithmetic.  I performed the exact same 3 high-level steps that you used.  In addition, I also found it helpful to modify the Shunting Yard algorithm.  However, my modification was designed to validate that the correct number of parameters was passed to a function.  I counted the number of commas in the parameter list using an arg count stack just like you did.  One thing my modification did not do was to ensure that a value was in fact passed for each parameter.  My modification was not able to detect null parameters (e.g. min(,3) &#8211; first parameter missing).  It appears your &#8216;were values&#8217; stack is designed for just such a purpose.</p>
<p>I had a thought on how to handle a varialbe number of parameters and stil maintain a single postfix expression.  If the Shunting Yard algorithm is modified to put the number of arguments passed to a function as the function&#8217;s last parameter, you could easily handle variable numbers of parameters when you evaluate the postfix expression.</p>
<p>&#8216;Min(1,2,3,4,5)&#8217; would be converted to postfix as &#8216;1 2 3 4 5 5 Min&#8217;.  The Min function would pop the last &#8216;5&#8242; (which would be on the top of the stack) and know it needed to pop 5 more values to get all it&#8217;s parameters.  Similarly, &#8216;Min(1,2)&#8217; would be converted to &#8216;1 2 3 Min&#8217;.  </p>
<p>I have not, actually, implemented this but was thinking that it would probably be my approach if I were to.  Of course, I would probably want to implement the null value check to so I didn&#8217;t corrupt the stack by reading parameters meant for other operations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orion</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-114512</link>
		<dc:creator>orion</dc:creator>
		<pubDate>Thu, 20 Nov 2008 15:26:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-114512</guid>
		<description>I myself stumbled on this problem and I find it easier to implement output queue as queue of trees. Only change to the algorithm is that when operator is pushed to it, you make last two elements its children (at the end you get only 1 tree, which you read recursively to RPN). Functions with arbitrary arguments are handled this way: when f is pushed to operator stack, you push dummy token on the queue. When f is pushed on the queue, you make everything after last dummy its children.</description>
		<content:encoded><![CDATA[<p>I myself stumbled on this problem and I find it easier to implement output queue as queue of trees. Only change to the algorithm is that when operator is pushed to it, you make last two elements its children (at the end you get only 1 tree, which you read recursively to RPN). Functions with arbitrary arguments are handled this way: when f is pushed to operator stack, you push dummy token on the queue. When f is pushed on the queue, you make everything after last dummy its children.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-90865</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Sat, 05 Jul 2008 23:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-90865</guid>
		<description>You can use it as a syntax check if you do a full evaluation of the RPN, otherwise it&#039;ll only give you a basic check. I don&#039;t know how it compares to R-D in that sense, I&#039;ve never used it.</description>
		<content:encoded><![CDATA[<p>You can use it as a syntax check if you do a full evaluation of the RPN, otherwise it&#8217;ll only give you a basic check. I don&#8217;t know how it compares to R-D in that sense, I&#8217;ve never used it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Audi Nugraha</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-90782</link>
		<dc:creator>Audi Nugraha</dc:creator>
		<pubDate>Sat, 05 Jul 2008 20:51:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-90782</guid>
		<description>Is Shunting Yard algorithm could be a syntax check?

Is it better than Recursive-Decent parser?</description>
		<content:encoded><![CDATA[<p>Is Shunting Yard algorithm could be a syntax check?</p>
<p>Is it better than Recursive-Decent parser?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Urs</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-82837</link>
		<dc:creator>Urs</dc:creator>
		<pubDate>Sat, 07 Jun 2008 12:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-82837</guid>
		<description>Hello Robin!
Thank you very much for your extension of the original algorithm. It&#039;s great and it works perfect for me. I wrote a spreadsheet-like processor in SAP&#039;s programming language ABAP Object using the shunting yard algorithm. I find it a very good example for solving recursive problems in a elegant and easy understandable way.
Cheers! Urs</description>
		<content:encoded><![CDATA[<p>Hello Robin!<br />
Thank you very much for your extension of the original algorithm. It&#8217;s great and it works perfect for me. I wrote a spreadsheet-like processor in SAP&#8217;s programming language ABAP Object using the shunting yard algorithm. I find it a very good example for solving recursive problems in a elegant and easy understandable way.<br />
Cheers! Urs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-68443</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Fri, 11 Apr 2008 11:01:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-68443</guid>
		<description>Hi, if I find it interesting, I&#039;d be happy to post it. Most of what I write on my blog is stuff that I&#039;ve done or find useful, but I&#039;m willing to extend that, it&#039;s all free-form :)

You may be interested, one extension I&#039;ve made to my implementation is allowing boolean functions, in the C-style. basically, if a value is 1 (or 1.0) it is true, else it is false. This allows more spreadsheet-like functions, such as if(1=2, 3, 4) which will return 4. This doesn&#039;t really impact on the algorithm that I documented any, just adding more binary operators.

Out of curiosity, although I&#039;m all for more open source code, why not combine forces with octave or scilab rather than start something new?</description>
		<content:encoded><![CDATA[<p>Hi, if I find it interesting, I&#8217;d be happy to post it. Most of what I write on my blog is stuff that I&#8217;ve done or find useful, but I&#8217;m willing to extend that, it&#8217;s all free-form <img src='http://www.kallisti.net.nz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You may be interested, one extension I&#8217;ve made to my implementation is allowing boolean functions, in the C-style. basically, if a value is 1 (or 1.0) it is true, else it is false. This allows more spreadsheet-like functions, such as if(1=2, 3, 4) which will return 4. This doesn&#8217;t really impact on the algorithm that I documented any, just adding more binary operators.</p>
<p>Out of curiosity, although I&#8217;m all for more open source code, why not combine forces with octave or scilab rather than start something new?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Efstratios Gavves</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-68418</link>
		<dc:creator>Efstratios Gavves</dc:creator>
		<pubDate>Fri, 11 Apr 2008 08:47:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-68418</guid>
		<description>Hi. My name is Stratis. I am in a group that develops an open source Matlab-like program. I am implementing the parser. Your suggestions were very useful. I have added already some new feautures, like using variables without having to subsitute them at the start of the algorithm, suing matrices, like a[1,2,3] and initializing them like
[[1,2],[3,4]]. When I finish, would you like to post the algorithm here?</description>
		<content:encoded><![CDATA[<p>Hi. My name is Stratis. I am in a group that develops an open source Matlab-like program. I am implementing the parser. Your suggestions were very useful. I have added already some new feautures, like using variables without having to subsitute them at the start of the algorithm, suing matrices, like a[1,2,3] and initializing them like<br />
[[1,2],[3,4]]. When I finish, would you like to post the algorithm here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-53519</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Tue, 19 Feb 2008 19:17:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-53519</guid>
		<description>Yeah, nested functions were an issue, my first attempt didn&#039;t have the stack for argument counts because I forgot about the possibility. However, it was part of my test case for the implementation :)</description>
		<content:encoded><![CDATA[<p>Yeah, nested functions were an issue, my first attempt didn&#8217;t have the stack for argument counts because I forgot about the possibility. However, it was part of my test case for the implementation <img src='http://www.kallisti.net.nz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eric</title>
		<link>http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/comment-page-1/#comment-53397</link>
		<dc:creator>eric</dc:creator>
		<pubDate>Tue, 19 Feb 2008 13:45:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/#comment-53397</guid>
		<description>sorry, I&#039;ve implemented and tested it, and you were right, I misread : &quot;If the were values stack has a value on it, pop it and push true. Push false onto where values.&quot;
there are two were_value operations, I only read one!</description>
		<content:encoded><![CDATA[<p>sorry, I&#8217;ve implemented and tested it, and you were right, I misread : &#8220;If the were values stack has a value on it, pop it and push true. Push false onto where values.&#8221;<br />
there are two were_value operations, I only read one!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
