lexper 0.0.3

A simple CLI calculator with a handwritten lexer and parser in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut args = std::env::args();
    if args.len() != 2 {
        eprintln!("This program accepts only 1 argument, the expression itself");
        return Ok(());
    }
    args.next(); // consume path

    let expr = args
        .next()
        .expect("Expected an expression as a first argument");

    let result = lexper::eval(&expr)?;
    println!("{}", result);
    Ok(())
}