xiaohongwu / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Evaluate variables #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In polish postfix expressions it is required to partly (or fully) evaluate 
expression variables - replace variables with their values (for example 
replace $2 variable with its value equal to 3.14)

Original issue reported on code.google.com by andrew.k...@gmail.com on 30 Sep 2006 at 3:54

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 1 Mar 2010 at 10:25

GoogleCodeExporter commented 8 years ago
I decided to take a stab at this and issue 4. In the process, I basically 
replaced the entirety of Core/PolishExpression.cs. For this reason, I do not 
recommend trying to read its diff; just treat it as "entirely new file with 
only minimal relation to to the old one".

Be aware that the implementation I chose for variable substitution will 
tolerate being passed fewer variables than are referenced, and ->will 
renumber<- the out-of-range variables: If the variables { 1 2 } are substituted 
into "$0 $1 $2 + +", the result is "1 2 $0 + +".

I also added tests; they should be pretty self-explanatory.

Original comment by dales...@gmail.com on 21 Oct 2010 at 7:17

Attachments: