2 releases

0.1.1 Nov 7, 2021
0.1.0 Oct 31, 2021

#223 in #calculator


Used in simple_calculator_cmd

MIT license

4KB
68 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
~33K SLoC