about summary refs log blame commit diff
path: root/src/main.rs
blob: b539ebbb3d99cd8f7a3b099f0f531688c9da2ecd (plain) (tree)
1
2
3
4
5
6
7
8
9







                        
            






















                                                        
use clap::Clap;

pub mod ast;
pub mod codegen;
pub(crate) mod commands;
pub(crate) mod common;
pub mod compiler;
pub mod interpreter;
#[macro_use]
pub mod parser;

pub use common::{Error, Result};

#[derive(Clap)]
struct Opts {
    #[clap(subcommand)]
    subcommand: Command,
}

#[derive(Clap)]
enum Command {
    Eval(commands::Eval),
    Compile(commands::Compile),
}

fn main() -> anyhow::Result<()> {
    let opts = Opts::parse();
    match opts.subcommand {
        Command::Eval(eval) => Ok(eval.run()?),
        Command::Compile(compile) => Ok(compile.run()?),
    }
}