Talk:Parsing/RPN to infix conversion: Difference between revisions

From Rosetta Code
Content added Content deleted
 
(→‎Other examples: incorrect - associativity)
Line 6: Line 6:
1 + (56 + 35) / (16 - 9)</pre>
1 + (56 + 35) / (16 - 9)</pre>
--[[User:Paddy3118|Paddy3118]] 20:19, 3 December 2011 (UTC)
--[[User:Paddy3118|Paddy3118]] 20:19, 3 December 2011 (UTC)
== Examples Incorrect ==
Several examples (i.e. Python, and TCL) don't deal with associativity correctly - the code doesn't even refer to the attribute - it's defined and not used. I'm not sure of the Ruby code. The following "1 2 + 3 4 + ^ 5 6 + ^" should produce "( ( 1 + 2 ) ^ ( 3 + 4 ) ) ^ ( 5 + 6 )". --[[User:Dgamey|Dgamey]] 04:03, 17 December 2011 (UTC)

Revision as of 04:03, 17 December 2011

Other examples

The Ruby Quiz article mentions the following two additional examples:

    $ ruby postfix_to_infix.rb '56 34 213.7 + * 678 -'
    56 * (34 + 213.7) - 678
    $ ruby postfix_to_infix.rb '1 56 35 + 16 9 - / +'
    1 + (56 + 35) / (16 - 9)

--Paddy3118 20:19, 3 December 2011 (UTC)

Examples Incorrect

Several examples (i.e. Python, and TCL) don't deal with associativity correctly - the code doesn't even refer to the attribute - it's defined and not used. I'm not sure of the Ruby code. The following "1 2 + 3 4 + ^ 5 6 + ^" should produce "( ( 1 + 2 ) ^ ( 3 + 4 ) ) ^ ( 5 + 6 )". --Dgamey 04:03, 17 December 2011 (UTC)