# Challenge :

Given a string representing a mathematical expression return the result

# Input :

A string representing a mathematical expression : '1 + 2 - 3 * (2/3 * 1)'.

# Output :

The result after performing all operations.

# Operators :

## Possible operators

+     ---> plus
-     ---> minus
*     ---> multiplication
/     ---> division
(     ---> opening parenthesis
)     ---> closing parenthesis


## operator precedence :

Operators are always evaluated from left-to-right going from here ---> there, and * and / must be evaluated before + and -

Parenthesis take precedence over everything else and must be completed before all.

## Parenthesis :

You should be able to support multiple(nested) levels of parenthesis.

e.g :

 1 - ( 2 * ( 3 / 9 + ( 2 * 6 ) ) )


## White space :

Whitespace doesn't matter, you can have whitespace between operators or you can't (Consistency is required though)

# Note :

• Given input will always be valid. It will consist of nothing except

• Numbers (0-9) of arbitary length
• operators (+ , - , * , /)
• parenthesis (( / )) nested
• white space (optional with consistency)
• Use of eval and Function or their equivalent counter-parts in any language is forbidden

• using built-in functions designed specifically for this is also forbidden
• all standard loopholes are forbidden by default.
• You need to support floats to a reasonably high value (depending on the language) but after that integers will work. alternately after that floating point error (if reasonable) will be acceptable.
• This is so shortest code in bytes for each language wins.

# Examples :

 1 + 2 * 3              ---> 7
10 * 2 / (2 - 3) * 2   ---> -10 (expression is (2*10) / ((2-3)*2) => 20/-2
1-(2*(3/9+(2*6)-3))    ---> -53/3 (3/9 is the fraction and not the whole)
-1 * --10              ---> -10 (support for unary minus)


• Is unary minus one of the operations ? Commented May 20, 2018 at 18:20
• @HatsuPointerKun : Yep Commented May 20, 2018 at 18:21
• Should floating point numbers also be supported or only integer is okay ? Commented May 20, 2018 at 18:27
• @StanStrum haha, nice one (but you would still need something like #&, which costs 2 bytes). But I think that's invalid because it relies on Mathematica's internal auto-evaluation. Commented May 20, 2018 at 21:48
• Shouldn't your second example equal -40 instead of -10? Commented May 20, 2018 at 22:14