diff --git a/src/main.rs b/src/main.rs index 87c15c4..9b22b34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,7 @@ +use std::env; + mod parse; fn main() { - println!("Hello, world!"); + println!("{}", parse::parse(env::args().nth(1).unwrap().as_ref())); } diff --git a/src/parse.rs b/src/parse.rs index 4088adf..7b96e33 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -313,6 +313,10 @@ fn nodes_to_num(mut nodes: Vec) -> Float { } } +pub fn parse(s: &str) -> Float { + nodes_to_num(nodes_from_str(s).unwrap()) +} + #[test] fn test_nodes_to_num() { assert_eq!(