Content deleted Content added
m Article Class assessment using AWB |
syntaxhighlight & fix lint |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
{{WikiProject
{{WikiProject
{{WikiProject Computing|importance=|auto=yes}}
}}
What does the link "Block (Java programming language)" mean? It points to nowhere. [[User:Lathspell|Lathspell]] 18:12, 18 February 2006 (UTC)
Line 10 ⟶ 12:
--[[Special:Contributions/98.225.38.255|98.225.38.255]] ([[User talk:98.225.38.255|talk]]) 23:25, 13 February 2010 (UTC) I think the C# (and probably Java version is wrong). The problem is in Evaluator function, the left and right operands are switched. If you compute 6 - 4 or 6 4 - , the result that you get is 4 - 6. The solution is
<syntaxhighlight lang="text">
IExpression r = stack.Pop();
IExpression l = stack.Pop();
stack.Push(new Plus(l, r));
</syntaxhighlight>
instead of
<syntaxhighlight lang="text">
stack.Push(new Plus(stack.Pop(), stack.Pop()));
</syntaxhighlight>
Corrected code:
<syntaxhighlight lang="text">
public Evaluator(string expression)
{
Line 45 ⟶ 47:
syntaxTree = stack.Pop();
}
</syntaxhighlight>
|