rcalc
rcalc is a glorified calculator written in Rust that incorporates the
fundamentals of building any programming language, including a
lexer, parser,
Abstract Syntax Tree, and
AST traverser.
Try it
&&
Features
Currently, rcalc supports
- Addition, subtraction, multiplication, division
- Floating-point (fractional) exponentiation
- Unary Operators
- Accepted operand precedence
- An interactive shell for computation
Todo
-
CLIAccess to input history -
CLIHiding of control characters -
LOGICInteger division -
LOGICModulo operator -
LOGICFactorial operator -
LOGICTrigonometric functions -
OTHERMore to come!
Structure
rcalc is both a binary and a library. This makes
it trivial to use the rcalc library in any other application.
The library is hosted under one namespace, with separate modules for independent components of the calculator "interpreter".
The binary is entirely dependent on the library.
Why?
I was interested in learning (1) Rust and (2) how to create a programming language. I started off with Ruslan Spivak's tutorial on the latter matter, eventually deciding to work a bit more on his calculator application in the pursuit of making something fairly formidable and original in Rust. This repository is the result of that effort. Hopefully, the quality of Rust code in this application will reflect my progressive improvement in the language.