A lightweight and basic maths interpreter
Project description
mathterpreter
A lightweight and basic maths interpreter
Example usage
Basic usage
from mathterpreter import interpret
print(interpret("54-3*(2+1)-3"))
Step by step
from mathterpreter import Lexer, Parser
lexer = Lexer("54-3*(2+1)-3")
tokens = lexer.tokenize()
parser = Parser(tokens)
tree = parser.parse()
result = tree.evaluate()
print(result)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mathterpreter-1.0.1.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for mathterpreter-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb524d7ceeb82ffc6f5acb3ea2e5c09322198334687d10e3ce89c24c10085ab8 |
|
MD5 | 3ca694fdf2644d9dc8001b090eda2b3e |
|
BLAKE2b-256 | 37e5cf1e39ff8ebb715fe5c1dbbda5f950265af2ff73d31a47b2bed88260a7fe |