exec_program.h 1.0 KB

1234567891011121314151617181920212223242526272829
  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. // Helpers should be added here when logic in syntax.ypp is more than a single
  5. // statement. The intent is to minimize the amount of C++ in the .ypp file, to
  6. // improve ease of maintenance.
  7. #ifndef CARBON_EXPLORER_INTERPRETER_EXEC_PROGRAM_H_
  8. #define CARBON_EXPLORER_INTERPRETER_EXEC_PROGRAM_H_
  9. #include "explorer/ast/ast.h"
  10. #include "llvm/Support/raw_ostream.h"
  11. namespace Carbon {
  12. // Perform semantic analysis on the AST.
  13. auto AnalyzeProgram(Nonnull<Arena*> arena, AST ast,
  14. std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
  15. -> ErrorOr<AST>;
  16. // Run the program's `Main` function.
  17. auto ExecProgram(Nonnull<Arena*> arena, AST ast,
  18. std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
  19. -> ErrorOr<int>;
  20. } // namespace Carbon
  21. #endif // CARBON_EXPLORER_INTERPRETER_EXEC_PROGRAM_H_