This repository contains a Visual Studio solution for working with expression trees, smart pointers, and related logic libraries.
TepLab3.sln— main solution file.TepLab3/— application entry point inmain.cpp.TepLab3LogicLib/— logic library for tree and formula handling.TepLab3Tests/— test project.SmartPointer/— smart pointer implementation and reference counting example.TepLab4LogicLib/— additional logic library for result handling.
- Microsoft Visual Studio (2017 or later recommended)
- C++ development workload installed
- Open
TepLab3.slnin Visual Studio. - Set the desired startup project:
TepLab3to run the main application.TepLab3Teststo run tests.
- Build the solution using
Build > Build Solution. - Run the selected project with
Debug > Start DebuggingorDebug > Start Without Debugging.
Requirements: g++, cmake (3.20+), gdb, and the VS Code C/C++ Extension Pack.
googletest is downloaded automatically by CMake on the first configure.
In VS Code:
- Open the repository folder and pick a GCC kit when CMake Tools asks.
- Build with
Ctrl+Shift+B(or the Build button in the status bar). - Run/debug with
F5and chooseDebug TepLab3orDebug TepLab3Tests. - Run the tests from the Testing panel (CTest), or run
ctestinbuild/.
From the terminal:
cmake -S . -B build
cmake --build build -j
(cd TepLab3 && ../build/TepLab3) # run from TepLab3/ so trees.txt lands there
ctest --test-dir buildWhen TepLab3 runs, the program shows a prompt like >>> and accepts the following commands:
enter <formula>- Load a new formula into the current tree.
get <name>- Load a formula by name or identifier and save it to
TepLab3/trees.txt.
- Load a formula by name or identifier and save it to
vars- Display the variables currently used in the loaded formula.
print- Display the current formula as a string.
comp <value1> <value2> ...- Compute the loaded formula using the provided variable values.
join <formula>- Join the current formula with another formula.
levels- Print the tree levels of the current formula.
exit- Exit the application.
Example session:
>>> enter + a * b c
Loaded formula: + a * b c
>>> vars
a b c
>>> comp 1 2 3
7
>>> print
a + b * c
>>> exit
- Open
TepLab3.slnin Visual Studio. - Build the solution.
- Use the Test Explorer to discover and run tests from
TepLab3Tests.
- Input files for the main application are available in
TepLab3/:trees.txttrees_perfect_test.txt
- The projects use precompiled headers where applicable.
For any questions or updates, review the source files and project settings in Visual Studio.