Skip to content

A simple math expression evaluator written in rust.

Notifications You must be signed in to change notification settings

ikws4/Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

A simple math expression evaluator written in rust.

Usage

cargo run

Functions

  • abs
  • ceil
  • floor
  • round
  • sign
  • sin
  • cos
  • tan
  • asin
  • acos
  • atan
  • ln
  • log
  • sqrt
  • max
  • min
  • clamp
  • clamp01

Constants

  • pi
  • e

Example

> 1 + 2 * (2 ^ 10) + ceil(10 / 3) + sin(2 * pi)

Grammar

expression: addition
addition: multiplication ('+' | '-' multiplication)*
multiplication: unary ('*' | '/' | '%' | '^' unary)*
unary: '-'? parentheses
parentheses: '(' expression ')' | atom
atom: number | call
number: [0-9]+ ('.' [0-9]+)?
call: identifier ('(' arguments ')')?
identifier: [a-zA-Z][a-zA-Z0-9]*
arguments: expression (',' expression)*

About

A simple math expression evaluator written in rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages