parse.h 865 B

1234567891011121314151617181920212223242526
  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/ast.h"
  9. #include "executable_semantics/common/arena.h"
  10. namespace Carbon {
  11. // This is the code given us by Bison, for now.
  12. using SyntaxErrorCode = int;
  13. // Returns the AST representing the contents of the named file, or an error code
  14. // if parsing fails. Allocations go into the provided arena.
  15. auto Parse(Nonnull<Arena*> arena, const std::string& input_file_name,
  16. bool trace) -> std::variant<Carbon::AST, SyntaxErrorCode>;
  17. } // namespace Carbon
  18. #endif // EXECUTABLE_SEMANTICS_SYNTAX_PARSE_H_