|
Scientific Calculator
Recursive descent parsing scientific calculator
|
Welcome to the Scientific Calculator GitHub repository! This project is a command-line scientific calculator that supports various mathematical functions and constants. It is designed to handle mathematical expressions such as "3*sin(21) - (22/11 +3)". It uses a recursive descent parsing (RDP) algorithm.
config: Configure the calculator settings, including angle unit, notation, and float precision.sconfig: Show the current configuration (e.g., RAD, Nrm, 4).exit: Exit the calculator.sin: Sine function.cos: Cosine function.tan: Tangent function.exp: Exponential function.log: Logarithmic function.sqrt: Square root function.C: Speed of light.R: Universal gas constant.G: Gravitational constant.Me: Electron mass.Mp: Proton mass.Mn: Neutron mass.E: Electron charge.Na: Avogadro's number.Vm: Molar volume of ideal gas.ANS: Result of the last calculation.PI: Mathematical constant Pi.Clone the repository to your local machine:
Navigate to the project directory:
Compile the calculator:
Run the calculator
config, sconfig, exit) to configure settings and control the calculator.The config command allows you to customize the calculator's configuration:
Example output:
The calculator comes pre-configured with the following settings:
Angle Unit: RAD Notation: Sci (Scientific) Float Precision: 4
The sconfig command displays the current configuration:
Example output:
To exit the calculator, use the exit command:
The calculator's input expressions can be described by the following Context-Free Grammar:
E: Represents the expression, which can be composed of addition, subtraction, or just a term.T: Represents a term, which can be composed of multiplication, division, or just a factor.F: Represents a factor, which can be a negation, a parenthesized expression, a function, a constant, a command, or an empty string.Fct: Represents the mathematical functions supported by the calculator.Const: Represents the constants recognized by the calculator.Cmd: Represents the commands recognized by the calculator.#: Represents a double numeric value.Contributions are welcome! If you have any suggestions, bug reports, or enhancements, feel free to contact me: achra.nosp@m.f.ba.nosp@m.diry@.nosp@m.edu..nosp@m.bme.h.nosp@m.u
This project is licensed under the GNU General Public License - see the LICENSE website for details.