     if op not in '^'
         ops = " #{ops} "
 
-    if (hasPrecedence expr, l) > 0
+    if needsParens expr, l
         ls = parens ls
 
-    if (hasPrecedence expr, r) > 0
+    if needsParens expr, r
         rs = parens rs
 
     "#{ls}#{ops}#{rs}"

    '+': 2
    '-': 2

# TODO: I dislike this name
SYMBOLS = _.keys OPERATORS

VARIABLES = (String.fromCharCode(i) for i in _.range 97, 123)


        prev = tokens[i-1]
        curr = tokens[i]

        if (not prev or prev in SIGILS or prev is '(') and curr in '+-'
            cleaned.push (parseFloat "#{curr}1"), '*'
        else
            cleaned.push curr
