This repository has been archived on 2020-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
not-python-old.2020-08-27/src/main.rs

44 lines
977 B
Rust
Raw Normal View History

#![allow(dead_code)]
#![feature(new_uninit)]
mod syn;
mod obj;
mod mem;
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(())
}