parse.h 753 B

12345678910111213141516171819202122232425
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef EXECUTABLE_SEMANTICS_SYNTAX_PARSE_H_
  5. #define EXECUTABLE_SEMANTICS_SYNTAX_PARSE_H_
  6. #include <string>
  7. #include <variant>
  8. #include "executable_semantics/ast/abstract_syntax_tree.h"
  9. namespace Carbon {
  10. // This is the code given us by Bison, for now.
  11. using SyntaxErrorCode = int;
  12. // Returns the AST representing the contents of the named file, or an error code
  13. // if parsing fails.
  14. auto Parse(const std::string& input_file_name)
  15. -> std::variant<Carbon::AST, SyntaxErrorCode>;
  16. } // namespace Carbon
  17. #endif // EXECUTABLE_SEMANTICS_SYNTAX_PARSE_H_