serene-rust-implementation/src/main.rs

36 lines
832 B
Rust
Raw Normal View History

extern crate inkwell;
2020-06-16 09:27:32 +01:00
2020-06-20 18:20:10 +01:00
use clap::{load_yaml, App};
2020-06-19 19:37:00 +01:00
use std::fs::File;
use std::io;
use std::io::prelude::*;
2020-06-14 21:02:31 +01:00
use std::string::String;
pub mod ast;
pub mod compiler;
pub mod namespace;
2020-06-16 09:27:32 +01:00
pub mod reader;
2020-07-06 14:18:29 +01:00
pub mod scope;
pub mod types;
2020-06-19 19:37:00 +01:00
fn main() -> io::Result<()> {
2020-06-20 18:20:10 +01:00
let yaml = load_yaml!("cli.yml");
let args = App::from(yaml).get_matches();
let context = compiler::create_context();
let compiler = compiler::Compiler::new(&context);
2020-06-14 21:02:31 +01:00
2020-06-20 18:20:10 +01:00
if let Some(input) = args.value_of("INPUT") {
let mut f = File::open(input)?;
2020-06-19 19:37:00 +01:00
2020-06-20 18:20:10 +01:00
let mut buf = String::new();
f.read_to_string(&mut buf)?;
match reader::read_string(&buf) {
Ok(v) => println!("{:?}", v),
Err(e) => println!(">> error {:?}", e),
}
} else {
println!("Input file is missing.")
2020-06-19 19:37:00 +01:00
}
Ok(())
2020-06-05 22:23:14 +01:00
}