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.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for mathterpreter-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eeeef528555c4cd19e13e2906155760ab2b47b01414c8c5cb16f98427a48b0f |
|
MD5 | 0960cf7cdfb5bef02ba457f6a8dc0375 |
|
BLAKE2b-256 | f18dac55fd9e2944f847fb26412dfaee295866fb8aae111fb4fb992d9a40e9db |