parse_and_execute.h 1.3 KB

12345678910111213141516171819202122232425262728293031
  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 CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_
  5. #define CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_
  6. #include "common/error.h"
  7. #include "explorer/common/trace_stream.h"
  8. namespace Carbon {
  9. // Parses and executes the input file, returning the program result on success.
  10. // This API is intended for use by main execution.
  11. auto ParseAndExecuteFile(std::string_view prelude_path,
  12. std::string_view input_file_name, bool parser_debug,
  13. Nonnull<TraceStream*> trace_stream,
  14. Nonnull<llvm::raw_ostream*> print_stream)
  15. -> ErrorOr<int>;
  16. // Parses and executes the source, returning the program result on success.
  17. // Discards output.
  18. auto ParseAndExecute(std::string_view prelude_path,
  19. std::string_view input_file_name,
  20. std::string_view file_contents, bool parser_debug,
  21. Nonnull<TraceStream*> trace_stream,
  22. Nonnull<llvm::raw_ostream*> print_stream) -> ErrorOr<int>;
  23. } // namespace Carbon
  24. #endif // CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_