1pub mod parser;
2
3use crate::parser::errors::ParseError;
4use crate::parser::{parse_file, write_program_to_file};
5use std::path::Path;
6
7pub fn compile_file(file_path: &Path, output_path: &Path, binary: bool) -> Result<(), ParseError> {
8 match parse_file(file_path) {
9 Ok(program) => write_program_to_file(&program, output_path, binary),
10 Err(e) => Err(e),
11 }
12}
13
14pub fn compile_file_inplace(file_path: &Path, binary: bool) -> Result<(), ParseError> {
15 compile_file(file_path, file_path.with_extension("ko").as_path(), binary)
16}