parse_and_execute.h 1.1 KB

12345678910111213141516171819202122232425262728
  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(const std::string& prelude_path,
  12. const std::string& 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(const std::string& prelude_path, const std::string& source)
  19. -> ErrorOr<int>;
  20. } // namespace Carbon
  21. #endif // CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_