Skip to content

0xHaru/Calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calc

An interpreter for arithmetic expressions that aims to provide a simple example of recursive descent parsing.

Example

Press CTRL + D to quit

> 2 + 3 * 4
14.0

> (2 - 3) * 4
-4.0

> -2 ^ 2
-4.0

> 2 ^ 2 ^ 3
256.0

> (10 * (350 + -25)) / 2.25
1444.4444444444443

> 100 + -2 ^ -(2.5 + 0.5) * 25
96.875

Prerequisites

  • Linux
  • Python 3.10+

Installation and usage

git clone https://github.com/0xHaru/Calc.git
cd Calc
make run