parseSymbol :: B.ByteString -> Symbol
parseSymbol s =
  let chunks = B.words s
  in
    if (length chunks > 0) then
      case (head chunks) of
        ".var" -> Variable False
                  (convert $ B.readInteger $ (chunks !! 1))
                  (chunks !! 2)
        ".proc" -> Procedure False (chunks !! 1)
        ".external" ->
          case (chunks !! 1) of
            "var" -> Variable True
                     (convert $ B.readInteger $ (chunks !! 2)) (chunks !! 3)
            "proc" -> Procedure True (chunks !! 2)
            _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
        _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
    else error $ "Could not parse " ++ (show s) ++ " as a symbol"
  where
    convert = fromIntegral . fst . fromJust
parseSymbol :: B.ByteString -> Symbol
parseSymbol s =
  let chunks = B.words s
  in
    if (length chunks > 0) then
      case (head chunks) of
        ".var" -> Variable False
                  (convert $ B.readInteger $ (chunks !! 1))
                  (chunks !! 2)
        ".proc" -> Procedure False (chunks !! 1)
        ".external" ->
          case (chunks !! 1) of
            "var" -> Variable True
                     (convert $ B.readInteger $ (chunks !! 2)) (chunks !! 3)
            "proc" -> Procedure True (chunks !! 2)
            _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
        _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
    else error $ "Could not parse " ++ (show s) ++ " as a symbol"
  where
    convert = fromIntegral . fst . fromJust
parseSymbol s =
  let chunks = B.words s
  in
    if (length chunks > 0) then
      case (head chunks) of
        ".var" -> Variable False
                  (convert $ B.readInteger $ (chunks !! 1))
                  (chunks !! 2)
        ".proc" -> Procedure False (chunks !! 1)
        ".external" ->
          case (chunks !! 1) of
            "var" -> Variable True
                     (convert $ B.readInteger $ (chunks !! 2)) (chunks !! 3)
            "proc" -> Procedure True (chunks !! 2)
            _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
        _ -> error $ "Could not parse " ++ (show s) ++ " as a symbol"
    else error $ "Could not parse " ++ (show s) ++ " as a symbol"
  where
    convert = fromIntegral . fst . fromJust