removeParens :: [Expr] -> [Expr]
removeParens = map conv
    where conv (Parens xpr) = conv xpr
          conv (Binop op l r) = Binop op (conv l) (conv r)
          conv (Directive str xs) = Directive str (removeParens xs)
          conv (Define str xpr) = Define str (conv xpr)
          conv (RegIndex r xpr) = RegIndex r (conv xpr)
          conv (Instr i xs) = Instr i (removeParens xs)
          conv xpr = xpr

-- Parses an argument
removeParens :: [Expr] -> [Expr]
removeParens = map conv
    where conv (Parens xpr) = conv xpr
          conv (Binop op l r) = Binop op (conv l) (conv r)
          conv (Directive str xs) = Directive str (removeParens xs)
          conv (Define str xpr) = Define str (conv xpr)
          conv (RegIndex r xpr) = RegIndex r (conv xpr)
          conv (Instr i xs) = Instr i (removeParens xs)
          conv xpr = xpr

-- Parses an argument
removeParens = map conv
    where conv (Parens xpr) = conv xpr
          conv (Binop op l r) = Binop op (conv l) (conv r)
          conv (Directive str xs) = Directive str (removeParens xs)
          conv (Define str xpr) = Define str (conv xpr)
          conv (RegIndex r xpr) = RegIndex r (conv xpr)
          conv (Instr i xs) = Instr i (removeParens xs)
          conv xpr = xpr

-- Parses an argument