Initial commit

This commit is contained in:
Griffin Smith 2021-03-07 15:29:59 -05:00
commit 80f8ede0bb
24 changed files with 2316 additions and 0 deletions

31
src/main.rs Normal file
View file

@ -0,0 +1,31 @@
use clap::Clap;
pub mod ast;
pub mod codegen;
pub(crate) mod commands;
pub(crate) mod common;
pub mod compiler;
pub mod interpreter;
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()?),
}
}