mod ir; mod name_analysis; mod p3; // mod unparse; use std::path::PathBuf; use crate::name_analysis::name_analysis; use crate::p3::pretty_print_parse; // use crate::unparse::unparse; use clap::{Parser, Subcommand}; use crate::ir::compile_to_ir; #[derive(Debug, Parser)] #[command(name = "dmc")] #[command(about = "Deimos Compiler", long_about = None)] struct Cli { #[command(subcommand)] command: Commands, } #[derive(Debug, Subcommand)] enum Commands { #[command(arg_required_else_help = true)] Unparse { paths: Vec, }, P3 { paths: Vec, }, NameAnalysis { paths: Vec, }, Ir { paths: Vec, } } fn main() { let args = Cli::parse(); match args.command { // Commands::Unparse { paths } => { // for path in paths { // unparse(&path); // } // } Commands::P3 { paths } => { for path in paths { pretty_print_parse(&path) } } Commands::NameAnalysis { paths } => { let result = name_analysis(&paths); if let Err(e) = result { eprintln!("{}", e) } } Commands::Ir { paths } => { let result = compile_to_ir(&paths); if let Err(e) = result { eprintln!("{}", e) } } _ => todo!(), } }