Closed arturkasperek closed 6 years ago
We need parse expression like here:
x = 12 + 9 * ( 2 + otherFunc(1 + 7 * 3, 4 + 5) )
correctly ( we need remember about braces and operators importance ex ( '*' > '+' ) ), for that case we should generate assembler like here:
pushi 3 pushi 7 mul pushi 1 add pushi 5 pushi 4 add call otherFunc pushi 2 add pushi 9 mul pushi 12 add
I added tests for that task. You should look for tests named CorrectlyPassBasicExpression and CorrectlyPassComplexExpression. After implementing that feature tests should pass without problems
CorrectlyPassBasicExpression
CorrectlyPassComplexExpression
We should use https://en.wikipedia.org/wiki/Reverse_Polish_notation
https://stackoverflow.com/questions/24279027/usage-of-functions-with-rpn-form
We need parse expression like here:
correctly ( we need remember about braces and operators importance ex ( '*' > '+' ) ), for that case we should generate assembler like here:
I added tests for that task. You should look for tests named
CorrectlyPassBasicExpression
andCorrectlyPassComplexExpression
. After implementing that feature tests should pass without problems