A simple number system Let me tell you about a simple number system. (which I made up just for this challenge)

This system contains the functions (), [], {}, and &lt;&gt;.

1. ()

When () is given no arguments, it evaluates to 0.

When () is given one or more arguments, it evaluates to the sum of the arguments.

2. []

When [] is given no arguments, it evaluates to -1.

When [] is given one or more arguments, it evaluates to the first argument minus the sum of the other arguments.

3. {}

When {} is given no arguments, it evaluates to 1.

When {} is given one or more arguments, it evaluates to the product of those arguments.

4. &lt;&gt;

When &lt;&gt; is given no arguments, it evaluates to 1.

When &lt;&gt; is given one or more arguments, it evaluates to the first argument integer divided by the product of the other arguments.

Your task

Given a string that contains a valid number (that means brackets are balanced, no division by 0s, etc.) in this simple number system, print its value.

Test cases

() -&gt; 0
(()()) -&gt; 0
([][]) -&gt; -2
({}&lt;&gt;) -&gt; 2
({}[]) -&gt; 0
[] -&gt; -1
[[][]] -&gt; 0
[()&lt;&gt;] -&gt; -1
{()} -&gt; 0
{([]&lt;&gt;)} -&gt; 0


Remember, this is code-golf, so the code with the fewest bytes wins.
Haskell, 357 306 277 251 228 224 188 185 180 bytes

A token-based parser with an explicit stack. (%) takes a token stack and a character and either pushes (opcode,defaultnumber) or (0,number) for ({[&lt;, or pops topmost numbers and one opcode and pushes the answer for )}]&gt;. Opcodes are encoded by a ascii enumeration hack.

Kudos to @ChristianSievers for his great answer that I borrowed some ideas from.



One-liner!

s%c|elem c"([&lt;{",g&lt;-div(fromEnum c)25=(g,[0,0,1,-1,1]!!g):s|(a,(o,n):b)&lt;-span((==0).fst)s=(0,[foldr1(flip$[(+),quot,(-),(*)]!!(o-1))$snd&lt;$&gt;a,n]!!(0^length a)):b
snd.head.foldl(%)[]


Now with less error-handling!
Usage:

*Main&gt; map (snd.head.foldl(%)[]) ["()","(()())","([][])","({}&lt;&gt;)","({}[])","[]","[[][]]","[()&lt;&gt;]","{()}","{([]&lt;&gt;)}"]
[0,0,-2,2,0,-1,0,-1,0,0]


Thanks @ChristianSievers for saving 14+3 bytes!

Thanks @Zgarb for saving some+4 bytes!