Talk:Parsing/Shunting-yard algorithm: Difference between revisions

m
→‎incorrect programs?: added whitespace and bigger font to help clarify some character strings.
m (→‎incorrect programs?: added whitespace and bigger font to help clarify some character strings.)
 
(7 intermediate revisions by 4 users not shown)
Line 6:
 
<nowiki>{{improved}}</nowiki>! --[[User:Paddy3118|Paddy3118]] 05:47, 6 December 2011 (UTC)
 
==incorrect programs?==
 
I noticed that at least one programming example is treating the input string as characters instead of tokens. &nbsp; This works as long as all the numbers (and/or operators) are single characters. &nbsp; Would it be possible to change (shudder) the test input string specification (or add another) to include a (say) multi-digit number? &nbsp; If it's not reasonable to add another test case, how about changing the &nbsp; <big>'''4''' </big> &nbsp; to &nbsp; <big>'''004'''</big> &nbsp; which wouldn't affect the calculated output. &nbsp; Another possibility would be to change (say) the &nbsp; <big>'''5'''</big> &nbsp; to &nbsp; <big>'''5.'''</big> &nbsp; (for instance). &nbsp; And yet another possibility would be to add &nbsp; <big>'''**'''</big> &nbsp; as an additional exponentiation symbol (or some other compound operator). &nbsp; Changing the test case (or adding one) will eliminate the need for flagging the program as &nbsp; ''incorrect'' &nbsp; which I probably won't commit to doing as I really don't have any practical way to verify if the suspect program will work correctly with tokens instead of characters. &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] 06:42, 14 December 2012 (UTC)
 
== Improve Description ==
: This seems to be about infix to RPN but it doesn't say it explicitly. --[[User:Dgamey|Dgamey]] 04:00, 13 December 2011 (UTC)
 
:Hi Dgamey, from the wikipedia article:
::''"In computer science, the shunting-yard algorithm is a method for parsing mathematical expressions specified in infix notation. It can be used to produce output in Reverse Polish notation (RPN) or as an abstract syntax tree (AST)."''
:The title reflects that it is this shunting-yard algorithm that is to be used in transforming infix to, in this case, RPN. --[[User:Paddy3118|Paddy3118]] 09:07, 13 December 2011 (UTC)
:: It's a minor nit I know but it didn't say it. I made a slight tweak in the description. Not everybody knows algorithms by name or remembers if they have broader application. Nor does everyone read the WP article. (Good set of tasks though). --[[User:Dgamey|Dgamey]] 14:45, 13 December 2011 (UTC)
 
:::Thanks for the great criticism Dgamey. Ideally I'd want to put enough on the RC page to make it complete in itself, but sometimes the linked-to wikipedia page is quite rich (and I feel a little lazy ...) --[[User:Paddy3118|Paddy3118]] 06:23, 14 December 2011 (UTC)
:::: And then there are those lazy people who don't want to read the WP article :) --[[User:Dgamey|Dgamey]] 12:26, 14 December 2011 (UTC)