Skip to content

ahmadyazdanii/calculator-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

calculator compiler

About

You can compile commands and calculate some mathematic logics !

Commands

Operation Description
+ Plus expression's results together
= Assign an expression's result into a variable
- Mines expression's results together
* Multiply expression's results together
/ Division expression's results together
^ Power expression's results together
() Open and close bracket
print print an expression's result or a variable

You are free to use variables

Usage

python ./Syntax_Analyzer.py [FILE_PATH]

Example

Sample file content:

count = 4  + 4 * (5+6)-7

Count = count + 1

print count-4

x = count * 2^2^2 * (4-2)

print x
count = 3* -x +4/3

print count
  1. Run
python ./Syntax_Analyzer.py ./sample/calculator-commands-simple.txt
  1. Results
37.0
1312.0
-3934.6666666666665

About

A mathematic logics compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages