Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

A simple calculator

This is a simple calculator when I try to recall my compiler courses.

Installation

Use the package manager pip to install compiler-calc.

pip install compiler-calc 

Usage

from compiler_calc.simple_calc import LexAnalysis, SyntaxAnalysis

# To highlight lexcial and syntax analysis
lex_analyser = LexAnalysis()
syntax_analyser = SyntaxAnalysis()

# You can define your own helper functions
def calculate(expr, lex=lex_analyser, syn=syntax_analyser):
    expr_list = lex(expr)
    return syn(expr_list)

calculate('5+4*3^2') # 41
calculate('1/0') # ValueError

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Metadata

Release files for compiler-calc 0.0.1rc4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compiler-calc 0.0.1rc4
File Size Uploaded
compiler-calc-0.0.1rc4.tar.gz 5.2 kB Details

Release files / compiler-calc-0.0.1rc4.tar.gz

Download URL compiler-calc-0.0.1rc4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
984ec765ab66f791ec329fc8875d9d8b9b992547d98edac7b6b68bf164972145
BLAKE2b-256 checksum
How to use checksums
b23b46d8e206f05156dccf60b8d57b44065175a7e740f8b206d2f1b4eeebda0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.1rc4 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page