2021-03-07 21:29:59 +01:00
|
|
|
use clap::Clap;
|
|
|
|
|
|
|
|
pub mod ast;
|
|
|
|
pub mod codegen;
|
|
|
|
pub(crate) mod commands;
|
|
|
|
pub(crate) mod common;
|
|
|
|
pub mod compiler;
|
|
|
|
pub mod interpreter;
|
2021-03-20 23:14:23 +01:00
|
|
|
pub(crate) mod passes;
|
2021-03-13 18:19:44 +01:00
|
|
|
#[macro_use]
|
2021-03-07 21:29:59 +01:00
|
|
|
pub mod parser;
|
2021-03-14 03:57:27 +01:00
|
|
|
pub mod tc;
|
2021-03-07 21:29:59 +01:00
|
|
|
|
|
|
|
pub use common::{Error, Result};
|
|
|
|
|
|
|
|
#[derive(Clap)]
|
|
|
|
struct Opts {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
subcommand: Command,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clap)]
|
|
|
|
enum Command {
|
|
|
|
Eval(commands::Eval),
|
|
|
|
Compile(commands::Compile),
|
2021-03-14 03:57:27 +01:00
|
|
|
Check(commands::Check),
|
2021-03-07 21:29:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
|
|
let opts = Opts::parse();
|
|
|
|
match opts.subcommand {
|
|
|
|
Command::Eval(eval) => Ok(eval.run()?),
|
|
|
|
Command::Compile(compile) => Ok(compile.run()?),
|
2021-03-14 03:57:27 +01:00
|
|
|
Command::Check(check) => Ok(check.run()?),
|
2021-03-07 21:29:59 +01:00
|
|
|
}
|
|
|
|
}
|