#![allow(dead_code)]
#![feature(unsize, coerce_unsized, new_uninit)]
mod compile;
mod syn;
mod obj;
mod mem;
mod vm;
use std::{
convert::TryFrom,
fs,
path::PathBuf,
};
use structopt::StructOpt;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
#[derive(StructOpt, Debug)]
struct Options {
/// The input file to work with.
///
/// By default, the file will be executed. If -c is passed, it will not run and only compile.
/// Supplying - for the path will read from STDIN.
#[structopt(name = "FILE", parse(from_os_str))]
input: PathBuf,
/*
/// Disassemble object that would be passed to VM and exit before running it.
#[structopt(short = "d", long)]
disassemble: bool,
*/
}
fn main() -> Result<()> {
use syn::{
parser::Parser,
let opt = Options::from_args();
let text = fs::read_to_string(&opt.input)?;
let mut parser = Parser::try_from(text.as_str())?;
println!("{:#?}", parser.next_body()?);
Ok(())