updated compiler to support multiple frontends and backends
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
use crate::model::{CompilerError, Program};
|
||||
|
||||
mod c;
|
||||
mod dsc;
|
||||
|
||||
pub fn compiler_frontend(ext: &str, data: &str) -> Result<Program, CompilerError> {
|
||||
match ext {
|
||||
"dsc" => Ok(dsc::generate_ast(&data)?),
|
||||
"c" => Ok(c::generate_ast(&data)?),
|
||||
_ => Err(CompilerError::Generic(format!(
|
||||
"File type {} not supported",
|
||||
ext
|
||||
))),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user