Final assignment for the module C963 Foundations of Programming (Grundlagen der Programmierung) from the first semester of my bachelor's degree.
Given, for example, a term in the form: c + * 3.1 4 + 7 8 With the interpretation:
c + * 3.1 4 + 7 8the cosine of the result from+ * 3.1 4 + 7 8+ * 3.1 4 + 7 8is interpreted as: Add* 3.1 4and+ 7 8* 3.1 4is interpreted as the multiplication of3.1and4+ 7 8is interpreted as the addition of7and8
Write a calculator, that evaluates any expression of this form.
src/: Source code of the project lives heretests/: Snapshot test files live herebuild/: Temporary folder that contains build artifactsCOMPILE.txt: Command for compiling a release build of the projectTEST.txt: Documents all test cases and their user-perceived outputbuild.py: Compiles the project for development and generatesCOMPILE.txttest.py: Validates snapshot tests and generatesTEST.txtjustfile: Defines thejust *commands
Make sure that you have a modern version of gcc installed before building. Needs C++23 support.
To build the project simply execute the command found in COMPILE.txt.
Make sure that you have these tools installed before doing a development build or running the tests:
justhttps://github.com/casey/justgcchttps://gcc.gnu.orgclang-formathttps://clang.llvm.orggithttps://git-scm.compythonhttps://www.python.org
And the following are optional (speed up build times):
- List all
justcommands viajust --list just buildorjust bare used to build the projectjust runorjust rare used to build and run the projectjust testorjust tare used to run all testsjust formatto apply fromatting to all C++ files located insrc/
Prefix the compile command with SCCACHE_RECACHE=1 when changing build.py to force scache to use the new configuration and recompile everything.
Example:
# changed compiler flags in build.py
$ SCCACHE_RECACHE=1 just run
# everything gets recompiled and then tiny-calc gets run