28 lines
765 B
Rust
28 lines
765 B
Rust
|
extern crate clap;
|
||
|
extern crate huia_parser;
|
||
|
|
||
|
use clap::{App, Arg};
|
||
|
use std::fs;
|
||
|
|
||
|
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||
|
|
||
|
fn main() {
|
||
|
let matches = App::new("huiac")
|
||
|
.version(VERSION)
|
||
|
.author("James Harton <james@automat.nz>")
|
||
|
.about("The compiler for the Huia programming language.")
|
||
|
.arg(
|
||
|
Arg::with_name("INPUT")
|
||
|
.help("The source file to compile")
|
||
|
.required(true)
|
||
|
.index(1),
|
||
|
)
|
||
|
.get_matches();
|
||
|
|
||
|
let source_path = matches.value_of("INPUT").unwrap();
|
||
|
let source_file = fs::read_to_string(source_path).expect("Unable to read input file");
|
||
|
let result = huia_parser::parse_file(&source_file);
|
||
|
|
||
|
println!("{:?}", result);
|
||
|
}
|