The main (entry) script runs a console app expecting an expression input. It uses ExpressionParser to parse a raw input (string) returning token/error list, and SyntaxAnalysisException to build a syntax tree using parsed tokens (if no parsing exceptions occured). In case of any syntax error it raises a SyntaxAnalysisException reffering to error token. Parallel tree module contails functions for convering a syntax tree into its parallel form; they also optimize operations, open brackets applying minus and reduce unary operations. Expression view logs execution results during parsing. Equivalent forms module contains commutativity and distributivity expression opearations. Dynamic conveyor simulates calculations for a given expressions allowing to set different layers count and operations time.
Unit tests cover different behavior cases using the mentioned modules. Many valid and invalid test cases can be found there.
Create venv:
python -m venv venvActivate venv:
source venv/bin/activateDectivate venv:
deactivateInstall dependencies:
pip install -r requirements.txtRun the script:
python main.pyRun tests:
python -m unittest