1mod codegen;
2
3pub mod ir;
4pub mod passes;
5#[cfg(test)]
6mod tests;
7
8pub use self::codegen::CodeGenerator;
9
10use miden_diagnostics::{Diagnostic, ToDiagnostic};
11
12#[derive(Debug, thiserror::Error)]
14pub enum CompileError {
15 #[error(transparent)]
16 Parse(#[from] air_parser::ParseError),
17 #[error(transparent)]
18 SemanticAnalysis(#[from] air_parser::SemanticAnalysisError),
19 #[error("compilation failed, see diagnostics for more information")]
20 Failed,
21}
22
23impl ToDiagnostic for CompileError {
24 fn to_diagnostic(self) -> Diagnostic {
26 match self {
27 Self::Parse(err) => err.to_diagnostic(),
28 Self::SemanticAnalysis(err) => err.to_diagnostic(),
29 Self::Failed => Diagnostic::error().with_message(self.to_string()),
30 }
31 }
32}