/MU-Calculator

Implementation of a calculator for the CSCI 330: Programming Languages course at Millersville University.

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

MU-Calculator

Implementation of a calculator for the CSCI 330: Programming Languages course at Millersville University.

Applying the theory of Lexical Analysis (Scanning) to tokenize a string into lexemes representative of operands (numbers) or operators (addition, subtraction, multiplication, division, exponentiation), and the theory of Parsing to convert a stream of tokens into an Abstract Syntax Tree representative of an arithmetic expression considering operator precedence and associativity.

Then evaluating an Abstract Syntax Tree representation of an arithmetic expression to compute the answer.

HOW TO RUN PROGRAM:

1.) Open Visual Studio Code

2.) Make sure the Python extension is installed [Extension Identifier: ms-python.python]
    (PLY seems to be already included in the Python extension. However, I have included the
    PLY 3.11 folder in case there is a problem.)

3.) Run Calculator.py

4.) In the terminal, type the following and hit enter: python3 Calculator.py

5.) Type in the calculation you wish to compute and hit Enter

6.) Use Ctrl + D to end the program