Simple Arithmetic Interpreter
The library provides a simple interpreter, which can be used for some grammars
recognized by arithmetic-parser
, e.g., integer-, real-, complex-valued and modular arithmetic.
(Both built-in integer types and big integers from num-bigint
are supported.)
The interpreter provides support for native functions,
which allows to overcome some syntax limitations (e.g., the lack of control flow
can be solved with native if
/ loop
functions).
In general, the interpreter is quite opinionated on how to interpret language features. The primary goal is to be intuitive for simple grammars (such as the aforementioned real-valued arithmetic), even if this comes at the cost of rendering the interpreter unusable for other grammars. Universality is explicitly not the design goal.
The interpreter is quite slow – 1–2 orders of magnitude slower than native arithmetic.
Usage
Add this to your Crate.toml
:
[]
= "0.2.0"
Please see the crate docs and examples for the examples of usage.
License
Licensed under the Apache-2.0 license.