On this page you find the source code for an expression parser written with C++. It is a small console program with all common mathematical features. The project was written using the free and cross platform CodeBlocks IDE. The project consist of ten source files, listed at the left of this page. You can view the source files online, or download the project including executable.
FeaturesThe features of the expression parser are:
- & | << >>
- = <> < > <= >=
- + -
- * / % ||
- Abs, Exp, Sign, Sqrt, Log, Log10
- Sin, Cos, Tan, ASin, ACos, ATan
- Built-in: Pi, e
- You can define your own variables
- Support for scientific notation
- Built-in error handling
ReferencesThe expression parser is built in the way most common parsers are built. The code is based on the example "A mini C++ Interpreter" from the book "The art of C++" by Herbert Schildt.