#command-line #calculator #right #left

nightly bin+lib simple_calculator_cmd

command line simple calculator and library

2 releases

0.1.1 Nov 7, 2021
0.1.0 Nov 7, 2021

#1518 in Math

MIT license

18KB
503 lines

simple calculator command

command line simple calculator and library

Context Free Grammar

Left Recursion

Goal -> Statement

Statement -> Expression

Expression -> Expression + Term | Expression - Term | Term | + Term | - Term

Term -> Term * Factor | Term / Factor | Factor

Factor -> ( Expression ) | Factor ^ Factor| number

Right Recursion

Goal -> Statement

Statement -> Expression

Expression -> Term Expression' | + Term Expression' | - Term Expression'

Expression' -> + Term Expression' | - Term Expression' | ε

Term -> Factor Term'

Term' -> * Factor Term' | / Factor Term' | ε

Factor -> ( Expression ) Factor' | number Factor'

Factor' -> ^ Factor | ε

Dependencies

~1.5MB
~37K SLoC