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 8
the cosine of the result from+ * 3.1 4 + 7 8
+ * 3.1 4 + 7 8
is interpreted as: Add* 3.1 4
and+ 7 8
* 3.1 4
is interpreted as the multiplication of3.1
and4
+ 7 8
is interpreted as the addition of7
and8
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.txt
test.py
: Validates snapshot tests and generatesTEST.txt
justfile
: 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:
just
https://github.com/casey/justgcc
https://gcc.gnu.orgclang-format
https://clang.llvm.orggit
https://git-scm.compython
https://www.python.org
And the following are optional (speed up build times):
- List all
just
commands viajust --list
just build
orjust b
are used to build the projectjust run
orjust r
are used to build and run the projectjust test
orjust t
are used to run all testsjust format
to 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