Skip to content

a recursive descent parser for calculating arithmetic expressions written in Rust

Notifications You must be signed in to change notification settings

massivefermion/calculator-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What?

a recursive descent parser for calculating arithmetic expressions written in Rust

Why?

just to get better at writing Rust code and also learning how to write a parser

How to use?

you can just use cargo run like below to evaluate the expression:

cargo run -- eval '-(23.56e3 + 2e-3) - (-10.2) * (2 + 8.2 + 2 * (4 + 5)) ^ (-1.2 - 1)'

use the following if you want to get the abstract syntax tree:

cargo run -- ast '-(23.56e3 + 2e-3) - (-10.2) * (2 + 8.2 + 2 * (4 + 5)) ^ (-1.2 - 1)'

About

a recursive descent parser for calculating arithmetic expressions written in Rust

Resources

Stars

Watchers

Forks

Languages