mod commands;
mod diagnostics;
mod pipeline;
mod repl;
use std::path::PathBuf;
use std::process::ExitCode;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser)]
#[command(
name = "qala",
version,
about = "the qala programming language compiler"
)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Run {
file: PathBuf,
},
Check {
file: PathBuf,
},
Build {
file: PathBuf,
#[arg(long, value_enum, default_value_t = Target::Bytecode)]
target: Target,
#[arg(short, long)]
output: Option<PathBuf>,
},
Repl,
}
#[derive(Copy, Clone, PartialEq, Eq, ValueEnum)]
enum Target {
Bytecode,
Arm64,
}
fn main() -> ExitCode {
let cli = Cli::parse(); match cli.command {
Commands::Run { file } => commands::run(&file),
Commands::Check { file } => commands::check(&file),
Commands::Build {
file,
target,
output,
} => commands::build(&file, target, output),
Commands::Repl => repl::run_repl(),
}
}