Form Parser::parse() const { Form ast; auto it = tokens.cbegin(); while (it != tokens.cend()) { if (*it != "(") { std::ostringstream ss; ss << "Error: token " << *it << "is not in an expression"; throw ParsingError(ss.str()); } ast.push_back(parse_expr(++it, tokens.cend())); } return ast; }