use common::logging::Logger;

use crate::model::{CompilerError, Program};

// mod c;
mod dsc;

pub fn compiler_frontend(
    ext: &str,
    data: &str,
    logger: &Logger,
) -> Result<Program, CompilerError> {
    match ext {
        "dsc" => Ok(dsc::generate_ast(&data, &logger)?),
        // "c" => Ok(c::generate_ast(&data)?),
        _ => Err(CompilerError::Generic(format!(
            "File type {} not supported",
            ext
        ))),
    }
}
